Class CmisRepository
- java.lang.Object
-
- org.ametys.plugins.workspaces.cmis.CmisRepository
-
public class CmisRepository extends Object
Helper class to retreive CMIS objects
-
-
Field Summary
Fields Modifier and Type Field Description private static String
USER_UNKNOWN
-
Constructor Summary
Constructors Constructor Description CmisRepository()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addAction(Set<Action> aas, Action action, boolean condition)
private void
addPropertyBigInteger(org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertiesImpl props, String typeId, Set<String> filter, String id, BigInteger value, CmisServiceFactory factory)
private void
addPropertyBoolean(org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertiesImpl props, String typeId, Set<String> filter, String id, boolean value, CmisServiceFactory factory)
private void
addPropertyDateTime(org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertiesImpl props, String typeId, Set<String> filter, String id, GregorianCalendar value, CmisServiceFactory factory)
private void
addPropertyId(org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertiesImpl props, String typeId, Set<String> filter, String id, String value, CmisServiceFactory factory)
private void
addPropertyIdList(org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertiesImpl props, String typeId, Set<String> filter, String id, List<String> value, CmisServiceFactory factory)
private void
addPropertyInteger(org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertiesImpl props, String typeId, Set<String> filter, String id, long value, CmisServiceFactory factory)
private void
addPropertyString(org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertiesImpl props, String typeId, Set<String> filter, String id, String value, CmisServiceFactory factory)
void
changeContentStream(CallContext context, Project project, Holder<String> objectIdHolder, Boolean overwriteFlag, ContentStream contentStream, boolean append, CmisServiceFactory factory)
CMIS setContentStream, deleteContentStream, and appendContentStream.private boolean
checkAddProperty(Properties properties, String typeId, Set<String> filter, String id, CmisServiceFactory factory)
private void
checkNewProperties(Properties properties, BaseTypeId baseTypeId, CmisServiceFactory factory)
private void
checkTypeProperties(Properties properties, String typeId, CmisServiceFactory factory, boolean isCreate)
private AllowableActions
compileAllowableActions(AmetysObject file, Project project, CmisServiceFactory factory, boolean userReadOnly)
private ObjectData
compileObjectData(CallContext context, AmetysObject ametysObject, Project project, Set<String> filter, boolean includeAllowableActions, boolean includeAcl, boolean userReadOnly, ObjectInfoHandler objectInfos, CmisServiceFactory factory)
private Properties
compileProperties(CallContext context, AmetysObject ametysObject, Project project, Set<String> orgfilter, ObjectInfoImpl objectInfo, CmisServiceFactory factory)
String
createDocument(CallContext context, Properties properties, Project project, String folderId, ContentStream contentStream, VersioningState versioningState, CmisServiceFactory factory)
Create a new document in a folderString
createFolder(CallContext context, Properties properties, Project project, String folderId, CmisServiceFactory factory)
Create a new folder in another oneprivate RepositoryInfo
createRepositoryInfo(Project project, CmisServiceFactory factory, CmisVersion cmisVersion)
void
deleteObject(CallContext context, String objectId, CmisServiceFactory factory)
CMIS deleteObject.FailedToDeleteData
deleteTree(CallContext context, Project project, String folderId, CmisServiceFactory factory)
CMIS deleteTree.ObjectInFolderList
getChildren(CallContext context, String folderId, Project project, String filter, Boolean includeAllowableActions, Boolean includePathSegment, BigInteger maxItems, BigInteger skipCount, ObjectInfoHandler objectInfos, CmisServiceFactory factory)
get children of a folderContentStream
getContentStream(CallContext context, String objectId, BigInteger offset, BigInteger length, CmisServiceFactory factory)
get the inputstream to read a fileObjectData
getFolderParent(CallContext context, Project project, String folderId, String filter, ObjectInfoHandler objectInfos, CmisServiceFactory factory)
CMIS getFolderParent.ObjectData
getObject(CallContext context, Project project, String objectId, String versionServicesId, String filter, Boolean includeAllowableActions, Boolean includeAcl, ObjectInfoHandler objectInfos, CmisServiceFactory factory)
getObjectObjectData
getObjectByPath(CallContext context, Project project, String folderPath, String filter, boolean includeAllowableActions, boolean includeACL, ObjectInfoHandler objectInfos, CmisServiceFactory factory)
get an object by it's pathList<ObjectParentData>
getObjectParents(CallContext context, String objectId, Project project, String filter, Boolean includeAllowableActions, Boolean includeRelativePathSegment, ObjectInfoHandler objectInfos, CmisServiceFactory factory)
get the parents of an objectRepositoryInfo
getRepositoryInfo(CallContext context, Project project, CmisServiceFactory factory)
retreive informations for a repositoryprivate ModifiableResourceCollection
getRoot(Project project, CmisServiceFactory factory)
TypeDefinitionList
getTypeChildren(CallContext context, String typeId, Boolean includePropertyDefinitions, BigInteger maxItems, BigInteger skipCount, CmisServiceFactory factory)
getTypeChildrenTypeDefinition
getTypeDefinition(CallContext context, String typeId, CmisServiceFactory factory)
getTypeDefinitionprivate Boolean
isRoot(ModifiableResourceCollection object, Project project, DocumentWorkspaceModule documentModule)
private Boolean
isRoot(AmetysObject ametysObject, Project project, CmisServiceFactory factory)
ObjectData
moveObject(CallContext context, Project project, Holder<String> objectId, String targetFolderId, ObjectInfoHandler objectInfos, CmisServiceFactory factory)
CMIS moveObject.ObjectData
updateProperties(CallContext context, Project project, Holder<String> objectIdHolder, Properties properties, ObjectInfoHandler objectInfos, CmisServiceFactory factory)
CMIS updateProperties.
-
-
-
Field Detail
-
USER_UNKNOWN
private static final String USER_UNKNOWN
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CmisRepository
public CmisRepository()
-
-
Method Detail
-
getRepositoryInfo
public RepositoryInfo getRepositoryInfo(CallContext context, Project project, CmisServiceFactory factory)
retreive informations for a repository- Parameters:
context
- call contextproject
- projectfactory
- factory- Returns:
- RepositoryInfo
-
createRepositoryInfo
private RepositoryInfo createRepositoryInfo(Project project, CmisServiceFactory factory, CmisVersion cmisVersion)
-
getTypeDefinition
public TypeDefinition getTypeDefinition(CallContext context, String typeId, CmisServiceFactory factory)
getTypeDefinition- Parameters:
context
- call contexttypeId
- type IDfactory
- factory- Returns:
- the type definition
-
getTypeChildren
public TypeDefinitionList getTypeChildren(CallContext context, String typeId, Boolean includePropertyDefinitions, BigInteger maxItems, BigInteger skipCount, CmisServiceFactory factory)
getTypeChildren- Parameters:
context
- contexttypeId
- typeIdincludePropertyDefinitions
- includePropertyDefinitionsmaxItems
- maxItemsskipCount
- skipCountfactory
- factory- Returns:
- the type definition list
-
getObject
public ObjectData getObject(CallContext context, Project project, String objectId, String versionServicesId, String filter, Boolean includeAllowableActions, Boolean includeAcl, ObjectInfoHandler objectInfos, CmisServiceFactory factory)
getObject- Parameters:
context
- contextproject
- ProjectobjectId
- objectIdversionServicesId
- versionServicesIdfilter
- filterincludeAllowableActions
- includeAllowableActionsincludeAcl
- includeAclobjectInfos
- objectInfosfactory
- factory- Returns:
- ObjectData ObjectData
-
compileObjectData
private ObjectData compileObjectData(CallContext context, AmetysObject ametysObject, Project project, Set<String> filter, boolean includeAllowableActions, boolean includeAcl, boolean userReadOnly, ObjectInfoHandler objectInfos, CmisServiceFactory factory)
-
compileProperties
private Properties compileProperties(CallContext context, AmetysObject ametysObject, Project project, Set<String> orgfilter, ObjectInfoImpl objectInfo, CmisServiceFactory factory)
-
getChildren
public ObjectInFolderList getChildren(CallContext context, String folderId, Project project, String filter, Boolean includeAllowableActions, Boolean includePathSegment, BigInteger maxItems, BigInteger skipCount, ObjectInfoHandler objectInfos, CmisServiceFactory factory)
get children of a folder- Parameters:
context
- call contextfolderId
- folder Idproject
- Projectfilter
- filtersincludeAllowableActions
- allowable actionsincludePathSegment
- include path segmentmaxItems
- max itemsskipCount
- skip countobjectInfos
- object infosfactory
- factory- Returns:
- ObjectInFolderList
-
getObjectParents
public List<ObjectParentData> getObjectParents(CallContext context, String objectId, Project project, String filter, Boolean includeAllowableActions, Boolean includeRelativePathSegment, ObjectInfoHandler objectInfos, CmisServiceFactory factory)
get the parents of an object- Parameters:
context
- call contextobjectId
- Object Idproject
- Projectfilter
- filtersincludeAllowableActions
- allowable actionsincludeRelativePathSegment
- relative path segmentobjectInfos
- object infosfactory
- factory- Returns:
- List of ObjectParentData
-
getContentStream
public ContentStream getContentStream(CallContext context, String objectId, BigInteger offset, BigInteger length, CmisServiceFactory factory)
get the inputstream to read a file- Parameters:
context
- call contextobjectId
- object Idoffset
- offsetlength
- lenghtfactory
- factory- Returns:
- ContentStream
-
getObjectByPath
public ObjectData getObjectByPath(CallContext context, Project project, String folderPath, String filter, boolean includeAllowableActions, boolean includeACL, ObjectInfoHandler objectInfos, CmisServiceFactory factory)
get an object by it's path- Parameters:
context
- call contextproject
- ProjectfolderPath
- path of the object/folderfilter
- filters for metadataincludeAllowableActions
- allowable actionsincludeACL
- ACLobjectInfos
- infosfactory
- factory- Returns:
- datas of the object
-
createFolder
public String createFolder(CallContext context, Properties properties, Project project, String folderId, CmisServiceFactory factory)
Create a new folder in another one- Parameters:
context
- call contextproperties
- propertiesproject
- ProjectfolderId
- folder Idfactory
- factory- Returns:
- id of the created folder
-
createDocument
public String createDocument(CallContext context, Properties properties, Project project, String folderId, ContentStream contentStream, VersioningState versioningState, CmisServiceFactory factory)
Create a new document in a folder- Parameters:
context
- call contextproperties
- propertiesproject
- ProjectfolderId
- folder IdcontentStream
- content StreamversioningState
- versionning Statefactory
- factory- Returns:
- id of the created document
-
deleteObject
public void deleteObject(CallContext context, String objectId, CmisServiceFactory factory)
CMIS deleteObject.- Parameters:
context
- call contextobjectId
- object IDfactory
- factory
-
getFolderParent
public ObjectData getFolderParent(CallContext context, Project project, String folderId, String filter, ObjectInfoHandler objectInfos, CmisServiceFactory factory)
CMIS getFolderParent.- Parameters:
context
- call contextproject
- ProjectfolderId
- folder Idfilter
- filtersobjectInfos
- objectInfosfactory
- factory- Returns:
- ObjectData
-
deleteTree
public FailedToDeleteData deleteTree(CallContext context, Project project, String folderId, CmisServiceFactory factory)
CMIS deleteTree.- Parameters:
context
- call contextproject
- ProjectfolderId
- folder Idfactory
- factory- Returns:
- FailedToDeleteData
-
updateProperties
public ObjectData updateProperties(CallContext context, Project project, Holder<String> objectIdHolder, Properties properties, ObjectInfoHandler objectInfos, CmisServiceFactory factory)
CMIS updateProperties.- Parameters:
context
- call contextproject
- ProjectobjectIdHolder
- objectId in a holderproperties
- propertiesobjectInfos
- object infosfactory
- factory- Returns:
- ObjectData
-
changeContentStream
public void changeContentStream(CallContext context, Project project, Holder<String> objectIdHolder, Boolean overwriteFlag, ContentStream contentStream, boolean append, CmisServiceFactory factory)
CMIS setContentStream, deleteContentStream, and appendContentStream.- Parameters:
context
- call contextproject
- ProjectobjectIdHolder
- object Id in a holderoverwriteFlag
- overwritecontentStream
- inputStreamappend
- appendfactory
- factory
-
moveObject
public ObjectData moveObject(CallContext context, Project project, Holder<String> objectId, String targetFolderId, ObjectInfoHandler objectInfos, CmisServiceFactory factory)
CMIS moveObject.- Parameters:
context
- call contextproject
- ProjectobjectId
- objectId in a holdertargetFolderId
- folderIdobjectInfos
- objectInfosfactory
- factory- Returns:
- ObjectData
-
checkNewProperties
private void checkNewProperties(Properties properties, BaseTypeId baseTypeId, CmisServiceFactory factory)
-
checkTypeProperties
private void checkTypeProperties(Properties properties, String typeId, CmisServiceFactory factory, boolean isCreate)
-
addPropertyId
private void addPropertyId(org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertiesImpl props, String typeId, Set<String> filter, String id, String value, CmisServiceFactory factory)
-
addPropertyIdList
private void addPropertyIdList(org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertiesImpl props, String typeId, Set<String> filter, String id, List<String> value, CmisServiceFactory factory)
-
addPropertyString
private void addPropertyString(org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertiesImpl props, String typeId, Set<String> filter, String id, String value, CmisServiceFactory factory)
-
addPropertyInteger
private void addPropertyInteger(org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertiesImpl props, String typeId, Set<String> filter, String id, long value, CmisServiceFactory factory)
-
addPropertyBigInteger
private void addPropertyBigInteger(org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertiesImpl props, String typeId, Set<String> filter, String id, BigInteger value, CmisServiceFactory factory)
-
addPropertyBoolean
private void addPropertyBoolean(org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertiesImpl props, String typeId, Set<String> filter, String id, boolean value, CmisServiceFactory factory)
-
addPropertyDateTime
private void addPropertyDateTime(org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertiesImpl props, String typeId, Set<String> filter, String id, GregorianCalendar value, CmisServiceFactory factory)
-
checkAddProperty
private boolean checkAddProperty(Properties properties, String typeId, Set<String> filter, String id, CmisServiceFactory factory)
-
compileAllowableActions
private AllowableActions compileAllowableActions(AmetysObject file, Project project, CmisServiceFactory factory, boolean userReadOnly)
-
isRoot
private Boolean isRoot(ModifiableResourceCollection object, Project project, DocumentWorkspaceModule documentModule)
-
isRoot
private Boolean isRoot(AmetysObject ametysObject, Project project, CmisServiceFactory factory)
-
getRoot
private ModifiableResourceCollection getRoot(Project project, CmisServiceFactory factory)
-
-