1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.chemistry.opencmis.server.impl.webservices;
20
21 import org.apache.chemistry.opencmis.commons.data.Acl;
22 import org.apache.chemistry.opencmis.commons.enums.AclPropagation;
23 import static org.apache.chemistry.opencmis.commons.impl.Converter.convert;
24 import org.apache.chemistry.opencmis.commons.impl.jaxb.ACLServicePort;
25 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisACLType;
26 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisAccessControlListType;
27 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisException;
28 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisExtensionType;
29 import org.apache.chemistry.opencmis.commons.impl.jaxb.EnumACLPropagation;
30 import org.apache.chemistry.opencmis.commons.server.CmisService;
31
32 import javax.annotation.Resource;
33
34 import javax.jws.WebService;
35
36 import javax.xml.ws.WebServiceContext;
37 import javax.xml.ws.soap.MTOM;
38
39
40
41
42
43 @MTOM
44 @WebService( endpointInterface = "org.apache.chemistry.opencmis.commons.impl.jaxb.ACLServicePort" )
45 public class AclService extends AbstractService implements ACLServicePort
46 {
47 @Resource
48 public WebServiceContext wsContext;
49
50 public CmisACLType applyACL( String repositoryId, String objectId, CmisAccessControlListType addAces,
51 CmisAccessControlListType removeAces, EnumACLPropagation aclPropagation, CmisExtensionType extension )
52 throws CmisException
53 {
54 CmisService service = null;
55
56 try
57 {
58 service = getService( wsContext, repositoryId );
59
60 Acl acl = service.applyAcl( repositoryId, objectId, convert( addAces, null ), convert( removeAces, null ),
61 convert( AclPropagation.class, aclPropagation ), convert( extension ) );
62
63 if ( acl == null )
64 {
65 return null;
66 }
67
68 CmisACLType result = new CmisACLType( );
69 result.setACL( convert( acl ) );
70 result.setExact( acl.isExact( ) );
71
72 return result;
73 }
74 catch ( Exception e )
75 {
76 throw convertException( e );
77 }
78 finally
79 {
80 closeService( service );
81 }
82 }
83
84 public CmisACLType getACL( String repositoryId, String objectId, Boolean onlyBasicPermissions,
85 CmisExtensionType extension ) throws CmisException
86 {
87 CmisService service = null;
88
89 try
90 {
91 service = getService( wsContext, repositoryId );
92
93 Acl acl = service.getAcl( repositoryId, objectId, onlyBasicPermissions, convert( extension ) );
94
95 if ( acl == null )
96 {
97 return null;
98 }
99
100 CmisACLType result = new CmisACLType( );
101 result.setACL( convert( acl ) );
102 result.setExact( acl.isExact( ) );
103
104 return result;
105 }
106 catch ( Exception e )
107 {
108 throw convertException( e );
109 }
110 finally
111 {
112 closeService( service );
113 }
114 }
115 }