This project has retired. For details please refer to its Attic page.
MultiFilingService 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.convertExtensionHolder;
22  import static org.apache.chemistry.opencmis.commons.impl.Converter.setExtensionValues;
23  
24  import javax.annotation.Resource;
25  import javax.jws.WebService;
26  import javax.xml.ws.Holder;
27  import javax.xml.ws.WebServiceContext;
28  import javax.xml.ws.soap.MTOM;
29  
30  import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
31  import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisException;
32  import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisExtensionType;
33  import org.apache.chemistry.opencmis.commons.impl.jaxb.MultiFilingServicePort;
34  import org.apache.chemistry.opencmis.commons.server.CmisService;
35  
36  /**
37   * CMIS MultiFiling Service.
38   */
39  @MTOM
40  @WebService(endpointInterface = "org.apache.chemistry.opencmis.commons.impl.jaxb.MultiFilingServicePort")
41  public class MultiFilingService extends AbstractService implements MultiFilingServicePort {
42      @Resource
43      public WebServiceContext wsContext;
44  
45      public void addObjectToFolder(String repositoryId, String objectId, String folderId, Boolean allVersions,
46              Holder<CmisExtensionType> extension) throws CmisException {
47          CmisService service = null;
48          try {
49              service = getService(wsContext, repositoryId);
50  
51              ExtensionsData extData = convertExtensionHolder(extension);
52  
53              service.addObjectToFolder(repositoryId, objectId, folderId, allVersions, extData);
54  
55              setExtensionValues(extData, extension);
56          } catch (Exception e) {
57              throw convertException(e);
58          } finally {
59              closeService(service);
60          }
61      }
62  
63      public void removeObjectFromFolder(String repositoryId, String objectId, String folderId,
64              Holder<CmisExtensionType> extension) throws CmisException {
65          CmisService service = null;
66          try {
67              service = getService(wsContext, repositoryId);
68  
69              ExtensionsData extData = convertExtensionHolder(extension);
70  
71              service.removeObjectFromFolder(repositoryId, objectId, folderId, extData);
72  
73              setExtensionValues(extData, extension);
74          } catch (Exception e) {
75              throw convertException(e);
76          } finally {
77              closeService(service);
78          }
79      }
80  }