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