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.commons.spi; 20 21 import java.math.BigInteger; 22 import java.util.List; 23 24 import org.apache.chemistry.opencmis.commons.data.Acl; 25 import org.apache.chemistry.opencmis.commons.data.AllowableActions; 26 import org.apache.chemistry.opencmis.commons.data.ContentStream; 27 import org.apache.chemistry.opencmis.commons.data.ExtensionsData; 28 import org.apache.chemistry.opencmis.commons.data.FailedToDeleteData; 29 import org.apache.chemistry.opencmis.commons.data.ObjectData; 30 import org.apache.chemistry.opencmis.commons.data.Properties; 31 import org.apache.chemistry.opencmis.commons.data.RenditionData; 32 import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships; 33 import org.apache.chemistry.opencmis.commons.enums.UnfileObject; 34 import org.apache.chemistry.opencmis.commons.enums.VersioningState; 35 36 /** 37 * Object Service interface. 38 * 39 * <p> 40 * <em> 41 * See CMIS 1.0 specification for details on the operations, parameters, 42 * exceptions and the domain model. 43 * </em> 44 * </p> 45 */ 46 public interface ObjectService { 47 48 /** 49 * Creates a document object of the specified type (given by the 50 * cmis:objectTypeId property) in the (optionally) specified location. 51 * 52 * @param repositoryId 53 * the identifier for the repository 54 * @param properties 55 * the property values that must be applied to the newly created 56 * document object 57 * @param folderId 58 * <em>(optional)</em> if specified, the identifier for the 59 * folder that must be the parent folder for the newly created 60 * document object 61 * @param contentStream 62 * <em>(optional)</em> the content stream that must be stored for 63 * the newly created document object 64 * @param versioningState 65 * <em>(optional)</em> specifies what the versioning state of the 66 * newly created object must be (default is 67 * {@link VersioningState#MAJOR}) 68 * @param policies 69 * <em>(optional)</em> a list of policy IDs that must be applied 70 * to the newly created document object 71 * @param addAces 72 * <em>(optional)</em> a list of ACEs that must be added to the 73 * newly created document object, either using the ACL from 74 * <code>folderId</code> if specified, or being applied if no 75 * <code>folderId</code> is specified 76 * @param removeAces 77 * <em>(optional)</em> a list of ACEs that must be removed from 78 * the newly created document object, either using the ACL from 79 * <code>folderId</code> if specified, or being ignored if no 80 * <code>folderId</code> is specified 81 */ 82 String createDocument(String repositoryId, Properties properties, String folderId, ContentStream contentStream, 83 VersioningState versioningState, List<String> policies, Acl addAces, Acl removeAces, 84 ExtensionsData extension); 85 86 /** 87 * Creates a document object as a copy of the given source document in the 88 * (optionally) specified location. 89 * 90 * @param repositoryId 91 * the identifier for the repository 92 * @param sourceId 93 * the identifier for the source document 94 * @param properties 95 * the property values that must be applied to the newly created 96 * document object 97 * @param folderId 98 * <em>(optional)</em> if specified, the identifier for the 99 * folder that must be the parent folder for the newly created 100 * document object 101 * @param versioningState 102 * <em>(optional)</em> specifies what the versioning state of the 103 * newly created object must be (default is 104 * {@link VersioningState#MAJOR}) 105 * @param policies 106 * <em>(optional)</em> a list of policy IDs that must be applied 107 * to the newly created document object 108 * @param addAces 109 * <em>(optional)</em> a list of ACEs that must be added to the 110 * newly created document object, either using the ACL from 111 * <code>folderId</code> if specified, or being applied if no 112 * <code>folderId</code> is specified 113 * @param removeAces 114 * <em>(optional)</em> a list of ACEs that must be removed from 115 * the newly created document object, either using the ACL from 116 * <code>folderId</code> if specified, or being ignored if no 117 * <code>folderId</code> is specified 118 */ 119 String createDocumentFromSource(String repositoryId, String sourceId, Properties properties, String folderId, 120 VersioningState versioningState, List<String> policies, Acl addAces, Acl removeAces, 121 ExtensionsData extension); 122 123 /** 124 * Creates a folder object of the specified type (given by the 125 * cmis:objectTypeId property) in the specified location. 126 * 127 * @param repositoryId 128 * the identifier for the repository 129 * @param properties 130 * the property values that must be applied to the newly created 131 * folder object 132 * @param folderId 133 * the identifier for the parent folder 134 * @param policies 135 * <em>(optional)</em> a list of policy IDs that must be applied 136 * to the newly created folder object 137 * @param addAces 138 * <em>(optional)</em> a list of ACEs that must be added to the 139 * newly created folder object, either using the ACL from 140 * <code>folderId</code> if specified, or being applied if no 141 * <code>folderId</code> is specified 142 * @param removeAces 143 * <em>(optional)</em> a list of ACEs that must be removed from 144 * the newly created folder object, either using the ACL from 145 * <code>folderId</code> if specified, or being ignored if no 146 * <code>folderId</code> is specified 147 */ 148 String createFolder(String repositoryId, Properties properties, String folderId, List<String> policies, 149 Acl addAces, Acl removeAces, ExtensionsData extension); 150 151 /** 152 * Creates a relationship object of the specified type (given by the 153 * cmis:objectTypeId property). 154 * 155 * @param repositoryId 156 * the identifier for the repository 157 * @param properties 158 * the property values that must be applied to the newly created 159 * relationship object 160 * @param policies 161 * <em>(optional)</em> a list of policy IDs that must be applied 162 * to the newly created relationship object 163 * @param addAces 164 * <em>(optional)</em> a list of ACEs that must be added to the 165 * newly created relationship object, either using the ACL from 166 * <code>folderId</code> if specified, or being applied if no 167 * <code>folderId</code> is specified 168 * @param removeAces 169 * <em>(optional)</em> a list of ACEs that must be removed from 170 * the newly created relationship object, either using the ACL 171 * from <code>folderId</code> if specified, or being ignored if 172 * no <code>folderId</code> is specified 173 */ 174 String createRelationship(String repositoryId, Properties properties, List<String> policies, Acl addAces, 175 Acl removeAces, ExtensionsData extension); 176 177 /** 178 * Creates a policy object of the specified type (given by the 179 * cmis:objectTypeId property). 180 * 181 * @param repositoryId 182 * the identifier for the repository 183 * @param properties 184 * the property values that must be applied to the newly created 185 * policy object 186 * @param folderId 187 * <em>(optional)</em> if specified, the identifier for the 188 * folder that must be the parent folder for the newly created 189 * policy object 190 * @param policies 191 * <em>(optional)</em> a list of policy IDs that must be applied 192 * to the newly created policy object 193 * @param addAces 194 * <em>(optional)</em> a list of ACEs that must be added to the 195 * newly created policy object, either using the ACL from 196 * <code>folderId</code> if specified, or being applied if no 197 * <code>folderId</code> is specified 198 * @param removeAces 199 * <em>(optional)</em> a list of ACEs that must be removed from 200 * the newly created policy object, either using the ACL from 201 * <code>folderId</code> if specified, or being ignored if no 202 * <code>folderId</code> is specified 203 */ 204 String createPolicy(String repositoryId, Properties properties, String folderId, List<String> policies, 205 Acl addAces, Acl removeAces, ExtensionsData extension); 206 207 /** 208 * Gets the list of allowable actions for an object. 209 * 210 * @param repositoryId 211 * the identifier for the repository 212 * @param objectId 213 * the identifier for the object 214 */ 215 AllowableActions getAllowableActions(String repositoryId, String objectId, ExtensionsData extension); 216 217 /** 218 * Gets the specified information for the object specified by id. 219 * 220 * @param repositoryId 221 * the identifier for the repository 222 * @param objectId 223 * the identifier for the object 224 * @param filter 225 * <em>(optional)</em> a comma-separated list of query names that 226 * defines which properties must be returned by the repository 227 * (default is repository specific) 228 * @param includeAllowableActions 229 * <em>(optional)</em> if <code>true</code>, then the repository 230 * must return the available actions for the object (default is 231 * <code>false</code>) 232 * @param includeRelationships 233 * <em>(optional)</em> indicates what relationships in which the 234 * object participates must be returned (default is 235 * {@link IncludeRelationships#NONE}) 236 * @param renditionFilter 237 * <em>(optional)</em> indicates what set of renditions the 238 * repository must return whose kind matches this filter (default 239 * is <code>"cmis:none"</code>) 240 * @param includePolicyIds 241 * <em>(optional)</em> if <code>true</code>, then the repository 242 * must return the policy ids for the object (default is 243 * <code>false</code>) 244 * @param includeAcl 245 * <em>(optional)</em> if <code>true</code>, then the repository 246 * must return the ACL for the object (default is 247 * <code>false</code>) 248 */ 249 ObjectData getObject(String repositoryId, String objectId, String filter, Boolean includeAllowableActions, 250 IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds, 251 Boolean includeAcl, ExtensionsData extension); 252 253 /** 254 * Gets the list of properties for an object. 255 * 256 * @param repositoryId 257 * the identifier for the repository 258 * @param objectId 259 * the identifier for the object 260 * @param filter 261 * <em>(optional)</em> a comma-separated list of query names that 262 * defines which properties must be returned by the repository 263 * (default is repository specific) 264 */ 265 Properties getProperties(String repositoryId, String objectId, String filter, ExtensionsData extension); 266 267 /** 268 * Gets the list of associated renditions for the specified object. Only 269 * rendition attributes are returned, not rendition stream. 270 * 271 * @param repositoryId 272 * the identifier for the repository 273 * @param objectId 274 * the identifier for the object 275 * @param renditionFilter 276 * <em>(optional)</em> indicates what set of renditions the 277 * repository must return whose kind matches this filter (default 278 * is <code>"cmis:none"</code>) 279 * @param maxItems 280 * <em>(optional)</em> the maximum number of items to return in a 281 * response (default is repository specific) 282 * @param skipCount 283 * <em>(optional)</em> number of potential results that the 284 * repository must skip/page over before returning any results 285 * (default is 0) 286 */ 287 List<RenditionData> getRenditions(String repositoryId, String objectId, String renditionFilter, 288 BigInteger maxItems, BigInteger skipCount, ExtensionsData extension); 289 290 /** 291 * Gets the specified information for the object specified by path. 292 * 293 * @param repositoryId 294 * the identifier for the repository 295 * @param path 296 * the path to the object 297 * @param filter 298 * <em>(optional)</em> a comma-separated list of query names that 299 * defines which properties must be returned by the repository 300 * (default is repository specific) 301 * @param includeAllowableActions 302 * <em>(optional)</em> if <code>true</code>, then the repository 303 * must return the available actions for the object (default is 304 * <code>false</code>) 305 * @param includeRelationships 306 * <em>(optional)</em> indicates what relationships in which the 307 * object participates must be returned (default is 308 * {@link IncludeRelationships#NONE}) 309 * @param renditionFilter 310 * <em>(optional)</em> indicates what set of renditions the 311 * repository must return whose kind matches this filter (default 312 * is <code>"cmis:none"</code>) 313 * @param includePolicyIds 314 * <em>(optional)</em> if <code>true</code>, then the repository 315 * must return the policy ids for the object (default is 316 * <code>false</code>) 317 * @param includeAcl 318 * <em>(optional)</em> if <code>true</code>, then the repository 319 * must return the ACL for the object (default is 320 * <code>false</code>) 321 */ 322 ObjectData getObjectByPath(String repositoryId, String path, String filter, Boolean includeAllowableActions, 323 IncludeRelationships includeRelationships, String renditionFilter, Boolean includePolicyIds, 324 Boolean includeAcl, ExtensionsData extension); 325 326 /** 327 * Gets the content stream for the specified document object, or gets a 328 * rendition stream for a specified rendition of a document or folder 329 * object. 330 * 331 * @param repositoryId 332 * the identifier for the repository 333 * @param objectId 334 * the identifier for the object 335 */ 336 ContentStream getContentStream(String repositoryId, String objectId, String streamId, BigInteger offset, 337 BigInteger length, ExtensionsData extension); 338 339 /** 340 * Updates properties of the specified object. 341 * 342 * @param repositoryId 343 * the identifier for the repository 344 * @param objectId 345 * the identifier for the object. The repository might return a 346 * different/new object id 347 * @param changeToken 348 * <em>(optional)</em> the last change token of this object that 349 * the client received. The repository might return a new change 350 * token (default is <code>null</code>) 351 * @param properties 352 * the updated property values that must be applied to the object 353 */ 354 void updateProperties(String repositoryId, Holder<String> objectId, Holder<String> changeToken, 355 Properties properties, ExtensionsData extension); 356 357 /** 358 * Moves the specified file-able object from one folder to another. 359 * 360 * @param repositoryId 361 * the identifier for the repository 362 * @param objectId 363 * the identifier for the object. The repository might return a 364 * different/new object id 365 * @param targetFolderId 366 * the identifier for the target folder 367 * @param sourceFolderId 368 * the identifier for the source folder 369 */ 370 void moveObject(String repositoryId, Holder<String> objectId, String targetFolderId, String sourceFolderId, 371 ExtensionsData extension); 372 373 /** 374 * Deletes the specified object. 375 * 376 * @param repositoryId 377 * the identifier for the repository 378 * @param objectId 379 * the identifier for the object 380 * @param allVersions 381 * <em>(optional)</em> If <code>true</code> then delete all 382 * versions of the document, otherwise delete only the document 383 * object specified (default is <code>true</code>) 384 */ 385 void deleteObject(String repositoryId, String objectId, Boolean allVersions, ExtensionsData extension); 386 387 /** 388 * Deletes the specified folder object and all of its child- and 389 * descendant-objects. 390 * 391 * @param repositoryId 392 * the identifier for the repository 393 * @param folderId 394 * the identifier for the folder 395 * @param allVersions 396 * <em>(optional)</em> If <code>true</code> then delete all 397 * versions of the document, otherwise delete only the document 398 * object specified (default is <code>true</code>) 399 * @param unfileObjects 400 * <em>(optional)</em> defines how the repository must process 401 * file-able child- or descendant-objects (default is 402 * {@link UnfileObject#DELETE}) 403 * @param continueOnFailure 404 * <em>(optional)</em> If <code>true</code>, then the repository 405 * should continue attempting to perform this operation even if 406 * deletion of a child- or descendant-object in the specified 407 * folder cannot be deleted (default is <code>false</code>) 408 */ 409 FailedToDeleteData deleteTree(String repositoryId, String folderId, Boolean allVersions, 410 UnfileObject unfileObjects, Boolean continueOnFailure, ExtensionsData extension); 411 412 /** 413 * Sets the content stream for the specified document object. 414 * 415 * @param repositoryId 416 * the identifier for the repository 417 * @param objectId 418 * the identifier for the object. The repository might return a 419 * different/new object id 420 * @param overwriteFlag 421 * <em>(optional)</em> If <code>true</code>, then the repository 422 * must replace the existing content stream for the object (if 423 * any) with the input content stream. If If <code>false</code>, 424 * then the repository must only set the input content stream for 425 * the object if the object currently does not have a content 426 * stream (default is <code>true</code>) 427 * @param changeToken 428 * <em>(optional)</em> the last change token of this object that 429 * the client received. The repository might return a new change 430 * token (default is <code>null</code>) 431 * @param contentStream 432 * the content stream 433 */ 434 void setContentStream(String repositoryId, Holder<String> objectId, Boolean overwriteFlag, 435 Holder<String> changeToken, ContentStream contentStream, ExtensionsData extension); 436 437 /** 438 * Deletes the content stream for the specified document object. 439 * 440 * @param repositoryId 441 * the identifier for the repository 442 * @param objectId 443 * the identifier for the object. The repository might return a 444 * different/new object id 445 * @param changeToken 446 * <em>(optional)</em> the last change token of this object that 447 * the client received. The repository might return a new change 448 * token (default is <code>null</code>) 449 */ 450 void deleteContentStream(String repositoryId, Holder<String> objectId, Holder<String> changeToken, 451 ExtensionsData extension); 452 }