Package org.silverpeas.core.cmis.model
Class CmisObject
- java.lang.Object
-
- org.apache.chemistry.opencmis.commons.impl.dataobjects.AbstractExtensionData
-
- org.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectDataImpl
-
- org.silverpeas.core.cmis.model.CmisObject
-
- All Implemented Interfaces:
Serializable
,org.apache.chemistry.opencmis.commons.data.ExtensionsData
,org.apache.chemistry.opencmis.commons.data.MutableObjectData
,org.apache.chemistry.opencmis.commons.data.ObjectData
- Direct Known Subclasses:
CmisFile
public abstract class CmisObject extends org.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectDataImpl
An object in the CMIS model that is mapped to a resource in Silverpeas. It can be a collaborative space, an application, a category of a gallery, a folder of an EDM, a classification onto the PdC, or simply a contribution (publication, attachment, images, ...). ACmisObject
class defines the properties that are expected for a given CMIS object, with some of them peculiar to its type. It is a way to map the properties of a Silverpeas resource to those of a CMIS object and then, from them, to generalize the build of CMIS data done by a CMIS repository. Because Silverpeas objects are localized, then a CMIS object mapped to such an object is always localized to the locale setting of the current user behind the CMIS request.All the objects in CMIS must satisfy the following properties: unique identifier, name, description, creation and last modification date, creator's name, last updater's name, ACL, and allowable actions.
- Author:
- mmoquillon
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description <T extends CmisObject>
TaddACEs(User user)
Adds the ACEs relative to the specified user and regarding to this CMIS object in the ACL of the objet.org.apache.chemistry.opencmis.commons.data.Acl
getAcl()
Gets the ACL of this CMIS object.org.apache.chemistry.opencmis.commons.data.AllowableActions
getAllowableActions()
Gets all the actions that are allowable on this CMIS object, whatever the permissions a user in Silverpeas can have in performing those actions.protected abstract Supplier<Set<org.apache.chemistry.opencmis.commons.enums.Action>>
getAllowableActionsSupplier()
Gets a supplier of the actions allowable on this CMIS object.abstract org.apache.chemistry.opencmis.commons.enums.BaseTypeId
getBaseTypeId()
Gets the identifier of the base type from which the type of the CMIS object is derived.long
getCreationDate()
Gets the date at which this CMIS object was created.String
getCreator()
Gets the full name of the user that has authored this CMIS object.String
getDescription()
Gets a description of this CMIS object.String
getId()
Gets the unique identifier of the object in the CMIS objects tree.String
getLabel()
Gets the label, localized for the user behind the request, to display to the user as name of this CMIS object.String
getLanguage()
Gets the language in which some of the object's attributes are localized.long
getLastModificationDate()
Gets the date at which this CMIS object was lastly modified.String
getLastModifier()
Gets the full name of the user that has lastly modified this CMIS object.String
getName()
Gets the name, localized for the user behind the request, of this CMIS object.abstract String
getSymbol()
Gets the possible UTF-8 symbol representing the type of this CMIS object.abstract TypeId
getTypeId()
Gets the identifier of the type of this CMIS object.boolean
isDocument()
Is this CMIS object a document in the CMIS objects tree?abstract boolean
isFileable()
Is this CMIS object file-able into the CMIS objects tree?<T extends CmisObject>
TsetAcesSupplier(Function<User,List<org.apache.chemistry.opencmis.commons.data.Ace>> supplier)
Sets a supplier of an ACL to apply on this CMIS object.void
setAcl(org.apache.chemistry.opencmis.commons.data.Acl acl)
Overrides the ACL of this CMIS object with this new one.<T extends CmisObject>
TsetAllowableActions()
Sets all the actions allowable on this CMIS object, whatever the permissions a user in Silverpeas can have in performing those actions, by using the supplier of the actions predefined for this object.<T extends CmisObject>
TsetCreationDate(long creationDate)
Sets the date at which this CMIS object was created.<T extends CmisObject>
TsetCreator(String creator)
Sets the full name of the user that has created this CMIS object.<T extends CmisObject>
TsetDescription(String description)
Sets a description about this CMIS object.void
setIsExactAcl(Boolean isExactACL)
This method does nothing.<T extends CmisObject>
TsetLastModificationDate(long lastModificationDate)
<T extends CmisObject>
TsetLastModifier(String lastModifier)
Sets the full name of the user that has modified this CMIS object.protected Set<org.apache.chemistry.opencmis.commons.enums.Action>
theCommonActions()
-
Methods inherited from class org.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectDataImpl
getChangeEventInfo, getPolicyIds, getProperties, getRelationships, getRenditions, isExactAcl, setAllowableActions, setChangeEventInfo, setPolicyIds, setProperties, setRelationships, setRenditions, toString
-
Methods inherited from class org.apache.chemistry.opencmis.commons.impl.dataobjects.AbstractExtensionData
getExtensions, setExtensions
-
-
-
-
Method Detail
-
getId
public String getId()
Gets the unique identifier of the object in the CMIS objects tree.- Specified by:
getId
in interfaceorg.apache.chemistry.opencmis.commons.data.ObjectData
- Overrides:
getId
in classorg.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectDataImpl
- Returns:
- the unique identifier of this CMIS object.
-
getSymbol
public abstract String getSymbol()
Gets the possible UTF-8 symbol representing the type of this CMIS object. It acts as an icon but instead of being a regular image the icon is encoded in UTF-8. Its goal is to mark the concrete type of the CMIS object upon its basic CMIS one (that is folder, document, ...)- Returns:
- the UTF-8 symbol representing the type of this object or an empty String if no symbol is defined.
-
isFileable
public abstract boolean isFileable()
Is this CMIS object file-able into the CMIS objects tree?- Returns:
- true if the object can be put in the CMIS objects tree as a node or a leaf of that tree. False otherwise
-
isDocument
public boolean isDocument()
Is this CMIS object a document in the CMIS objects tree? A document is a file-able object that doesn't have any children (it is a leaf in the CMIS objects tree) and that has a content stream (beside any rendition content streams). Such objects must have as base type identifierBaseTypeId.CMIS_DOCUMENT
.- Returns:
- true if this object is a document. False otherwise.
-
getName
public String getName()
Gets the name, localized for the user behind the request, of this CMIS object.- Returns:
- the localized name of the object.
-
getLabel
public String getLabel()
Gets the label, localized for the user behind the request, to display to the user as name of this CMIS object.- Returns:
- the concatenation of the symbol and the name of this object. If no symbol is defined for this CMIS object, then the name is returned.
-
getLanguage
public String getLanguage()
Gets the language in which some of the object's attributes are localized.- Returns:
- an ISO 639-1 language code corresponding to the language of the user behind the request.
-
getBaseTypeId
public abstract org.apache.chemistry.opencmis.commons.enums.BaseTypeId getBaseTypeId()
Gets the identifier of the base type from which the type of the CMIS object is derived.- Specified by:
getBaseTypeId
in interfaceorg.apache.chemistry.opencmis.commons.data.ObjectData
- Overrides:
getBaseTypeId
in classorg.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectDataImpl
-
getTypeId
public abstract TypeId getTypeId()
Gets the identifier of the type of this CMIS object.- Returns:
- a
TypeId
enumeration value.
-
getDescription
public String getDescription()
Gets a description of this CMIS object.- Returns:
- a short description about it.
-
setDescription
public <T extends CmisObject> T setDescription(String description)
Sets a description about this CMIS object.- Type Parameters:
T
- the concrete Java type of this CMIS object.- Parameters:
description
- a short text to set.- Returns:
- itself.
-
getCreator
public String getCreator()
Gets the full name of the user that has authored this CMIS object.- Returns:
- the full name of the creator.
-
setCreator
public <T extends CmisObject> T setCreator(String creator)
Sets the full name of the user that has created this CMIS object.- Type Parameters:
T
- the concrete Java type of this CMIS object.- Parameters:
creator
- the full name of a user in Silverpeas.- Returns:
- itself.
-
getLastModifier
public String getLastModifier()
Gets the full name of the user that has lastly modified this CMIS object. By default, the first modifier is the creator of this object.- Returns:
- the full name of the last modifier.
-
setLastModifier
public <T extends CmisObject> T setLastModifier(String lastModifier)
Sets the full name of the user that has modified this CMIS object.- Type Parameters:
T
- the concrete Java type of this CMIS object.- Parameters:
lastModifier
- the full name of a user in Silverpeas.- Returns:
- itself.
-
getCreationDate
public long getCreationDate()
Gets the date at which this CMIS object was created.- Returns:
- the number of milliseconds since the EPOCH January 1, 1970, 00:00:00 GMT
-
setCreationDate
public <T extends CmisObject> T setCreationDate(long creationDate)
Sets the date at which this CMIS object was created.- Type Parameters:
T
- the concrete Java type of this CMIS object.- Parameters:
creationDate
- a number of milliseconds since the EPOCH January 1, 1970, 00:00:00 GMT- Returns:
- itself.
-
getLastModificationDate
public long getLastModificationDate()
Gets the date at which this CMIS object was lastly modified. By default, the first modification date is the date at which this object has been created.- Returns:
- the number of milliseconds since the EPOCH January 1, 1970, 00:00:00 GMT
-
setLastModificationDate
public <T extends CmisObject> T setLastModificationDate(long lastModificationDate)
-
addACEs
public <T extends CmisObject> T addACEs(User user)
Adds the ACEs relative to the specified user and regarding to this CMIS object in the ACL of the objet. The ACEs are supplied by the function that was passed with thesetAcesSupplier(Function)
function.- Returns:
- itself.
-
setAcl
public void setAcl(org.apache.chemistry.opencmis.commons.data.Acl acl)
Overrides the ACL of this CMIS object with this new one. All the previous ACE that were set are then lost.- Specified by:
setAcl
in interfaceorg.apache.chemistry.opencmis.commons.data.MutableObjectData
- Overrides:
setAcl
in classorg.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectDataImpl
- Parameters:
acl
- the new ACL to set explicitly.
-
setIsExactAcl
public void setIsExactAcl(Boolean isExactACL)
This method does nothing. The exactitude of the ACL regarding the permissions defined in the CMIS repository is centralized and controlled.- Specified by:
setIsExactAcl
in interfaceorg.apache.chemistry.opencmis.commons.data.MutableObjectData
- Overrides:
setIsExactAcl
in classorg.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectDataImpl
- Parameters:
isExactACL
- a boolean.
-
setAcesSupplier
public <T extends CmisObject> T setAcesSupplier(Function<User,List<org.apache.chemistry.opencmis.commons.data.Ace>> supplier)
Sets a supplier of an ACL to apply on this CMIS object.- Type Parameters:
T
- the concrete Java type of this CMIS object.- Parameters:
supplier
- a function that supplies on demand a list of ACEs to apply on this object.- Returns:
- itself.
-
getAcl
public org.apache.chemistry.opencmis.commons.data.Acl getAcl()
Gets the ACL of this CMIS object. The ACL contains a list of ACEs that define for one or more users in Silverpeas the permissions they have regarding this object. Each permission authorizes or forbids the related user to perform one or more of the actions that are allowable on this CMIS object. For more information about the ACL and the allowable actions on CMIS objects, see CMIS specification- Specified by:
getAcl
in interfaceorg.apache.chemistry.opencmis.commons.data.ObjectData
- Overrides:
getAcl
in classorg.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectDataImpl
- Returns:
- an
Acl
object. - See Also:
getAllowableActions()
-
getAllowableActions
public org.apache.chemistry.opencmis.commons.data.AllowableActions getAllowableActions()
Gets all the actions that are allowable on this CMIS object, whatever the permissions a user in Silverpeas can have in performing those actions. The actions are set only and only if thesetAllowableActions()
was previously invoked. Indeed, in CMIS the allowable actions are requested on demand. For more information about the ACL and the allowable actions on CMIS objects, see CMIS specification- Specified by:
getAllowableActions
in interfaceorg.apache.chemistry.opencmis.commons.data.ObjectData
- Overrides:
getAllowableActions
in classorg.apache.chemistry.opencmis.commons.impl.dataobjects.ObjectDataImpl
- Returns:
- a
AllowableActions
object.
-
setAllowableActions
public <T extends CmisObject> T setAllowableActions()
Sets all the actions allowable on this CMIS object, whatever the permissions a user in Silverpeas can have in performing those actions, by using the supplier of the actions predefined for this object. The goal of the supplier is to set the allowable actions in this object on the demand. In some circumstances, the allowable actions aren't requested and therefore don't need to be set. For more information about the ACL and the allowable actions on CMIS objects, see CMIS specification- Type Parameters:
T
- the concrete Java type of this CMIS object.- Returns:
- itself.
-
getAllowableActionsSupplier
protected abstract Supplier<Set<org.apache.chemistry.opencmis.commons.enums.Action>> getAllowableActionsSupplier()
Gets a supplier of the actions allowable on this CMIS object. The supplier is only invoked when thesetAllowableActions()
is invoked.- Returns:
-
theCommonActions
protected Set<org.apache.chemistry.opencmis.commons.enums.Action> theCommonActions()
-
-