Package org.alfresco.cmis.dsl
Class CmisUtil
java.lang.Object
org.alfresco.cmis.dsl.CmisUtil
DSL utility for managing CMIS objects
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcopyChildrenFromFolder(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 folderorg.apache.chemistry.opencmis.client.api.CmisObjectcopyFolder(org.apache.chemistry.opencmis.client.api.Folder sourceFolder, org.apache.chemistry.opencmis.client.api.Folder targetFolder) Copy folder with all childrenList<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>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.AclgetAcls()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 folderorg.apache.chemistry.opencmis.client.api.DocumentgetCmisDocument(String path) Get Document object for a fileorg.apache.chemistry.opencmis.client.api.FoldergetCmisFolder(String path) Get Folder object for a folderorg.apache.chemistry.opencmis.client.api.CmisObjectgetCmisObject(String pathToItem) Get cmis object by pathorg.apache.chemistry.opencmis.client.api.CmisObjectgetCmisObject(String pathToItem, org.apache.chemistry.opencmis.client.api.OperationContext context) Get cmis object by path with contextorg.apache.chemistry.opencmis.client.api.CmisObjectgetCmisObjectById(String objectId) Get cmis object by object idorg.apache.chemistry.opencmis.client.api.CmisObjectgetCmisObjectById(String objectId, org.apache.chemistry.opencmis.client.api.OperationContext context) Get cmis object by object id with OperationContextList<org.apache.chemistry.opencmis.client.api.CmisObject>getCmisObjectsFromContentModels(org.alfresco.utility.model.ContentModel... contentModels) Returns a list of Cmis objects for the provided Content Modelsprotected StringgetContentAsString(org.apache.chemistry.opencmis.commons.data.ContentStream stream) Helper method to get the contents of a streamorg.apache.chemistry.opencmis.commons.data.ContentStreamgetContentStream(String content) List<org.alfresco.utility.model.FileModel>getFiles()Get children documents from a parent folderList<org.apache.chemistry.opencmis.client.api.CmisObject>getFolderDescendants(int depth) Gets the folder descendants starting with the current folderprotected org.apache.chemistry.opencmis.client.api.FolderList<org.alfresco.utility.model.FolderModel>Get children folders from a parent folderList<org.apache.chemistry.opencmis.client.api.CmisObject>getFolderTree(int depth) Gets only the folder descendants for the#getLastResource()foldergetObjectId(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.DocumentReturns the PWC (private working copy) ID of the document version seriesorg.alfresco.utility.model.FileModelprotected 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.ObjectTypeList<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 noderefprotected booleanisCmisObjectContainedInCmisCheckedOutDocumentsList(org.apache.chemistry.opencmis.client.api.CmisObject cmisObject, List<org.apache.chemistry.opencmis.client.api.Document> cmisCheckedOutDocuments) protected booleanisContentInList(org.alfresco.utility.model.ContentModel contentModel, List<org.alfresco.utility.model.ContentModel> contents) protected booleanisFileInList(org.alfresco.utility.model.FileModel fileModel, List<org.alfresco.utility.model.FileModel> files) protected booleanisFolderInList(org.alfresco.utility.model.FolderModel folderModel, List<org.alfresco.utility.model.FolderModel> folders) protected booleanorg.apache.chemistry.opencmis.client.api.OperationContextvoidupdateProperties(String propertyName, Object propertyValue) Update property for last resource cmis object
-
Constructor Details
-
CmisUtil
-
-
Method Details
-
getCmisObjectById
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 idcontext- OperationContext- Returns:
- CmisObject cmis object
-
getCmisObject
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 itemcontext- OperationContext- Returns:
- CmisObject cmis object
-
getCmisDocument
Get Document object for a file- Parameters:
path- String path to document- Returns:
Documentobject
-
getCmisFolder
Get Folder object for a folder- Parameters:
path- String path to folder- Returns:
Folderobject
-
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 foldertargetFolder- 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
- Returns:
- List
of allowable actions for the current object
-
getProperty
Returns the requested property. If the property is not available, null is returned- Parameters:
propertyId-- Returns:
- CMIS Property
-
getRenditions
-
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
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
-
getAcls
public org.apache.chemistry.opencmis.commons.data.Acl getAcls() -
getFolderTree
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
-
getAllDocumentVersionsBy
public List<org.apache.chemistry.opencmis.client.api.Document> getAllDocumentVersionsBy(org.apache.chemistry.opencmis.client.api.OperationContext context) -
getCheckedOutDocumentsFromSession
-
getCheckedOutDocumentsFromSession
public List<org.apache.chemistry.opencmis.client.api.Document> getCheckedOutDocumentsFromSession(org.apache.chemistry.opencmis.client.api.OperationContext context) -
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
-
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
-
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
-
getObjectId
-
updateProperties
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
Get children folders from a parent folder- Returns:
- List
-
getFiles
Get children documents from a parent folder- Returns:
- List
-
getDocumentContent
-
getUserNodeRef
Get user noderef- Parameters:
user-UserModel
-