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

1   /*
2    *
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   *   http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing,
14   * software distributed under the License is distributed on an
15   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16   * KIND, either express or implied.  See the License for the
17   * specific language governing permissions and limitations
18   * under the License.
19   *
20   */
21  package org.apache.chemistry.opencmis.client.bindings.spi.local;
22  
23  import java.util.List;
24  
25  import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
26  import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
27  import org.apache.chemistry.opencmis.commons.data.ObjectData;
28  import org.apache.chemistry.opencmis.commons.server.CmisService;
29  import org.apache.chemistry.opencmis.commons.server.CmisServiceFactory;
30  import org.apache.chemistry.opencmis.commons.spi.PolicyService;
31  
32  public class PolicyServiceImpl extends AbstractLocalService implements PolicyService {
33  
34      /**
35       * Constructor.
36       */
37      public PolicyServiceImpl(BindingSession session, CmisServiceFactory factory) {
38          setSession(session);
39          setServiceFactory(factory);
40      }
41  
42      public void applyPolicy(String repositoryId, String policyId, String objectId, ExtensionsData extension) {
43          CmisService service = getService(repositoryId);
44  
45          try {
46              service.applyPolicy(repositoryId, policyId, objectId, extension);
47          } finally {
48              service.close();
49          }
50      }
51  
52      public List<ObjectData> getAppliedPolicies(String repositoryId, String objectId, String filter,
53              ExtensionsData extension) {
54          CmisService service = getService(repositoryId);
55  
56          try {
57              return service.getAppliedPolicies(repositoryId, objectId, filter, extension);
58          } finally {
59              service.close();
60          }
61      }
62  
63      public void removePolicy(String repositoryId, String policyId, String objectId, ExtensionsData extension) {
64          CmisService service = getService(repositoryId);
65  
66          try {
67              service.removePolicy(repositoryId, policyId, objectId, extension);
68          } finally {
69              service.close();
70          }
71      }
72  }