Package org.opencms.cmis
Class CmsCmisRelationHelper
java.lang.Object
org.opencms.cmis.CmsCmisRelationHelper
- All Implemented Interfaces:
I_CmsCmisObjectHelper
Helper class for CMIS CRUD operations on relation objects.
Since CMIS requires any object to have an ID by which it is accessed, but OpenCms relations are not addressable by ids, we invent an artificial relation id string of the form REL_(SOURCE_ID)_(TARGET_ID)_(TYPE).
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
A class which contains the necessary information to identify a relation object. -
Field Summary
-
Constructor Summary
ConstructorDescriptionCmsCmisRelationHelper
(CmsCmisRepository repository) Creates a new relation helper for the given repository. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.chemistry.opencmis.commons.data.Acl
collectAcl
(CmsObject cms, CmsResource resource, boolean onlyBasic) Compiles the ACL for a relation.protected org.apache.chemistry.opencmis.commons.data.AllowableActions
collectAllowableActions
(CmsObject cms, CmsResource file, CmsRelation relation) Collects the allowable actions for a relation.protected org.apache.chemistry.opencmis.commons.data.ObjectData
collectObjectData
(CmsCmisCallContext context, CmsObject cms, CmsResource resource, CmsRelation relation, Set<String> filter, boolean includeAllowableActions, boolean includeAcl) Fills in an ObjectData record.protected org.apache.chemistry.opencmis.commons.data.Properties
collectProperties
(CmsObject cms, CmsResource resource, CmsRelation relation, Set<String> orgfilter, org.apache.chemistry.opencmis.commons.impl.server.ObjectInfoImpl objectInfo) Gathers all base properties of a file or folder.protected static String
Creates a relation id string from the source and target ids and a relation type.protected String
createReadableName
(CmsRelation relation) Creates a user-readable name from the given relation object.void
deleteObject
(CmsCmisCallContext context, String objectId, boolean allVersions) Deletes a CMIS object.org.apache.chemistry.opencmis.commons.data.Acl
getAcl
(CmsCmisCallContext context, String objectId, boolean onlyBasicPermissions) Gets the ACL for an object.org.apache.chemistry.opencmis.commons.data.AllowableActions
getAllowableActions
(CmsCmisCallContext context, String objectId) Gets the allowable actions for an object.org.apache.chemistry.opencmis.commons.data.ObjectData
getObject
(CmsCmisCallContext context, String objectId, String filter, boolean includeAllowableActions, org.apache.chemistry.opencmis.commons.enums.IncludeRelationships includeRelationships, String renditionFilter, boolean includePolicyIds, boolean includeAcl) Gets the data for a CMIS object.protected static CmsRelationType
getRelationType
(String typeName) Gets a relation type by name.protected CmsCmisRelationHelper.RelationKey
Extracts the source/target ids and the type from a relation id.
-
Field Details
-
RELATION_ID_PREFIX
The prefix used to identify relation ids.- See Also:
-
RELATION_PATTERN
The pattern which relation ids should match.
-
-
Constructor Details
-
CmsCmisRelationHelper
Creates a new relation helper for the given repository.- Parameters:
repository
- the repository
-
-
Method Details
-
createKey
Creates a relation id string from the source and target ids and a relation type.- Parameters:
source
- the source idtarget
- the target idrelType
- the relation type- Returns:
- the relation id
-
getRelationType
Gets a relation type by name.- Parameters:
typeName
- the relation type name- Returns:
- the relation type with the matching name
-
deleteObject
Description copied from interface:I_CmsCmisObjectHelper
Deletes a CMIS object.- Specified by:
deleteObject
in interfaceI_CmsCmisObjectHelper
- Parameters:
context
- the call contextobjectId
- the id of the object to deleteallVersions
- flag to delete all version- See Also:
-
getAcl
public org.apache.chemistry.opencmis.commons.data.Acl getAcl(CmsCmisCallContext context, String objectId, boolean onlyBasicPermissions) Description copied from interface:I_CmsCmisObjectHelper
Gets the ACL for an object.- Specified by:
getAcl
in interfaceI_CmsCmisObjectHelper
- Parameters:
context
- the call contextobjectId
- the object idonlyBasicPermissions
- flag to only get basic permissions- Returns:
- the ACL for the object
- See Also:
-
getAllowableActions
public org.apache.chemistry.opencmis.commons.data.AllowableActions getAllowableActions(CmsCmisCallContext context, String objectId) Description copied from interface:I_CmsCmisObjectHelper
Gets the allowable actions for an object.- Specified by:
getAllowableActions
in interfaceI_CmsCmisObjectHelper
- Parameters:
context
- the call contextobjectId
- the object id- Returns:
- the allowable actions
- See Also:
-
getObject
public org.apache.chemistry.opencmis.commons.data.ObjectData getObject(CmsCmisCallContext context, String objectId, String filter, boolean includeAllowableActions, org.apache.chemistry.opencmis.commons.enums.IncludeRelationships includeRelationships, String renditionFilter, boolean includePolicyIds, boolean includeAcl) Description copied from interface:I_CmsCmisObjectHelper
Gets the data for a CMIS object.- Specified by:
getObject
in interfaceI_CmsCmisObjectHelper
- Parameters:
context
- the CMIS call contextobjectId
- the id of the objectfilter
- the property filterincludeAllowableActions
- flag to include allowable actionsincludeRelationships
- flag to include relationshipsrenditionFilter
- the rendition filter stringincludePolicyIds
- flag to include policy idsincludeAcl
- flag to include ACLs- Returns:
- the CMIS object data
- See Also:
-
collectAcl
protected org.apache.chemistry.opencmis.commons.data.Acl collectAcl(CmsObject cms, CmsResource resource, boolean onlyBasic) Compiles the ACL for a relation.- Parameters:
cms
- the CMS contextresource
- the resource for which to collect the ACLsonlyBasic
- flag to only include basic ACEs- Returns:
- the ACL for the resource
-
collectAllowableActions
protected org.apache.chemistry.opencmis.commons.data.AllowableActions collectAllowableActions(CmsObject cms, CmsResource file, CmsRelation relation) Collects the allowable actions for a relation.- Parameters:
cms
- the current CMS contextfile
- the source of the relationrelation
- the relation object- Returns:
- the allowable actions for the given resource
-
collectObjectData
protected org.apache.chemistry.opencmis.commons.data.ObjectData collectObjectData(CmsCmisCallContext context, CmsObject cms, CmsResource resource, CmsRelation relation, Set<String> filter, boolean includeAllowableActions, boolean includeAcl) Fills in an ObjectData record.- Parameters:
context
- the call contextcms
- the CMS contextresource
- the resource for which we want the ObjectDatarelation
- the relation objectfilter
- the property filter stringincludeAllowableActions
- true if the allowable actions should be includedincludeAcl
- true if the ACL entries should be included- Returns:
- the object data
-
collectProperties
protected org.apache.chemistry.opencmis.commons.data.Properties collectProperties(CmsObject cms, CmsResource resource, CmsRelation relation, Set<String> orgfilter, org.apache.chemistry.opencmis.commons.impl.server.ObjectInfoImpl objectInfo) Gathers all base properties of a file or folder.- Parameters:
cms
- the current CMS contextresource
- the file for which we want the propertiesrelation
- the relation objectorgfilter
- the property filterobjectInfo
- the object info handler- Returns:
- the properties for the given resource
-
createReadableName
Creates a user-readable name from the given relation object.- Parameters:
relation
- the relation object- Returns:
- the readable name
-
parseRelationKey
Extracts the source/target ids and the type from a relation id.- Parameters:
id
- the relation id- Returns:
- the relation key object
-