Package org.silverpeas.cmis.util
Class CmisProperties
- java.lang.Object
-
- org.silverpeas.cmis.util.CmisProperties
-
public class CmisProperties extends Object
Each object in CMIS are defined by properties whose some of them are common to all of the CMIS objects (name and description for example). This class is dedicated to access these properties gathered in aPropertiesobject for Silverpeas. It provides a centralized and a common way to set and to get the usual CMIS properties of the Silverpeas resources and contributions exposed in the CMIS objects tree.
-
-
Constructor Summary
Constructors Constructor Description CmisProperties()Creates aCmisPropertiesinstance wrapping by default aMutablePropertiesobject that can be get with thegetProperties()method.CmisProperties(org.apache.chemistry.opencmis.commons.data.Properties properties)Creates aCmisPropertiesinstance from thePropertiesobject so that the CMIS object's properties can be more easily accessed.CmisProperties(org.apache.chemistry.opencmis.commons.data.Properties properties, Set<String> filter)Creates aCmisPropertiesinstance from thePropertiesobject so that the CMIS object's properties can be more easily accessed.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetContentFileName()Gets the name of the file in which is stored the document content.StringgetContentMimeType()Gets the MIME type of the content of the document.StringgetContentPath()Gets the path of the file in which the content stream has been uploaded.DategetCreationDate()Gets the date at which the object has been created as it was set in the underlying properties.StringgetDescription()Gets the short description about the object described by the underlying properties.StringgetName()Gets the name of the object described by the underlying properties.TypeIdgetObjectTypeId()Gets the CMIS type of the object described by the underlying properties.StringgetParentObjectId()Gets the unique identifier of the parent of the object.org.apache.chemistry.opencmis.commons.data.PropertiesgetProperties()Gets the underlyingPropertiesobject.booleanisIndexed()Is this object indexed in Silverpeas?CmisPropertiessetAllowedChildObjectTypeIds(List<String> objectTypeIds)Sets the type of all of the children allowed for the CMIS object represented by the underlying properties.CmisPropertiessetContent(String id, String mimeType, long length, String fileName)Sets the content to the CMIS document.CmisPropertiessetContentPath(String contentFilePath)Sets the path at which is located the file into which the content stream has been uploaded.CmisPropertiessetCreationData(String userName, long dateTime)Sets the creator display name and the creation date at which the CMIS object was created.CmisPropertiessetDefaultProperties()Sets the default common CMIS object properties as defined in Silverpeas.CmisPropertiessetDescription(String description)Sets the short description of the CMIS object.CmisPropertiessetImmutability(boolean immutability)CmisPropertiessetIndexed(boolean indexed)Sets the indexation property of this object.CmisPropertiessetLastModificationData(String userName, long dateTime)Sets the update display name and the date at which the CMIS object was lastly updated.CmisPropertiessetName(String name)Sets the name or the title of the CMIS object.CmisPropertiessetObjectId(String id)Sets the unique identifier of the CMIS object in the CMIS tree.CmisPropertiessetObjectTypeId(TypeId typeId)Sets the type and the base type of the CMIS object.CmisPropertiessetParentObjectId(String parentId)Sets the unique identifier of the object that is parent of the CMIS object represented by the underlying properties.CmisPropertiessetPath(String path)Sets the path in the CMIS tree of the object represented by the underlying properties.CmisPropertiessetPWCData(boolean isThereAPwc, boolean isPwc, String pwcId, String userId)Sets the Private Working Copy data if any for the CMIS document.CmisPropertiessetVersioningData(String seriesId, String label, String comment, boolean isLatestVersion, boolean isMajorVersion, boolean isLatestMajorVersion)Sets the versioning data of the document object exposed in the CMIS tree.
-
-
-
Constructor Detail
-
CmisProperties
public CmisProperties()
Creates aCmisPropertiesinstance wrapping by default aMutablePropertiesobject that can be get with thegetProperties()method.
-
CmisProperties
public CmisProperties(org.apache.chemistry.opencmis.commons.data.Properties properties)
Creates aCmisPropertiesinstance from thePropertiesobject so that the CMIS object's properties can be more easily accessed.- Parameters:
properties- properties of a CMIS object.
-
CmisProperties
public CmisProperties(org.apache.chemistry.opencmis.commons.data.Properties properties, Set<String> filter)Creates aCmisPropertiesinstance from thePropertiesobject so that the CMIS object's properties can be more easily accessed. The specified filter indicates what properties inPropertieshave to be taken into account; others properties will be ignored.- Parameters:
properties- properties of a CMIS object.filter- a set of filtering rules to apply on the properties to access.
-
-
Method Detail
-
getProperties
public org.apache.chemistry.opencmis.commons.data.Properties getProperties()
Gets the underlyingPropertiesobject.- Returns:
- the underlying and wrapped
Propertiesinstance.
-
getObjectTypeId
public TypeId getObjectTypeId()
Gets the CMIS type of the object described by the underlying properties.- Returns:
- a
TypeIdvalue.
-
getParentObjectId
public String getParentObjectId()
Gets the unique identifier of the parent of the object.- Returns:
- a
Stringrepresentation of the identifier of the parent object.
-
getName
public String getName()
Gets the name of the object described by the underlying properties.- Returns:
- the name of the CMIS object.
-
getDescription
public String getDescription()
Gets the short description about the object described by the underlying properties.- Returns:
- the description about the CMIS object.
-
getCreationDate
public Date getCreationDate()
Gets the date at which the object has been created as it was set in the underlying properties.- Returns:
- the creation date of the CMIS object.
-
getContentMimeType
public String getContentMimeType()
Gets the MIME type of the content of the document.- Returns:
- the document content MIME Type.
-
getContentFileName
public String getContentFileName()
Gets the name of the file in which is stored the document content.- Returns:
- the file name.
-
getContentPath
public String getContentPath()
Gets the path of the file in which the content stream has been uploaded. This property is only set at document creation or update. Otherwise it is always null.- Returns:
- the absolute path of the file with the content of a document.
-
isIndexed
public boolean isIndexed()
Is this object indexed in Silverpeas?- Returns:
- true if this object is indexed, false otherwise.
-
setObjectTypeId
public CmisProperties setObjectTypeId(TypeId typeId)
Sets the type and the base type of the CMIS object. Each object is CMIS is defined by a concrete type and a base type from which the concrete type is derived.- Parameters:
typeId- the identifier of a CMIS type to qualify a resource or a contribution of Silverpeas into the CMIS tree.- Returns:
- itself
-
setObjectId
public CmisProperties setObjectId(String id)
Sets the unique identifier of the CMIS object in the CMIS tree.- Parameters:
id- the CMIS object's unique identifier.- Returns:
- itself.
-
setDefaultProperties
public CmisProperties setDefaultProperties()
Sets the default common CMIS object properties as defined in Silverpeas. The CMIS properties not supported or not handled by Silverpeas for its objects exposed in the CMIS tree are set with a null value.- Returns:
- itself
-
setName
public CmisProperties setName(String name)
Sets the name or the title of the CMIS object.- Parameters:
name- the CMIS object name.- Returns:
- itself
-
setDescription
public CmisProperties setDescription(String description)
Sets the short description of the CMIS object.- Parameters:
description- a description of the CMIS object.- Returns:
- itself
-
setCreationData
public CmisProperties setCreationData(String userName, long dateTime)
Sets the creator display name and the creation date at which the CMIS object was created. In the case the CMIS object is a Private Working Copy of a document, then the creation date must be the date at which the creation of the PWC was spawned and the creator should be set to the name of the user that has checkout-ed the document. In the case the CMIS object is a version in a version series for a document the creation data is about by who and when the PWC was created. In the case of a non-versionable document, like any other CMIS objects, the creation data are about by who and when the original document was created in the CMIS tree.- Parameters:
userName- the full name of the user as to be displayed in the CMIS tree.dateTime- the creation date of the object in number of milliseconds from Epoch- Returns:
- itself
-
setLastModificationData
public CmisProperties setLastModificationData(String userName, long dateTime)
Sets the update display name and the date at which the CMIS object was lastly updated. In the case of a Private Working Copy of a document, the last modification data are about by who and when the PWC was updated (with thePWCUpdatablerepository capability, several users can work on a PWC).In the case of a given version in a version series for a document, the last modification data is about by who and when the version was checked-in and hence became the last version. For a non-versionable document as well as for others CMIS objects, these properties are about by who and when the original document was lastly modified in the CMIS tree.- Parameters:
userName- the full name of the user as to be displayed in the CMIS tree.dateTime- the last modification date of the object in number of milliseconds from Epoch- Returns:
- itself
-
setAllowedChildObjectTypeIds
public CmisProperties setAllowedChildObjectTypeIds(List<String> objectTypeIds)
Sets the type of all of the children allowed for the CMIS object represented by the underlying properties.- Parameters:
objectTypeIds- the unique identifier of the types of the allowed children objects.- Returns:
- itself
-
setParentObjectId
public CmisProperties setParentObjectId(String parentId)
Sets the unique identifier of the object that is parent of the CMIS object represented by the underlying properties.- Parameters:
parentId- the unique identifier of a CMIS object in the CMIS tree.- Returns:
- itself.
-
setPath
public CmisProperties setPath(String path)
Sets the path in the CMIS tree of the object represented by the underlying properties. Each node of the path is the name of a parent from the CMIS tree root upto the name of the object.- Parameters:
path- a path of the object in the CMIS tree from the CMIS tree root.- Returns:
- itself
-
setImmutability
public CmisProperties setImmutability(boolean immutability)
-
setVersioningData
public CmisProperties setVersioningData(String seriesId, String label, String comment, boolean isLatestVersion, boolean isMajorVersion, boolean isLatestMajorVersion)
Sets the versioning data of the document object exposed in the CMIS tree. Each document has a version series that is an ordered sequence (by their creation date) of one or more document objects that were created from an original document in the CMIS tree. These document objects represent each of them a given version of the related original document. For a non-versionable document, the version series has only one document object, the latest version.- Parameters:
seriesId- the unique identifier of the version series id of the document.label- a version label (like "version 1.0" for example)comment- a comment about the version represented by the objectisLatestVersion- is the object the latest version of the document's version series.isMajorVersion- is the object a major version in the document's version series.isLatestMajorVersion- is the object the lastest major version in the document's version series.- Returns:
- itself.
-
setPWCData
public CmisProperties setPWCData(boolean isThereAPwc, boolean isPwc, String pwcId, String userId)
Sets the Private Working Copy data if any for the CMIS document. A Private Working Copy is a clone of a given document object created by a checkout operation. This PWC must have a unique identifier different from the original document in the CMIS tree. A Private Working Copy is a CMIS document private to one or more users (for a repository with thePWCUpdatablecapability) on which those users works until the modifications are pushed to the document in the CMIS tree by a checkin operation; in this case, the PWC becomes a new version of the original document (id est its latest version).- Parameters:
isThereAPwc- is there exists currently a Private Working Copy for the version series of the document?isPwc- is the object is a Private Working Copy of the documentpwcId- the unique identifier of the Private Working Copy that has to be different from the document identifier)userId- the identifier of the user that has created the Private Working Copy.- Returns:
- itself
-
setContent
public CmisProperties setContent(String id, String mimeType, long length, String fileName)
Sets the content to the CMIS document.- Parameters:
id- the unique identifier of the content.mimeType- the MIME type of the content.length- the length of the content in bytes.fileName- the name of the file in which is stored the content.- Returns:
- itself.
-
setContentPath
public CmisProperties setContentPath(String contentFilePath)
Sets the path at which is located the file into which the content stream has been uploaded.- Parameters:
contentFilePath- the path of the content file.- Returns:
- itself.
-
setIndexed
public CmisProperties setIndexed(boolean indexed)
Sets the indexation property of this object.- Parameters:
indexed- the object is indexed or should be indexed.- Returns:
- itself.
-
-