This project has retired. For details please refer to its Attic page.
AclService xref

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   * http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.chemistry.opencmis.server.impl.webservices;
20  
21  import static org.apache.chemistry.opencmis.commons.impl.Converter.convert;
22  
23  import javax.annotation.Resource;
24  import javax.jws.WebService;
25  import javax.xml.ws.WebServiceContext;
26  import javax.xml.ws.soap.MTOM;
27  
28  import org.apache.chemistry.opencmis.commons.data.Acl;
29  import org.apache.chemistry.opencmis.commons.enums.AclPropagation;
30  import org.apache.chemistry.opencmis.commons.impl.jaxb.ACLServicePort;
31  import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisACLType;
32  import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisAccessControlListType;
33  import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisException;
34  import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisExtensionType;
35  import org.apache.chemistry.opencmis.commons.impl.jaxb.EnumACLPropagation;
36  import org.apache.chemistry.opencmis.commons.server.CmisService;
37  
38  /**
39   * CMIS ACL Service.
40   */
41  @MTOM
42  @WebService(endpointInterface = "org.apache.chemistry.opencmis.commons.impl.jaxb.ACLServicePort")
43  public class AclService extends AbstractService implements ACLServicePort {
44      @Resource
45      public WebServiceContext wsContext;
46  
47      public CmisACLType applyACL(String repositoryId, String objectId, CmisAccessControlListType addAces,
48              CmisAccessControlListType removeAces, EnumACLPropagation aclPropagation, CmisExtensionType extension)
49              throws CmisException {
50          CmisService service = null;
51          try {
52              service = getService(wsContext, repositoryId);
53  
54              Acl acl = service.applyAcl(repositoryId, objectId, convert(addAces, null), convert(removeAces, null),
55                      convert(AclPropagation.class, aclPropagation), convert(extension));
56  
57              if (acl == null) {
58                  return null;
59              }
60  
61              CmisACLType result = new CmisACLType();
62              result.setACL(convert(acl));
63              result.setExact(acl.isExact());
64  
65              return result;
66          } catch (Exception e) {
67              throw convertException(e);
68          } finally {
69              closeService(service);
70          }
71      }
72  
73      public CmisACLType getACL(String repositoryId, String objectId, Boolean onlyBasicPermissions,
74              CmisExtensionType extension) throws CmisException {
75          CmisService service = null;
76          try {
77              service = getService(wsContext, repositoryId);
78  
79              Acl acl = service.getAcl(repositoryId, objectId, onlyBasicPermissions, convert(extension));
80              if (acl == null) {
81                  return null;
82              }
83  
84              CmisACLType result = new CmisACLType();
85              result.setACL(convert(acl));
86              result.setExact(acl.isExact());
87  
88              return result;
89          } catch (Exception e) {
90              throw convertException(e);
91          } finally {
92              closeService(service);
93          }
94      }
95  }