cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with ACL in OpenCMIS

jawwad
Champ in-the-making
Champ in-the-making
Hi,

      I am trying to add ACL to an existing document using OpenCMIS. I ve created ACEs and tried to apply them using addAcl() and apply Acl(). It doesnt give any error when I call these functions so I assume that the ACL is applied successfully. but when I try to get the ACL using getAcl() it returns a null pointer Exception. My code is:

   List<String> permissions = new ArrayList<String>();
      permissions.add("cmis:all");
      String principal = "admin";
      Ace ace = session.getObjectFactory().createAce(principal, permissions);
                existingBook.addAcl(addAce, AclPropagation.REPOSITORYDETERMINED);
                //Null pointer Exception on this statement
               List<Ace> aceList = existingBook.getAcl().getAces();

      Can anyone tell me why Acl is still null???? or what am I doing wrong :?:

       Any help will be appriciated. Thanks in advance
2 REPLIES 2

fmui
Champ in-the-making
Champ in-the-making
When you fetched the object, did you tell OpenCMIS to include the ACL? If not, it will always be null.

Try something like this:

OperationContext oc = session.createOperationContext();
oc.setIncludeAcls(true);

CmisObject existingBook = session.getObject("your id", oc);

Florian

jawwad
Champ in-the-making
Champ in-the-making
Thanks Florian. Yes I didnt know that it is necessary to set includeAcls to true. Thanks a lot