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.enums.RelationshipDirection;
22  import static org.apache.chemistry.opencmis.commons.impl.Converter.convert;
23  import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisException;
24  import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisExtensionType;
25  import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisObjectListType;
26  import org.apache.chemistry.opencmis.commons.impl.jaxb.EnumRelationshipDirection;
27  import org.apache.chemistry.opencmis.commons.impl.jaxb.RelationshipServicePort;
28  import org.apache.chemistry.opencmis.commons.server.CmisService;
29  
30  import java.math.BigInteger;
31  
32  import javax.annotation.Resource;
33  
34  import javax.jws.WebService;
35  
36  import javax.xml.ws.WebServiceContext;
37  import javax.xml.ws.soap.MTOM;
38  
39  
40  /**
41   * CMIS Relationship Service.
42   */
43  @MTOM
44  @WebService( endpointInterface = "org.apache.chemistry.opencmis.commons.impl.jaxb.RelationshipServicePort" )
45  public class RelationshipService extends AbstractService implements RelationshipServicePort
46  {
47      @Resource
48      public WebServiceContext wsContext;
49  
50      public CmisObjectListType getObjectRelationships( String repositoryId, String objectId,
51          Boolean includeSubRelationshipTypes, EnumRelationshipDirection relationshipDirection, String typeId,
52          String filter, Boolean includeAllowableActions, BigInteger maxItems, BigInteger skipCount,
53          CmisExtensionType extension ) throws CmisException
54      {
55          CmisService service = null;
56  
57          try
58          {
59              service = getService( wsContext, repositoryId );
60  
61              return convert( service.getObjectRelationships( repositoryId, objectId, includeSubRelationshipTypes,
62                      convert( RelationshipDirection.class, relationshipDirection ), typeId, filter,
63                      includeAllowableActions, maxItems, skipCount, convert( extension ) ) );
64          }
65          catch ( Exception e )
66          {
67              throw convertException( e );
68          }
69          finally
70          {
71              closeService( service );
72          }
73      }
74  }