1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.apache.chemistry.opencmis.client.bindings.spi.local;
22
23 import java.math.BigInteger;
24 import java.util.List;
25
26 import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
27 import org.apache.chemistry.opencmis.commons.data.Acl;
28 import org.apache.chemistry.opencmis.commons.data.AllowableActions;
29 import org.apache.chemistry.opencmis.commons.data.ContentStream;
30 import org.apache.chemistry.opencmis.commons.data.ExtensionsData;
31 import org.apache.chemistry.opencmis.commons.data.FailedToDeleteData;
32 import org.apache.chemistry.opencmis.commons.data.ObjectData;
33 import org.apache.chemistry.opencmis.commons.data.Properties;
34 import org.apache.chemistry.opencmis.commons.data.RenditionData;
35 import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships;
36 import org.apache.chemistry.opencmis.commons.enums.UnfileObject;
37 import org.apache.chemistry.opencmis.commons.enums.VersioningState;
38 import org.apache.chemistry.opencmis.commons.server.CmisService;
39 import org.apache.chemistry.opencmis.commons.server.CmisServiceFactory;
40 import org.apache.chemistry.opencmis.commons.spi.Holder;
41 import org.apache.chemistry.opencmis.commons.spi.ObjectService;
42
43 public class ObjectServiceImpl extends AbstractLocalService implements ObjectService {
44
45
46
47
48 public ObjectServiceImpl(BindingSession session, CmisServiceFactory factory) {
49 setSession(session);
50 setServiceFactory(factory);
51 }
52
53 public String createDocument(String repositoryId, Properties properties, String folderId,
54 ContentStream contentStream, VersioningState versioningState, List<String> policies, Acl addAces,
55 Acl removeAces, ExtensionsData extension) {
56 CmisService service = getService(repositoryId);
57
58 try {
59 return service.createDocument(repositoryId, properties, folderId, contentStream, versioningState, policies,
60 addAces, removeAces, extension);
61 } finally {
62 service.close();
63 }
64 }
65
66 public String createDocumentFromSource(String repositoryId, String sourceId, Properties properties,
67 String folderId, VersioningState versioningState, List<String> policies, Acl addAces, Acl removeAces,
68 ExtensionsData extension) {
69 CmisService service = getService(repositoryId);
70
71 try {
72 return service.createDocumentFromSource(repositoryId, sourceId, properties, folderId, versioningState,
73 policies, addAces, removeAces, extension);
74 } finally {
75 service.close();
76 }
77 }
78
79 public String createFolder(String repositoryId, Properties properties, String folderId, List<String> policies,
80 Acl addAces, Acl removeAces, ExtensionsData extension) {
81 CmisService service = getService(repositoryId);
82
83 try {
84 return service.createFolder(repositoryId, properties, folderId, policies, addAces, removeAces, extension);
85 } finally {
86 service.close();
87 }
88 }
89
90 public String createPolicy(String repositoryId, Properties properties, String folderId, List<String> policies,
91 Acl addAces, Acl removeAces, ExtensionsData extension) {
92 CmisService service = getService(repositoryId);
93
94 try {
95 return service.createPolicy(repositoryId, properties, folderId, policies, addAces, removeAces, extension);
96 } finally {
97 service.close();
98 }
99 }
100
101 public String createRelationship(String repositoryId, Properties properties, List<String> policies, Acl addAces,
102 Acl removeAces, ExtensionsData extension) {
103 CmisService service = getService(repositoryId);
104
105 try {
106 return service.createRelationship(repositoryId, properties, policies, addAces, removeAces, extension);
107 } finally {
108 service.close();
109 }
110 }
111
112 public void deleteContentStream(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
113 ExtensionsData extension) {
114 CmisService service = getService(repositoryId);
115
116 try {
117 service.deleteContentStream(repositoryId, objectId, changeToken, extension);
118 } finally {
119 service.close();
120 }
121 }
122
123 public void deleteObject(String repositoryId, String objectId, Boolean allVersions, ExtensionsData extension) {
124 CmisService service = getService(repositoryId);
125
126 try {
127 service.deleteObject(repositoryId, objectId, allVersions, extension);
128 } finally {
129 service.close();
130 }
131 }
132
133 public FailedToDeleteData deleteTree(String repositoryId, String folderId, Boolean allVersions,
134 UnfileObject unfileObjects, Boolean continueOnFailure, ExtensionsData extension) {
135 CmisService service = getService(repositoryId);
136
137 try {
138 return service.deleteTree(repositoryId, folderId, allVersions, unfileObjects, continueOnFailure, extension);
139 } finally {
140 service.close();
141 }
142 }
143
144 public AllowableActions getAllowableActions(String repositoryId, String objectId, ExtensionsData extension) {
145 CmisService service = getService(repositoryId);
146
147 try {
148 return service.getAllowableActions(repositoryId, objectId, extension);
149 } finally {
150 service.close();
151 }
152 }
153
154 public ContentStream getContentStream(String repositoryId, String objectId, String streamId, BigInteger offset,
155 BigInteger length, ExtensionsData extension) {
156 CmisService service = getService(repositoryId);
157
158 try {
159 return service.getContentStream(repositoryId, objectId, streamId, offset, length, extension);
160 } finally {
161 service.close();
162 }
163 }
164
165 public ObjectData getObject(String repositoryId, String objectId, String filter, Boolean includeAllowableActions,
166 IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds,
167 Boolean includeAcl, ExtensionsData extension) {
168 CmisService service = getService(repositoryId);
169
170 try {
171 return service.getObject(repositoryId, objectId, filter, includeAllowableActions, includeRelationships,
172 renditionFilter, includePolicyIds, includeAcl, extension);
173 } finally {
174 service.close();
175 }
176 }
177
178 public ObjectData getObjectByPath(String repositoryId, String path, String filter, Boolean includeAllowableActions,
179 IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds,
180 Boolean includeAcl, ExtensionsData extension) {
181 CmisService service = getService(repositoryId);
182
183 try {
184 return service.getObjectByPath(repositoryId, path, filter, includeAllowableActions, includeRelationships,
185 renditionFilter, includePolicyIds, includeAcl, extension);
186 } finally {
187 service.close();
188 }
189 }
190
191 public Properties getProperties(String repositoryId, String objectId, String filter, ExtensionsData extension) {
192 CmisService service = getService(repositoryId);
193
194 try {
195 return service.getProperties(repositoryId, objectId, filter, extension);
196 } finally {
197 service.close();
198 }
199 }
200
201 public List<RenditionData> getRenditions(String repositoryId, String objectId, String renditionFilter,
202 BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
203 CmisService service = getService(repositoryId);
204
205 try {
206 return service.getRenditions(repositoryId, objectId, renditionFilter, maxItems, skipCount, extension);
207 } finally {
208 service.close();
209 }
210 }
211
212 public void moveObject(String repositoryId, Holder<String> objectId, String targetFolderId, String sourceFolderId,
213 ExtensionsData extension) {
214 CmisService service = getService(repositoryId);
215
216 try {
217 service.moveObject(repositoryId, objectId, targetFolderId, sourceFolderId, extension);
218 } finally {
219 service.close();
220 }
221 }
222
223 public void setContentStream(String repositoryId, Holder<String> objectId, Boolean overwriteFlag,
224 Holder<String> changeToken, ContentStream contentStream, ExtensionsData extension) {
225 CmisService service = getService(repositoryId);
226
227 try {
228 service.setContentStream(repositoryId, objectId, overwriteFlag, changeToken, contentStream, extension);
229 } finally {
230 service.close();
231 }
232 }
233
234 public void updateProperties(String repositoryId, Holder<String> objectId, Holder<String> changeToken,
235 Properties properties, ExtensionsData extension) {
236 CmisService service = getService(repositoryId);
237
238 try {
239 service.updateProperties(repositoryId, objectId, changeToken, properties, extension);
240 } finally {
241 service.close();
242 }
243 }
244 }