001/* 002 * This library is part of OpenCms - 003 * the Open Source Content Management System 004 * 005 * Copyright (C) Alkacon Software (http://www.alkacon.com) 006 * 007 * This library is free software; you can redistribute it and/or 008 * modify it under the terms of the GNU Lesser General Public 009 * License as published by the Free Software Foundation; either 010 * version 2.1 of the License, or (at your option) any later version. 011 * 012 * This library is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * For further information about Alkacon Software, please see the 018 * company website: http://www.alkacon.com 019 * 020 * For further information about OpenCms, please see the 021 * project website: http://www.opencms.org 022 * 023 * You should have received a copy of the GNU Lesser General Public 024 * License along with this library; if not, write to the Free Software 025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 026 */ 027 028package org.opencms.cmis; 029 030import org.opencms.configuration.CmsParameterConfiguration; 031import org.opencms.repository.CmsRepositoryFilter; 032import org.opencms.repository.I_CmsRepository; 033 034import java.math.BigInteger; 035import java.util.List; 036 037import org.apache.chemistry.opencmis.commons.data.Acl; 038import org.apache.chemistry.opencmis.commons.data.AllowableActions; 039import org.apache.chemistry.opencmis.commons.data.ContentStream; 040import org.apache.chemistry.opencmis.commons.data.FailedToDeleteData; 041import org.apache.chemistry.opencmis.commons.data.ObjectData; 042import org.apache.chemistry.opencmis.commons.data.ObjectInFolderContainer; 043import org.apache.chemistry.opencmis.commons.data.ObjectInFolderList; 044import org.apache.chemistry.opencmis.commons.data.ObjectList; 045import org.apache.chemistry.opencmis.commons.data.ObjectParentData; 046import org.apache.chemistry.opencmis.commons.data.Properties; 047import org.apache.chemistry.opencmis.commons.data.RenditionData; 048import org.apache.chemistry.opencmis.commons.data.RepositoryInfo; 049import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition; 050import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionContainer; 051import org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionList; 052import org.apache.chemistry.opencmis.commons.enums.AclPropagation; 053import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships; 054import org.apache.chemistry.opencmis.commons.enums.RelationshipDirection; 055import org.apache.chemistry.opencmis.commons.enums.UnfileObject; 056import org.apache.chemistry.opencmis.commons.enums.VersioningState; 057import org.apache.chemistry.opencmis.commons.spi.Holder; 058 059/** 060 * Base interface for OpenCms CMIS repositories.<p> 061 */ 062public interface I_CmsCmisRepository extends I_CmsRepository { 063 064 /** 065 * Adds an object to a folder (multifiling). <p> 066 * 067 * @param context the call context 068 * @param objectId the object id 069 * @param folderId the folder id 070 * @param allVersions flag to include all versions 071 */ 072 void addObjectToFolder(CmsCmisCallContext context, String objectId, String folderId, boolean allVersions); 073 074 /** 075 * Applies ACL to an object.<p> 076 * 077 * @param context the call context 078 * @param objectId the object id 079 * @param addAces the ACEs to add 080 * @param removeAces the ACEs to remove 081 * @param aclPropagation the ACL propagation 082 * 083 * @return the new ACL 084 */ 085 Acl applyAcl( 086 CmsCmisCallContext context, 087 String objectId, 088 Acl addAces, 089 Acl removeAces, 090 AclPropagation aclPropagation); 091 092 /** 093 * Changes the ACL for an object.<p> 094 * 095 * @param context the call context 096 * @param objectId the object id 097 * @param aces the access control entries 098 * @param aclPropagation the propagation mode 099 * 100 * @return the new ACL 101 */ 102 Acl applyAcl(CmsCmisCallContext context, String objectId, Acl aces, AclPropagation aclPropagation); 103 104 /** 105 * Applies a policy to an object.<p> 106 * 107 * @param context the call context 108 * @param policyId the policy id 109 * @param objectId the object id 110 */ 111 void applyPolicy(CmsCmisCallContext context, String policyId, String objectId); 112 113 /** 114 * Cancels a checkout.<p> 115 * 116 * @param context the call context 117 * @param objectId the object id 118 */ 119 void cancelCheckOut(CmsCmisCallContext context, String objectId); 120 121 /** 122 * Checks in a document.<p> 123 * 124 * @param context the call context 125 * @param objectId the object id 126 * @param major the major version flag 127 * @param properties the properties 128 * @param contentStream the content stream 129 * @param checkinComment the check-in comment 130 * @param policies the policies 131 * @param addAces the ACEs to add 132 * @param removeAces the ACEs to remove 133 */ 134 void checkIn( 135 CmsCmisCallContext context, 136 Holder<String> objectId, 137 boolean major, 138 Properties properties, 139 ContentStream contentStream, 140 String checkinComment, 141 List<String> policies, 142 Acl addAces, 143 Acl removeAces); 144 145 /** 146 * Checks out an object.<p> 147 * 148 * @param context the call context 149 * @param objectId the object id 150 * @param contentCopied indicator whether the content was copied 151 */ 152 void checkOut(CmsCmisCallContext context, Holder<String> objectId, Holder<Boolean> contentCopied); 153 154 /** 155 * Creates a new document.<p> 156 * 157 * @param context the call context 158 * @param propertiesObj the properties 159 * @param folderId the parent folder id 160 * @param contentStream the content stream 161 * @param versioningState the versioning state 162 * @param policies the policies 163 * @param addAces the access control entries 164 * @param removeAces the access control entries to remove 165 * 166 * @return the object id of the new document 167 */ 168 String createDocument( 169 CmsCmisCallContext context, 170 Properties propertiesObj, 171 String folderId, 172 ContentStream contentStream, 173 VersioningState versioningState, 174 List<String> policies, 175 Acl addAces, 176 Acl removeAces); 177 178 /** 179 * Copies a document.<p> 180 * 181 * @param context the call context 182 * @param sourceId the source object id 183 * @param propertiesObj the properties 184 * @param folderId the target folder id 185 * @param versioningState the versioning state 186 * @param policies the policies 187 * @param addAces the ACEs to add 188 * @param removeAces the ACES to remove 189 * 190 * @return the object id of the new document 191 */ 192 String createDocumentFromSource( 193 CmsCmisCallContext context, 194 String sourceId, 195 Properties propertiesObj, 196 String folderId, 197 VersioningState versioningState, 198 List<String> policies, 199 Acl addAces, 200 Acl removeAces); 201 202 /** 203 * Creates a new folder.<p> 204 * 205 * @param context the call context 206 * @param propertiesObj the properties 207 * @param folderId the parent folder id 208 * @param policies the policies 209 * @param addAces the ACEs to add 210 * @param removeAces the ACEs to remove 211 * 212 * @return the object id of the created folder 213 */ 214 String createFolder( 215 CmsCmisCallContext context, 216 Properties propertiesObj, 217 String folderId, 218 List<String> policies, 219 Acl addAces, 220 Acl removeAces); 221 222 /** 223 * Creates a policy.<p> 224 * 225 * @param context the call context 226 * @param properties the properties 227 * @param folderId the folder id 228 * @param policies the policies 229 * @param addAces the ACEs to add 230 * @param removeAces the ACEs to remove 231 * 232 * @return the new object id 233 */ 234 String createPolicy( 235 CmsCmisCallContext context, 236 Properties properties, 237 String folderId, 238 List<String> policies, 239 Acl addAces, 240 Acl removeAces); 241 242 /** 243 * Creates a relationship.<p> 244 * 245 * @param context the call context 246 * @param properties the properties 247 * @param policies the policies 248 * @param addAces the ACEs to add 249 * @param removeAces the ACEs to remove 250 * 251 * @return the new relationship id 252 */ 253 String createRelationship( 254 CmsCmisCallContext context, 255 Properties properties, 256 List<String> policies, 257 Acl addAces, 258 Acl removeAces); 259 260 /** 261 * Deletes the content stream of an object.<p> 262 * 263 * @param context the call context 264 * @param objectId the object id 265 * @param changeToken the change token 266 */ 267 void deleteContentStream(CmsCmisCallContext context, Holder<String> objectId, Holder<String> changeToken); 268 269 /** 270 * Deletes a CMIS object.<p> 271 * 272 * @param context the call context 273 * @param objectId the id of the object to delete 274 * @param allVersions flag to delete all version 275 */ 276 void deleteObject(CmsCmisCallContext context, String objectId, boolean allVersions); 277 278 /** 279 * Deletes a whole file tree.<p> 280 * 281 * @param context the call context 282 * @param folderId the folder id 283 * @param allVersions flag to include all versions 284 * @param unfileObjects flag to unfile objects 285 * @param continueOnFailure flag to continue on failure 286 * 287 * @return data containing the objects which weren'T deleted successfully 288 */ 289 FailedToDeleteData deleteTree( 290 CmsCmisCallContext context, 291 String folderId, 292 boolean allVersions, 293 UnfileObject unfileObjects, 294 boolean continueOnFailure); 295 296 /** 297 * Gets the ACL for an object.<p> 298 * 299 * @param context the call context 300 * @param objectId the object id 301 * @param onlyBasicPermissions flag to only get basic permissions 302 * 303 * @return the ACL for the object 304 */ 305 Acl getAcl(CmsCmisCallContext context, String objectId, boolean onlyBasicPermissions); 306 307 /** 308 * Gets the allowable actions for an object.<p> 309 * 310 * @param context the call context 311 * @param objectId the object id 312 * @return the allowable actions 313 */ 314 AllowableActions getAllowableActions(CmsCmisCallContext context, String objectId); 315 316 /** 317 * Gets all versions of an object.<p> 318 * 319 * @param context the call context 320 * @param objectId the object id 321 * @param versionSeriesId the version series id 322 * @param filter the property filter string 323 * @param includeAllowableActions the flag to include allowable actions 324 * 325 * @return the list of versions 326 */ 327 List<ObjectData> getAllVersions( 328 CmsCmisCallContext context, 329 String objectId, 330 String versionSeriesId, 331 String filter, 332 boolean includeAllowableActions); 333 334 /** 335 * Gets the policies for an object.<p> 336 * 337 * @param context the call context 338 * @param objectId the object id 339 * @param filter the property filter 340 * 341 * @return the policies for the object 342 */ 343 List<ObjectData> getAppliedPolicies(CmsCmisCallContext context, String objectId, String filter); 344 345 /** 346 * Corresponds to CMIS getCheckedOutDocs service method.<p> 347 * 348 * @param context 349 * @param folderId 350 * @param filter 351 * @param orderBy 352 * @param includeAllowableActions 353 * @param includeRelationships 354 * @param renditionFilter 355 * @param maxItems 356 * @param skipCount 357 * 358 * @return a list of CMIS objects 359 */ 360 ObjectList getCheckedOutDocs( 361 CmsCmisCallContext context, 362 String folderId, 363 String filter, 364 String orderBy, 365 boolean includeAllowableActions, 366 IncludeRelationships includeRelationships, 367 String renditionFilter, 368 BigInteger maxItems, 369 BigInteger skipCount); 370 371 /** 372 * Gets the children of a folder.<p> 373 * 374 * @param context the call context 375 * @param folderId the parent folder id 376 * @param filter the property filter 377 * @param orderBy the ordering clause 378 * @param includeAllowableActions flag to include allowable actions 379 * @param includeRelationships flag to include relations 380 * @param renditionFilter the rendition filter string 381 * @param includePathSegment flag to include the path segment 382 * @param maxItems the maximum number of items 383 * @param skipCount the index from which to start 384 * 385 * @return the object information 386 */ 387 ObjectInFolderList getChildren( 388 CmsCmisCallContext context, 389 String folderId, 390 String filter, 391 String orderBy, 392 boolean includeAllowableActions, 393 IncludeRelationships includeRelationships, 394 String renditionFilter, 395 boolean includePathSegment, 396 BigInteger maxItems, 397 BigInteger skipCount); 398 399 /** 400 * @see org.opencms.configuration.I_CmsConfigurationParameterHandler#getConfiguration() 401 */ 402 CmsParameterConfiguration getConfiguration(); 403 404 /** 405 * Gets content changes from the repository.<p> 406 * 407 * @param context the call context 408 * @param changeLogToken the change log token 409 * @param includeProperties flag to include properties 410 * @param filter filter string for properties 411 * @param includePolicyIds flag to include policy ids 412 * @param includeAcl flag to include ACLs 413 * @param maxItems maximum number of items to return 414 * 415 * @return the list of content changes 416 */ 417 ObjectList getContentChanges( 418 CmsCmisCallContext context, 419 Holder<String> changeLogToken, 420 boolean includeProperties, 421 String filter, 422 boolean includePolicyIds, 423 boolean includeAcl, 424 BigInteger maxItems); 425 426 /** 427 * Gets the content stream for a CMIS object.<p> 428 * 429 * @param context the call context 430 * @param objectId the object id 431 * @param streamId the rendition stream id 432 * @param offset 433 * @param length 434 * 435 * @return the content stream 436 */ 437 ContentStream getContentStream( 438 CmsCmisCallContext context, 439 String objectId, 440 String streamId, 441 BigInteger offset, 442 BigInteger length); 443 444 /** 445 * 446 * @param context the call context 447 * @param folderId the folder id 448 * @param depth the maximum depth 449 * @param filter the property filter 450 * @param includeAllowableActions flag to include allowable actions 451 * @param includePathSegment flag to include path segments 452 * @param foldersOnly flag to ignore documents and only return folders 453 * 454 * @return the list of descendants 455 */ 456 List<ObjectInFolderContainer> getDescendants( 457 CmsCmisCallContext context, 458 String folderId, 459 BigInteger depth, 460 String filter, 461 boolean includeAllowableActions, 462 boolean includePathSegment, 463 boolean foldersOnly); 464 465 /** 466 * Gets the description of the repository.<p> 467 * 468 * @return the repository description 469 */ 470 String getDescription(); 471 472 /** 473 * @see org.opencms.repository.I_CmsRepository#getFilter() 474 */ 475 CmsRepositoryFilter getFilter(); 476 477 /** 478 * Corresponds to CMIS getFolderParent service method.<p> 479 * 480 * @param context the call context 481 * @param folderId the folder id 482 * @param filter the property filter 483 * 484 * @return the parent object data 485 */ 486 ObjectData getFolderParent(CmsCmisCallContext context, String folderId, String filter); 487 488 /** 489 * Gets the repository id.<p> 490 * 491 * @return the repository id 492 */ 493 String getId(); 494 495 /** 496 * Gets the name of the repository.<p> 497 * 498 * @return the name of the repository 499 */ 500 String getName(); 501 502 /** 503 * Gets the data for a CMIS object.<p> 504 * 505 * @param context the CMIS call context 506 * @param objectId the id of the object 507 * @param filter the property filter 508 * @param includeAllowableActions flag to include allowable actions 509 * @param includeRelationships flag to include relationships 510 * @param renditionFilter the rendition filter string 511 * @param includePolicyIds flag to include policy ids 512 * @param includeAcl flag to include ACLs 513 * 514 * @return the CMIS object data 515 */ 516 ObjectData getObject( 517 CmsCmisCallContext context, 518 String objectId, 519 String filter, 520 boolean includeAllowableActions, 521 IncludeRelationships includeRelationships, 522 String renditionFilter, 523 boolean includePolicyIds, 524 boolean includeAcl); 525 526 /** 527 * Reads a CMIS object by path.<p> 528 * 529 * @param context the call context 530 * @param path the repository path 531 * @param filter the property filter string 532 * @param includeAllowableActions flag to include allowable actions 533 * @param includeRelationships flag to include relationships 534 * @param renditionFilter the rendition filter string 535 * @param includePolicyIds flag to include policy ids 536 * @param includeAcl flag to include ACLs 537 * 538 * @return the object data 539 */ 540 ObjectData getObjectByPath( 541 CmsCmisCallContext context, 542 String path, 543 String filter, 544 boolean includeAllowableActions, 545 IncludeRelationships includeRelationships, 546 String renditionFilter, 547 boolean includePolicyIds, 548 boolean includeAcl); 549 550 /** 551 * Gets the object of the latest version.<p> 552 * 553 * @param context the call context 554 * @param objectId the object id 555 * @param versionSeriesId the version series id 556 * @param major flag to get the latest major version 557 * @param filter the property filter 558 * @param includeAllowableActions flag to include allowable actions 559 * @param includeRelationships flag to include relationships 560 * @param renditionFilter filter string for renditions 561 * @param includePolicyIds flag to include policies 562 * @param includeAcl flag to include ACLs 563 * 564 * @return the data for the latest version 565 */ 566 ObjectData getObjectOfLatestVersion( 567 CmsCmisCallContext context, 568 String objectId, 569 String versionSeriesId, 570 boolean major, 571 String filter, 572 boolean includeAllowableActions, 573 IncludeRelationships includeRelationships, 574 String renditionFilter, 575 boolean includePolicyIds, 576 boolean includeAcl); 577 578 /** 579 * Gets the parents of an object.<p> 580 * 581 * @param context the call context 582 * @param objectId the object id 583 * @param filter 584 * @param includeAllowableActions 585 * @param includeRelativePathSegment 586 * 587 * @return the data for the object parents 588 */ 589 List<ObjectParentData> getObjectParents( 590 CmsCmisCallContext context, 591 String objectId, 592 String filter, 593 boolean includeAllowableActions, 594 boolean includeRelativePathSegment); 595 596 /** 597 * Gets the relationships for an object.<p> 598 * 599 * @param context the call context 600 * @param objectId the object id 601 * @param includeSubRelationshipTypes flag to include relationship subtypes 602 * @param relationshipDirection the direction for the relations 603 * @param typeId the relation type id 604 * @param filter the property filter 605 * @param includeAllowableActions flag to include allowable actions 606 * @param maxItems the maximum number of items to return 607 * @param skipCount the number of items to skip 608 * 609 * @return the relationships for the object 610 */ 611 ObjectList getObjectRelationships( 612 CmsCmisCallContext context, 613 String objectId, 614 boolean includeSubRelationshipTypes, 615 RelationshipDirection relationshipDirection, 616 String typeId, 617 String filter, 618 boolean includeAllowableActions, 619 BigInteger maxItems, 620 BigInteger skipCount); 621 622 /** 623 * Gets the properties for a CMIS object.<p> 624 * 625 * @param context the call context 626 * @param objectId the CMIS object id 627 * @param filter the property filter string 628 * 629 * @return the set of properties 630 */ 631 Properties getProperties(CmsCmisCallContext context, String objectId, String filter); 632 633 /** 634 * Gets the properties of the latest version.<p> 635 * 636 * @param context the call context 637 * @param objectId the object id 638 * @param versionSeriesId the version series id 639 * @param major flag to access the latest major version 640 * @param filter the property filter string 641 * 642 * @return the properties from the latest version 643 */ 644 Properties getPropertiesOfLatestVersion( 645 CmsCmisCallContext context, 646 String objectId, 647 String versionSeriesId, 648 boolean major, 649 String filter); 650 651 /** 652 * Gets the renditions for a CMIS object.<p> 653 * 654 * @param context the call context 655 * @param objectId the object id 656 * @param renditionFilter the rendition filter 657 * @param maxItems the maximum number of renditions 658 * @param skipCount the number of renditions to skip 659 * 660 * @return the list of renditions 661 */ 662 List<RenditionData> getRenditions( 663 CmsCmisCallContext context, 664 String objectId, 665 String renditionFilter, 666 BigInteger maxItems, 667 BigInteger skipCount); 668 669 /** 670 * Gets the repository information for this repository.<p> 671 * 672 * @return the repository info 673 */ 674 RepositoryInfo getRepositoryInfo(); 675 676 /** 677 * Gets the children of a given type.<p> 678 * 679 * @param context the call context 680 * @param typeId the parent type id 681 * @param includePropertyDefinitions flag to include property definitions 682 * @param maxItems the maximum number of items to return 683 * @param skipCount the number of items to skip 684 * 685 * @return the list of child type definitions 686 */ 687 TypeDefinitionList getTypeChildren( 688 CmsCmisCallContext context, 689 String typeId, 690 boolean includePropertyDefinitions, 691 BigInteger maxItems, 692 BigInteger skipCount); 693 694 /** 695 * Gets a type definition by id.<p> 696 * 697 * @param context the call context 698 * @param typeId the type id 699 * 700 * @return the type definition for the given id 701 */ 702 TypeDefinition getTypeDefinition(CmsCmisCallContext context, String typeId); 703 704 /** 705 * Gets the type descendants.<p> 706 * 707 * @param context the call context 708 * @param typeId the parent type id 709 * @param depth the maximum type depth 710 * @param includePropertyDefinitions flag to include the property definitions for types 711 * 712 * @return the list of type definitions 713 */ 714 List<TypeDefinitionContainer> getTypeDescendants( 715 CmsCmisCallContext context, 716 String typeId, 717 BigInteger depth, 718 boolean includePropertyDefinitions); 719 720 /** 721 * Moves an object.<p> 722 * 723 * @param context the call context 724 * @param objectId the object id 725 * @param targetFolderId source source folder id 726 * @param sourceFolderId the target folder id 727 */ 728 void moveObject(CmsCmisCallContext context, Holder<String> objectId, String targetFolderId, String sourceFolderId); 729 730 /** 731 * Performs a query on the repository.<p> 732 * 733 * @param context the call context 734 * @param statement the query 735 * @param searchAllVersions flag to search all versions 736 * @param includeAllowableActions flag to include allowable actions 737 * @param includeRelationships flag to include relationships 738 * @param renditionFilter the filter string for renditions 739 * @param maxItems the maximum number of items to return 740 * @param skipCount the number of items to skip 741 * 742 * @return the query result objects 743 */ 744 ObjectList query( 745 CmsCmisCallContext context, 746 String statement, 747 boolean searchAllVersions, 748 boolean includeAllowableActions, 749 IncludeRelationships includeRelationships, 750 String renditionFilter, 751 BigInteger maxItems, 752 BigInteger skipCount); 753 754 /** 755 * Unfiles an object from a folder.<p> 756 * 757 * @param context the call context 758 * @param objectId the id of the object to unfile 759 * @param folderId the folder from which the object should be unfiled 760 */ 761 void removeObjectFromFolder(CmsCmisCallContext context, String objectId, String folderId); 762 763 /** 764 * Removes a policy from an object.<p> 765 * 766 * @param context the call context 767 * @param policyId the policy id 768 * @param objectId the object id 769 */ 770 void removePolicy(CmsCmisCallContext context, String policyId, String objectId); 771 772 /** 773 * Sets the content stream of an object.<p> 774 * 775 * @param context the call context 776 * @param objectId the id of the object 777 * @param overwriteFlag flag to overwrite the content stream 778 * @param changeToken the change token 779 * @param contentStream the new content stream 780 */ 781 void setContentStream( 782 CmsCmisCallContext context, 783 Holder<String> objectId, 784 boolean overwriteFlag, 785 Holder<String> changeToken, 786 ContentStream contentStream); 787 788 /** 789 * Updates the properties for an object.<p> 790 * 791 * @param context the call context 792 * @param objectId the object id 793 * @param changeToken the change token 794 * @param properties the properties 795 */ 796 void updateProperties( 797 CmsCmisCallContext context, 798 Holder<String> objectId, 799 Holder<String> changeToken, 800 Properties properties); 801 802}