1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.chemistry.opencmis.server.impl.webservices;
20
21 import org.apache.chemistry.opencmis.commons.data.ObjectList;
22 import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
23 import static org.apache.chemistry.opencmis.commons.impl.Converter.convert;
24 import static org.apache.chemistry.opencmis.commons.impl.Converter.convertHolder;
25 import static org.apache.chemistry.opencmis.commons.impl.Converter.setHolderValue;
26 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisException;
27 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisExtensionType;
28 import org.apache.chemistry.opencmis.commons.impl.jaxb.CmisObjectListType;
29 import org.apache.chemistry.opencmis.commons.impl.jaxb.DiscoveryServicePort;
30 import org.apache.chemistry.opencmis.commons.impl.jaxb.EnumIncludeRelationships;
31 import org.apache.chemistry.opencmis.commons.server.CmisService;
32
33 import java.math.BigInteger;
34
35 import javax.annotation.Resource;
36
37 import javax.jws.WebService;
38
39 import javax.xml.ws.Holder;
40 import javax.xml.ws.WebServiceContext;
41 import javax.xml.ws.soap.MTOM;
42
43
44
45
46
47 @MTOM
48 @WebService( endpointInterface = "org.apache.chemistry.opencmis.commons.impl.jaxb.DiscoveryServicePort" )
49 public class DiscoveryService extends AbstractService implements DiscoveryServicePort
50 {
51 @Resource
52 public WebServiceContext wsContext;
53
54 public void getContentChanges( String repositoryId, Holder<String> changeLogToken, Boolean includeProperties,
55 String filter, Boolean includePolicyIds, Boolean includeAcl, BigInteger maxItems, CmisExtensionType extension,
56 Holder<CmisObjectListType> objects ) throws CmisException
57 {
58 CmisService service = null;
59
60 try
61 {
62 service = getService( wsContext, repositoryId );
63
64 org.apache.chemistry.opencmis.commons.spi.Holder<String> changeLogTokenHolder = convertHolder( changeLogToken );
65
66 ObjectList changesList = service.getContentChanges( repositoryId, changeLogTokenHolder, includeProperties,
67 filter, includePolicyIds, includeAcl, maxItems, convert( extension ) );
68
69 if ( objects != null )
70 {
71 objects.value = convert( changesList );
72 }
73
74 setHolderValue( changeLogTokenHolder, changeLogToken );
75 }
76 catch ( Exception e )
77 {
78 throw convertException( e );
79 }
80 finally
81 {
82 closeService( service );
83 }
84 }
85
86 public CmisObjectListType query( String repositoryId, String statement, Boolean searchAllVersions,
87 Boolean includeAllowableActions, EnumIncludeRelationships includeRelationships, String renditionFilter,
88 BigInteger maxItems, BigInteger skipCount, CmisExtensionType extension )
89 throws CmisException
90 {
91 CmisService service = null;
92
93 try
94 {
95 service = getService( wsContext, repositoryId );
96
97 return convert( service.query( repositoryId, statement, searchAllVersions, includeAllowableActions,
98 convert( IncludeRelationships.class, includeRelationships ), renditionFilter, maxItems, skipCount,
99 convert( extension ) ) );
100 }
101 catch ( Exception e )
102 {
103 throw convertException( e );
104 }
105 finally
106 {
107 closeService( service );
108 }
109 }
110 }