Package org.silverpeas.cmis
Class SilverpeasCmisRepository
- java.lang.Object
-
- org.silverpeas.cmis.SilverpeasCmisRepository
-
@Repository public class SilverpeasCmisRepository extends Object
A CMIS repository implementation for Silverpeas. Its responsibility is to provide access to the data in Silverpeas, conforming to the CMIS 1.1 specification, by taking into account the CMIS service capabilities that are supported as well as of the constrained support of those capabilities by Silverpeas.Behind the scene, it defines the capabilities actually supported and delegates to a type manager the knowledge of what are the CMIS types for each kind of Silverpeas objects exposed by CMIS and to an object manager the knowledge of how the CMIS and the Silverpeas objects are mapped between them. The access to the Silverpeas objects is done through this manager and it is controlled by the repository itself according to the supported CMIS service capabilities.
- Author:
- mmoquillon
-
-
Constructor Summary
Constructors Constructor Description SilverpeasCmisRepository()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
createDocument(org.apache.chemistry.opencmis.commons.data.Properties properties, String folderId, org.apache.chemistry.opencmis.commons.data.ContentStream stream)
Creates a document object of the specified type (given by the cmis:objectTypeId property) in the specified location and with the given content.String
createFolder(org.apache.chemistry.opencmis.commons.data.Properties properties, String parentId)
Creates a folder object of a given type (provided by the cmis:objectTypeId property) in the specified parent folder.org.apache.chemistry.opencmis.commons.data.ObjectInFolderList
getChildren(String folderId, String filter, Boolean includeAllowableActions, org.apache.chemistry.opencmis.commons.enums.IncludeRelationships includeRelationships, Boolean includePathSegment, BigInteger maxItems, BigInteger skipCount)
Gets the list of child objects contained in the specified folder.org.apache.chemistry.opencmis.commons.data.ContentStream
getContentStream(String objectId, BigInteger offset, BigInteger length)
Gets the content stream for the specified document object.List<org.apache.chemistry.opencmis.commons.data.ObjectInFolderContainer>
getDescendants(String folderId, BigInteger depth, String filter, Boolean includeAllowableActions, org.apache.chemistry.opencmis.commons.enums.IncludeRelationships includeRelationships, Boolean includePathSegment)
Gets the set of descendant objects contained in the specified folder or any of its child folders.List<org.apache.chemistry.opencmis.commons.data.ObjectInFolderContainer>
getFolderTree(String folderId, BigInteger depth, String filter, Boolean includeAllowableActions, org.apache.chemistry.opencmis.commons.enums.IncludeRelationships includeRelationships, Boolean includePathSegment)
Gets the set of descendant folder objects contained in the specified folder.String
getId()
Gets the unique identifier of this repository.CmisObject
getObject(String objectId, String filter, Boolean includeAllowableActions, org.apache.chemistry.opencmis.commons.enums.IncludeRelationships includeRelationships, Boolean includeAcl)
Gets the specified information for the object specified by its unique identifier.CmisFile
getObjectByPath(String path, String filter, Boolean includeAllowableActions, org.apache.chemistry.opencmis.commons.enums.IncludeRelationships includeRelationships, Boolean includeAcl)
Gets the specified information for the object specified by path.List<org.apache.chemistry.opencmis.commons.data.ObjectParentData>
getObjectParents(String objectId, String filter, Boolean includeAllowableActions, Boolean includeRelativePathSegment)
Gets the parent folder(s) for the specified fileable object.org.apache.chemistry.opencmis.commons.data.RepositoryInfo
getRepositoryInfo()
Gets information about the CMIS repository, the optional capabilities it supports and its access control information if applicable.org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionList
getTypeChildren(String typeId, Boolean includePropertyDefinitions, BigInteger maxItems, BigInteger skipCount)
Gets the list of object types defined for the repository that are children of the specified type.org.apache.chemistry.opencmis.commons.definitions.TypeDefinition
getTypeDefinition(String typeId)
Gets the definition of the specified object type.protected void
init()
void
updateDocument(String documentId, boolean overwrite, org.apache.chemistry.opencmis.commons.data.ContentStream contentStream)
Updates the specified document object by setting its content with the one in the given stream.
-
-
-
Method Detail
-
init
@PostConstruct protected void init()
-
getId
public String getId()
Gets the unique identifier of this repository.- Returns:
- the repository's unique identifier.
-
getRepositoryInfo
public org.apache.chemistry.opencmis.commons.data.RepositoryInfo getRepositoryInfo()
Gets information about the CMIS repository, the optional capabilities it supports and its access control information if applicable.- Returns:
- the repository info
-
getTypeChildren
public org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionList getTypeChildren(String typeId, Boolean includePropertyDefinitions, BigInteger maxItems, BigInteger skipCount)
Gets the list of object types defined for the repository that are children of the specified type.- Parameters:
typeId
- (optional) the typeId of an object type specified in the repository (if not specified the repository MUST return all base object types)includePropertyDefinitions
- (optional) iftrue
the repository MUST return the property definitions for each object type returned (default isfalse
)maxItems
- (optional) the maximum number of items to return in a response (default is repository specific)skipCount
- (optional) number of potential results that the repository MUST skip/page over before returning any results (default is 0)- Returns:
- the list of type children
-
getTypeDefinition
public org.apache.chemistry.opencmis.commons.definitions.TypeDefinition getTypeDefinition(String typeId)
Gets the definition of the specified object type.- Parameters:
typeId
- typeId of an object type specified in the repository- Returns:
- the type definition
-
getChildren
public org.apache.chemistry.opencmis.commons.data.ObjectInFolderList getChildren(String folderId, String filter, Boolean includeAllowableActions, org.apache.chemistry.opencmis.commons.enums.IncludeRelationships includeRelationships, Boolean includePathSegment, BigInteger maxItems, BigInteger skipCount)
Gets the list of child objects contained in the specified folder.- Parameters:
folderId
- the identifier for the folderfilter
- (optional) a comma-separated list of query names that defines which properties must be returned by the repository (default is repository specific)includeAllowableActions
- (optional) iftrue
, then the repository must return the available actions for each object in the result set (default isfalse
)includeRelationships
- (optional) indicates what relationships in which the objects participate must be returned (default isIncludeRelationships.NONE
)includePathSegment
- (optional) iftrue
, returns a path segment for each child object for use in constructing that object's path (default isfalse
)maxItems
- (optional) the maximum number of items to return in a response (default is repository specific)skipCount
- (optional) number of potential results that the repository MUST skip/page over before returning any results (default is 0)- Returns:
- the list of children. Each child is a
CmisFile
instance.
-
getDescendants
public List<org.apache.chemistry.opencmis.commons.data.ObjectInFolderContainer> getDescendants(String folderId, BigInteger depth, String filter, Boolean includeAllowableActions, org.apache.chemistry.opencmis.commons.enums.IncludeRelationships includeRelationships, Boolean includePathSegment)
Gets the set of descendant objects contained in the specified folder or any of its child folders. The difference with {
-
getFolderTree
public List<org.apache.chemistry.opencmis.commons.data.ObjectInFolderContainer> getFolderTree(String folderId, BigInteger depth, String filter, Boolean includeAllowableActions, org.apache.chemistry.opencmis.commons.enums.IncludeRelationships includeRelationships, Boolean includePathSegment)
Gets the set of descendant folder objects contained in the specified folder. The difference withgetDescendants(String, BigInteger, String, Boolean, IncludeRelationships, Boolean)
is that this method returns only folders and not documents.- Parameters:
folderId
- the identifier for the folderdepth
- the number of levels of depth in the folder hierarchy from which to return resultsfilter
- (optional) a comma-separated list of query names that defines which properties must be returned by the repository (default is repository specific)includeAllowableActions
- (optional) iftrue
, then the repository must return the available actions for each object in the result set (default isfalse
)includeRelationships
- (optional) indicates what relationships in which the objects participate must be returned (default isIncludeRelationships.NONE
)includePathSegment
- (optional) iftrue
, returns a path segment for each child object for use in constructing that object's path (default isfalse
)- Returns:
- the folder tree. Each descendent carried by the
ObjectInFolderData
objects in the listed containers is aCmisFolder
instance.
-
getObjectParents
public List<org.apache.chemistry.opencmis.commons.data.ObjectParentData> getObjectParents(String objectId, String filter, Boolean includeAllowableActions, Boolean includeRelativePathSegment)
Gets the parent folder(s) for the specified fileable object.- Parameters:
objectId
- the identifier for the objectfilter
- (optional) a comma-separated list of query names that defines which properties must be returned by the repository (default is repository specific)includeAllowableActions
- (optional) iftrue
, then the repository must return the available actions for each object in the result set (default isfalse
)includeRelativePathSegment
- (optional) iftrue
, returns a relative path segment for each parent object for use in constructing that object's path (default isfalse
)- Returns:
- the list of parents. Each parent is a
CmisFolder
instance.
-
getObject
public CmisObject getObject(String objectId, String filter, Boolean includeAllowableActions, org.apache.chemistry.opencmis.commons.enums.IncludeRelationships includeRelationships, Boolean includeAcl)
Gets the specified information for the object specified by its unique identifier.- Parameters:
objectId
- the identifier for the objectfilter
- (optional) a comma-separated list of query names that defines which properties must be returned by the repository (default is repository specific)includeAllowableActions
- (optional) iftrue
, then the repository must return the allowable actions for the object (default isfalse
)includeRelationships
- (optional) indicates what relationships in which the object participates must be returned (default isIncludeRelationships.NONE
)includeAcl
- (optional) iftrue
, then the repository must return the ACL for the object (default isfalse
)- Returns:
- the CMIS object.
-
getObjectByPath
public CmisFile getObjectByPath(String path, String filter, Boolean includeAllowableActions, org.apache.chemistry.opencmis.commons.enums.IncludeRelationships includeRelationships, Boolean includeAcl)
Gets the specified information for the object specified by path.- Parameters:
path
- the path to the objectfilter
- (optional) a comma-separated list of query names that defines which properties must be returned by the repository (default is repository specific)includeAllowableActions
- (optional) iftrue
, then the repository must return the allowable actions for the object (default isfalse
)includeRelationships
- (optional) indicates what relationships in which the object participates must be returned (default isIncludeRelationships.NONE
)includeAcl
- (optional) iftrue
, then the repository must return the ACL for the object (default isfalse
)- Returns:
- the CMIS file-able object located at the given path.
-
getContentStream
public org.apache.chemistry.opencmis.commons.data.ContentStream getContentStream(String objectId, BigInteger offset, BigInteger length)
Gets the content stream for the specified document object.- Parameters:
objectId
- the identifier for the objectoffset
- the position in bytes in the document content from which the stream to return should start.length
- the length in bytes of the stream to return.- Returns:
- the content stream
-
createFolder
public String createFolder(org.apache.chemistry.opencmis.commons.data.Properties properties, String parentId)
Creates a folder object of a given type (provided by the cmis:objectTypeId property) in the specified parent folder. If the parent doesn't support the creation of such a folder type, then aCmisNotSupportedException
exception is thrown.- Parameters:
properties
- the property values that must be applied to the newly created folder objectparentId
- the identifier for the parent folder- Returns:
- the ID of the newly created folder
-
createDocument
public String createDocument(org.apache.chemistry.opencmis.commons.data.Properties properties, String folderId, org.apache.chemistry.opencmis.commons.data.ContentStream stream)
Creates a document object of the specified type (given by the cmis:objectTypeId property) in the specified location and with the given content.- Parameters:
properties
- the property values that must be applied to the newly created folder objectfolderId
- the identifier for the parent folderstream
- the stream on the document's content. The stream is consumed but not closed by this method.- Returns:
- the ID of the newly created document
-
updateDocument
public void updateDocument(String documentId, boolean overwrite, org.apache.chemistry.opencmis.commons.data.ContentStream contentStream)
Updates the specified document object by setting its content with the one in the given stream. The stream incontentStream
is consumed but not closed by this method.- Parameters:
documentId
- the identifier for the document.overwrite
- Iftrue
, then the repository must replace the existing content stream for the object (if any) with the input content stream. Iffalse
, then the repository must only set the input content stream for the object if the object currently does not have a content stream (default istrue
)contentStream
- the stream on the document's content. The stream is consumed but not closed by this method.
-
-