This project has retired. For details please refer to its
Attic page.
InMemoryAclService xref
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.chemistry.opencmis.inmemory.server;
20
21 import org.apache.chemistry.opencmis.commons.data.Acl;
22 import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
23 import org.apache.chemistry.opencmis.commons.enums.AclPropagation;
24 import org.apache.chemistry.opencmis.commons.impl.server.ObjectInfoImpl;
25 import org.apache.chemistry.opencmis.commons.server.CallContext;
26 import org.apache.chemistry.opencmis.commons.server.ObjectInfoHandler;
27 import org.apache.chemistry.opencmis.inmemory.storedobj.api.DocumentVersion;
28 import org.apache.chemistry.opencmis.inmemory.storedobj.api.StoreManager;
29 import org.apache.chemistry.opencmis.inmemory.storedobj.api.StoredObject;
30 import org.apache.commons.logging.Log;
31 import org.apache.commons.logging.LogFactory;
32
33 public class InMemoryAclService extends InMemoryAbstractServiceImpl {
34
35 private static final Log LOG = LogFactory.getLog(InMemoryAclService.class.getName());
36 final AtomLinkInfoProvider fAtomLinkProvider;
37
38 public InMemoryAclService(StoreManager storeManager) {
39 super(storeManager);
40 fAtomLinkProvider = new AtomLinkInfoProvider(fStoreManager);
41 }
42
43 public Acl getAcl(CallContext context, String repositoryId, String objectId, Boolean onlyBasicPermissions,
44 ExtensionsData extension, ObjectInfoHandler objectInfos) {
45 LOG.debug("start getAcl()");
46 Acl acl = null;
47 StoredObject so = validator.getAcl(context, repositoryId, objectId, extension);
48 if (so instanceof DocumentVersion)
49 acl = ((DocumentVersion) so).getParentDocument().getAcl();
50 else
51 acl = so.getAcl();
52
53 if (context.isObjectInfoRequired()) {
54 ObjectInfoImpl objectInfo = new ObjectInfoImpl();
55 fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, so, objectInfo);
56 objectInfos.addObjectInfo(objectInfo);
57 }
58
59 return acl;
60 }
61
62 public Acl applyAcl(CallContext context, String repositoryId, String objectId, Acl addAces, Acl removeAces, AclPropagation aclPropagation,
63 ExtensionsData extension, ObjectInfoHandler objectInfos) {
64
65 StoredObject so = validator.applyAcl(context, repositoryId, objectId, aclPropagation, extension);
66 Acl acl = fStoreManager.getObjectStore(repositoryId).applyAcl(so, addAces, removeAces, aclPropagation, context.getUsername());
67
68 if (context.isObjectInfoRequired()) {
69 ObjectInfoImpl objectInfo = new ObjectInfoImpl();
70 fAtomLinkProvider.fillInformationForAtomLinks(repositoryId, so, objectInfo);
71 objectInfos.addObjectInfo(objectInfo);
72 }
73 return acl;
74 }
75
76 public Acl applyAcl(CallContext context, String repositoryId, String objectId, Acl aces, AclPropagation aclPropagation) {
77
78 StoredObject so = validator.applyAcl(context, repositoryId, objectId);
79 return fStoreManager.getObjectStore(repositoryId).applyAcl(so, aces, aclPropagation, context.getUsername());
80 }
81
82 }