This project has retired. For details please refer to its Attic page.
MultiFilingServiceImpl 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.client.bindings.spi.webservices;
20  
21  import static org.apache.chemistry.opencmis.commons.impl.Converter.convertExtensionHolder;
22  import static org.apache.chemistry.opencmis.commons.impl.Converter.setExtensionValues;
23  
24  import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
25  import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
26  import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
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.MultiFilingServicePort;
30  import org.apache.chemistry.opencmis.commons.spi.MultiFilingService;
31  
32  import javax.xml.ws.Holder;
33  
34  /**
35   * MultiFiling Service Web Services client.
36   */
37  public class MultiFilingServiceImpl extends AbstractWebServicesService implements MultiFilingService {
38  
39      private final AbstractPortProvider portProvider;
40  
41      /**
42       * Constructor.
43       */
44      public MultiFilingServiceImpl(BindingSession session, AbstractPortProvider portProvider) {
45          setSession(session);
46          this.portProvider = portProvider;
47      }
48  
49      public void addObjectToFolder(String repositoryId, String objectId, String folderId, Boolean allVersions,
50              ExtensionsData extension) {
51          MultiFilingServicePort port = portProvider.getMultiFilingServicePort();
52  
53          try {
54              Holder<CmisExtensionType> portExtension = convertExtensionHolder(extension);
55  
56              port.addObjectToFolder(repositoryId, objectId, folderId, allVersions, portExtension);
57  
58              setExtensionValues(portExtension, extension);
59          } catch (CmisException e) {
60              throw convertException(e);
61          } catch (Exception e) {
62              throw new CmisRuntimeException("Error: " + e.getMessage(), e);
63          } finally {
64              portProvider.endCall(port);
65          }
66      }
67  
68      public void removeObjectFromFolder(String repositoryId, String objectId, String folderId, ExtensionsData extension) {
69          MultiFilingServicePort port = portProvider.getMultiFilingServicePort();
70  
71          try {
72              Holder<CmisExtensionType> portExtension = convertExtensionHolder(extension);
73  
74              port.removeObjectFromFolder(repositoryId, objectId, folderId, portExtension);
75  
76              setExtensionValues(portExtension, extension);
77          } catch (CmisException e) {
78              throw convertException(e);
79          } catch (Exception e) {
80              throw new CmisRuntimeException("Error: " + e.getMessage(), e);
81          } finally {
82              portProvider.endCall(port);
83          }
84      }
85  }