Class CmisUtil

java.lang.Object
org.alfresco.cmis.dsl.CmisUtil

public class CmisUtil extends Object
DSL utility for managing CMIS objects
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    copyChildrenFromFolder(org.apache.chemistry.opencmis.client.api.Folder sourceFolder, org.apache.chemistry.opencmis.client.api.Folder targetFolder)
    Copy all the children of the source folder to the target folder
    org.apache.chemistry.opencmis.client.api.CmisObject
    copyFolder(org.apache.chemistry.opencmis.client.api.Folder sourceFolder, org.apache.chemistry.opencmis.client.api.Folder targetFolder)
    Copy folder with all children
    List<org.apache.chemistry.opencmis.commons.data.Ace>
    createAce(org.alfresco.utility.model.GroupModel group, org.alfresco.utility.constants.UserRole role)
     
    List<org.apache.chemistry.opencmis.commons.data.Ace>
    createAce(org.alfresco.utility.model.UserModel user, String... permissions)
     
    List<org.apache.chemistry.opencmis.commons.data.Ace>
    createAce(org.alfresco.utility.model.UserModel user, org.alfresco.utility.constants.UserRole role)
     
    org.apache.chemistry.opencmis.commons.data.Acl
     
    protected List<org.apache.chemistry.opencmis.client.api.Document>
     
    List<org.apache.chemistry.opencmis.client.api.Document>
    getAllDocumentVersionsBy(org.apache.chemistry.opencmis.client.api.OperationContext context)
     
    protected List<org.apache.chemistry.opencmis.commons.enums.Action>
     
    List<org.apache.chemistry.opencmis.client.api.Document>
     
    List<org.apache.chemistry.opencmis.client.api.Document>
    getCheckedOutDocumentsFromFolder(org.apache.chemistry.opencmis.client.api.OperationContext context)
     
    List<org.apache.chemistry.opencmis.client.api.Document>
     
    List<org.apache.chemistry.opencmis.client.api.Document>
    getCheckedOutDocumentsFromSession(org.apache.chemistry.opencmis.client.api.OperationContext context)
     
    Map<org.alfresco.utility.model.ContentModel,org.apache.chemistry.opencmis.client.api.ObjectType>
    Get the children from a parent folder
    org.apache.chemistry.opencmis.client.api.Document
    Get Document object for a file
    org.apache.chemistry.opencmis.client.api.Folder
    Get Folder object for a folder
    org.apache.chemistry.opencmis.client.api.CmisObject
    getCmisObject(String pathToItem)
    Get cmis object by path
    org.apache.chemistry.opencmis.client.api.CmisObject
    getCmisObject(String pathToItem, org.apache.chemistry.opencmis.client.api.OperationContext context)
    Get cmis object by path with context
    org.apache.chemistry.opencmis.client.api.CmisObject
    Get cmis object by object id
    org.apache.chemistry.opencmis.client.api.CmisObject
    getCmisObjectById(String objectId, org.apache.chemistry.opencmis.client.api.OperationContext context)
    Get cmis object by object id with OperationContext
    List<org.apache.chemistry.opencmis.client.api.CmisObject>
    getCmisObjectsFromContentModels(org.alfresco.utility.model.ContentModel... contentModels)
    Returns a list of Cmis objects for the provided Content Models
    protected String
    getContentAsString(org.apache.chemistry.opencmis.commons.data.ContentStream stream)
    Helper method to get the contents of a stream
    org.apache.chemistry.opencmis.commons.data.ContentStream
     
     
    List<org.alfresco.utility.model.FileModel>
    Get children documents from a parent folder
    List<org.apache.chemistry.opencmis.client.api.CmisObject>
    Gets the folder descendants starting with the current folder
    protected org.apache.chemistry.opencmis.client.api.Folder
     
    List<org.alfresco.utility.model.FolderModel>
    Get children folders from a parent folder
    List<org.apache.chemistry.opencmis.client.api.CmisObject>
    getFolderTree(int depth)
    Gets only the folder descendants for the #getLastResource() folder
    getObjectId(String pathToObject)
     
    getProperties(org.alfresco.utility.model.ContentModel contentModel, String baseTypeId)
     
    protected <T> org.apache.chemistry.opencmis.client.api.Property<T>
    getProperty(String propertyId)
    Returns the requested property.
    org.apache.chemistry.opencmis.client.api.Document
    Returns the PWC (private working copy) ID of the document version series
    org.alfresco.utility.model.FileModel
     
    protected List<org.apache.chemistry.opencmis.client.api.Rendition>
     
    protected List<org.apache.chemistry.opencmis.client.api.SecondaryType>
     
    org.apache.chemistry.opencmis.client.api.ItemIterable<org.apache.chemistry.opencmis.client.api.ObjectType>
    getTypeChildren(String baseType, boolean includePropertyDefinitions)
     
    org.apache.chemistry.opencmis.client.api.ObjectType
     
    List<org.apache.chemistry.opencmis.client.api.Tree<org.apache.chemistry.opencmis.client.api.ObjectType>>
    getTypeDescendants(String baseTypeId, int depth, boolean includePropertyDefinitions)
     
    getUserNodeRef(org.alfresco.utility.model.UserModel user)
    Get user noderef
    protected boolean
    isCmisObjectContainedInCmisCheckedOutDocumentsList(org.apache.chemistry.opencmis.client.api.CmisObject cmisObject, List<org.apache.chemistry.opencmis.client.api.Document> cmisCheckedOutDocuments)
     
    protected boolean
    isContentInList(org.alfresco.utility.model.ContentModel contentModel, List<org.alfresco.utility.model.ContentModel> contents)
     
    protected boolean
    isFileInList(org.alfresco.utility.model.FileModel fileModel, List<org.alfresco.utility.model.FileModel> files)
     
    protected boolean
    isFolderInList(org.alfresco.utility.model.FolderModel folderModel, List<org.alfresco.utility.model.FolderModel> folders)
     
    protected boolean
     
    org.apache.chemistry.opencmis.client.api.OperationContext
     
    void
    updateProperties(String propertyName, Object propertyValue)
    Update property for last resource cmis object

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • getCmisObjectById

      public org.apache.chemistry.opencmis.client.api.CmisObject getCmisObjectById(String objectId)
      Get cmis object by object id
      Parameters:
      objectId - cmis object id
      Returns:
      CmisObject cmis object
    • getCmisObjectById

      public org.apache.chemistry.opencmis.client.api.CmisObject getCmisObjectById(String objectId, org.apache.chemistry.opencmis.client.api.OperationContext context)
      Get cmis object by object id with OperationContext
      Parameters:
      objectId - cmis object id
      context - OperationContext
      Returns:
      CmisObject cmis object
    • getCmisObject

      public org.apache.chemistry.opencmis.client.api.CmisObject getCmisObject(String pathToItem)
      Get cmis object by path
      Parameters:
      pathToItem - String path to item
      Returns:
      CmisObject cmis object
    • getCmisObject

      public org.apache.chemistry.opencmis.client.api.CmisObject getCmisObject(String pathToItem, org.apache.chemistry.opencmis.client.api.OperationContext context)
      Get cmis object by path with context
      Parameters:
      pathToItem - String path to item
      context - OperationContext
      Returns:
      CmisObject cmis object
    • getCmisDocument

      public org.apache.chemistry.opencmis.client.api.Document getCmisDocument(String path)
      Get Document object for a file
      Parameters:
      path - String path to document
      Returns:
      Document object
    • getCmisFolder

      public org.apache.chemistry.opencmis.client.api.Folder getCmisFolder(String path)
      Get Folder object for a folder
      Parameters:
      path - String path to folder
      Returns:
      Folder object
    • getContentAsString

      protected String getContentAsString(org.apache.chemistry.opencmis.commons.data.ContentStream stream)
      Helper method to get the contents of a stream
      Parameters:
      stream -
      Returns:
      Throws:
      org.alfresco.utility.exception.IORuntimeException
    • copyChildrenFromFolder

      protected void copyChildrenFromFolder(org.apache.chemistry.opencmis.client.api.Folder sourceFolder, org.apache.chemistry.opencmis.client.api.Folder targetFolder)
      Copy all the children of the source folder to the target folder
      Parameters:
      sourceFolder -
      targetFolder -
    • copyFolder

      public org.apache.chemistry.opencmis.client.api.CmisObject copyFolder(org.apache.chemistry.opencmis.client.api.Folder sourceFolder, org.apache.chemistry.opencmis.client.api.Folder targetFolder)
      Copy folder with all children
      Parameters:
      sourceFolder - source folder
      targetFolder - target folder
      Returns:
      CmisObject of new created folder
    • isPrivateWorkingCopy

      protected boolean isPrivateWorkingCopy()
    • getPWCDocument

      public org.apache.chemistry.opencmis.client.api.Document getPWCDocument()
      Returns the PWC (private working copy) ID of the document version series
    • getPWCFileModel

      public org.alfresco.utility.model.FileModel getPWCFileModel()
    • getFolderParent

      protected org.apache.chemistry.opencmis.client.api.Folder getFolderParent()
    • getAllowableActions

      protected List<org.apache.chemistry.opencmis.commons.enums.Action> getAllowableActions()
      Returns:
      List of allowable actions for the current object
    • getProperty

      protected <T> org.apache.chemistry.opencmis.client.api.Property<T> getProperty(String propertyId)
      Returns the requested property. If the property is not available, null is returned
      Parameters:
      propertyId -
      Returns:
      CMIS Property
    • getRenditions

      protected List<org.apache.chemistry.opencmis.client.api.Rendition> getRenditions()
    • getSecondaryTypes

      protected List<org.apache.chemistry.opencmis.client.api.SecondaryType> getSecondaryTypes()
    • getChildren

      public Map<org.alfresco.utility.model.ContentModel,org.apache.chemistry.opencmis.client.api.ObjectType> getChildren()
      Get the children from a parent folder
      Returns:
      Map<ContentModel, ObjectType>
    • getFolderDescendants

      public List<org.apache.chemistry.opencmis.client.api.CmisObject> getFolderDescendants(int depth)
      Gets the folder descendants starting with the current folder
      Parameters:
      depth - level of the tree that you want to go to - currentFolder -- file1.txt -- file2.txt -- folderB --- file3.txt --- file4.txt e.g. A depth of 1 will give you just the current folder descendants (file1.txt, file2.txt, folder1) e.g. A depth of -1 will return all the descendants (file1.txt, file2.txt, folder1, file3.txt and file4.txt)
    • getCmisObjectsFromContentModels

      public List<org.apache.chemistry.opencmis.client.api.CmisObject> getCmisObjectsFromContentModels(org.alfresco.utility.model.ContentModel... contentModels)
      Returns a list of Cmis objects for the provided Content Models
      Parameters:
      contentModels -
    • getContentStream

      public org.apache.chemistry.opencmis.commons.data.ContentStream getContentStream(String content)
    • getAcls

      public org.apache.chemistry.opencmis.commons.data.Acl getAcls()
    • getFolderTree

      public List<org.apache.chemistry.opencmis.client.api.CmisObject> getFolderTree(int depth)
      Gets only the folder descendants for the #getLastResource() folder
      Parameters:
      depth - level of the tree that you want to go to - currentFolder -- folderB -- folderC --- folderD e.g. A depth of 1 will give you just the current folder descendants (folderB, folderC) e.g. A depth of -1 will return all the descendants (folderB, folderC, folderD)
    • getAllDocumentVersions

      protected List<org.apache.chemistry.opencmis.client.api.Document> getAllDocumentVersions()
    • getAllDocumentVersionsBy

      public List<org.apache.chemistry.opencmis.client.api.Document> getAllDocumentVersionsBy(org.apache.chemistry.opencmis.client.api.OperationContext context)
    • getCheckedOutDocumentsFromSession

      public List<org.apache.chemistry.opencmis.client.api.Document> getCheckedOutDocumentsFromSession()
    • getCheckedOutDocumentsFromSession

      public List<org.apache.chemistry.opencmis.client.api.Document> getCheckedOutDocumentsFromSession(org.apache.chemistry.opencmis.client.api.OperationContext context)
    • getCheckedOutDocumentsFromFolder

      public List<org.apache.chemistry.opencmis.client.api.Document> getCheckedOutDocumentsFromFolder()
    • getCheckedOutDocumentsFromFolder

      public List<org.apache.chemistry.opencmis.client.api.Document> getCheckedOutDocumentsFromFolder(org.apache.chemistry.opencmis.client.api.OperationContext context)
    • isCmisObjectContainedInCmisCheckedOutDocumentsList

      protected boolean isCmisObjectContainedInCmisCheckedOutDocumentsList(org.apache.chemistry.opencmis.client.api.CmisObject cmisObject, List<org.apache.chemistry.opencmis.client.api.Document> cmisCheckedOutDocuments)
    • getProperties

      public Map<String,Object> getProperties(org.alfresco.utility.model.ContentModel contentModel, String baseTypeId)
    • setIncludeAclContext

      public org.apache.chemistry.opencmis.client.api.OperationContext setIncludeAclContext()
    • createAce

      public List<org.apache.chemistry.opencmis.commons.data.Ace> createAce(org.alfresco.utility.model.UserModel user, org.alfresco.utility.constants.UserRole role)
    • createAce

      public List<org.apache.chemistry.opencmis.commons.data.Ace> createAce(org.alfresco.utility.model.GroupModel group, org.alfresco.utility.constants.UserRole role)
    • createAce

      public List<org.apache.chemistry.opencmis.commons.data.Ace> createAce(org.alfresco.utility.model.UserModel user, String... permissions)
    • getTypeDefinition

      public org.apache.chemistry.opencmis.client.api.ObjectType getTypeDefinition()
    • getTypeChildren

      public org.apache.chemistry.opencmis.client.api.ItemIterable<org.apache.chemistry.opencmis.client.api.ObjectType> getTypeChildren(String baseType, boolean includePropertyDefinitions)
    • getTypeDescendants

      public List<org.apache.chemistry.opencmis.client.api.Tree<org.apache.chemistry.opencmis.client.api.ObjectType>> getTypeDescendants(String baseTypeId, int depth, boolean includePropertyDefinitions)
    • getObjectId

      public String getObjectId(String pathToObject)
    • updateProperties

      public void updateProperties(String propertyName, Object propertyValue)
      Update property for last resource cmis object
      Parameters:
      propertyName - String property name (e.g. cmis:name)
      propertyValue - Object property value
    • isFolderInList

      protected boolean isFolderInList(org.alfresco.utility.model.FolderModel folderModel, List<org.alfresco.utility.model.FolderModel> folders)
    • isFileInList

      protected boolean isFileInList(org.alfresco.utility.model.FileModel fileModel, List<org.alfresco.utility.model.FileModel> files)
    • isContentInList

      protected boolean isContentInList(org.alfresco.utility.model.ContentModel contentModel, List<org.alfresco.utility.model.ContentModel> contents)
    • getFolders

      public List<org.alfresco.utility.model.FolderModel> getFolders()
      Get children folders from a parent folder
      Returns:
      List
    • getFiles

      public List<org.alfresco.utility.model.FileModel> getFiles()
      Get children documents from a parent folder
      Returns:
      List
    • getDocumentContent

      public String getDocumentContent()
    • getUserNodeRef

      public String getUserNodeRef(org.alfresco.utility.model.UserModel user)
      Get user noderef
      Parameters:
      user - UserModel