Class SilverpeasCmisObjectManager
- java.lang.Object
-
- org.silverpeas.cmis.SilverpeasCmisObjectManager
-
@Service public class SilverpeasCmisObjectManager extends Object
A manager of CMIS objects that are stored into Silverpeas. It is responsible to map the organizational resources (spaces, component instances, etc.) and contributions in Silverpeas to the organizational tree of CMIS objects (folders, documents, relationships, and so on). It is the one that has the knowledge of how the Silverpeas objects are mapped to the CMIS objects while satisfying the CMIS specification requirements. It is dedicated to be used by a CMIS repository implementation.In order to facilitate the mapping between the organizational tree of CMIS objects and the organization of the Silverpeas resources, the manager defines a one-to-one correspondence of its methods with those of the CMIS services. Hence, the client of the manager has just to delegate the CMIS service's operation by invoking one of the manager's method with the correct parameters correspondence.
The walking through the tree of CMIS objects and the modification operations on those objects (and therefore their corresponding Silverpeas resources and contributions) is performed by a
AbstractCmisObjectsTreeWalker
instance that knows both how to walk through a given subtree and how to perform CRUD operations on the objects of that subtree according to the type of these objects. For example, the walking down a subtree isn't done identically when rooted to a space than when rooted to an application (as they don't accept the same children type) and don't support necessary the same operations.- Author:
- mmoquillon
-
-
Constructor Summary
Constructors Constructor Description SilverpeasCmisObjectManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CmisObject
createDocument(String folderId, org.apache.chemistry.opencmis.commons.data.Properties properties, org.apache.chemistry.opencmis.commons.data.ContentStream content, String language)
Creates into the specified parent folder aDocumentFile
object from its specified CMIS properties and from the specified content both expressed in the given language.CmisObject
createFolder(String folderId, org.apache.chemistry.opencmis.commons.data.Properties properties, String language)
Creates into the specified parent folder aCmisObject
object from its specified CMIS properties expressed in the given language.org.apache.chemistry.opencmis.commons.data.ObjectInFolderList
getChildren(String folderId, Filtering filtering, Paging paging)
Gets the objects that are children of the specified folder.org.apache.chemistry.opencmis.commons.data.ContentStream
getContentStream(String objectId, String language, long start, long size)
Gets the content of the specified object starting at the given position and at the specified size.List<org.apache.chemistry.opencmis.commons.data.ObjectInFolderContainer>
getDescendants(String folderId, Filtering filtering, long depth)
Gets the file-able objects that are the descendents of the specified folder down to the given depth of its offspring tree.CmisObject
getObject(String objectId, Filtering filtering)
Gets the specified object in Silverpeas.CmisFile
getObjectByPath(String path, Filtering filtering)
Gets the object that is defined at the specified path in the organizational CMIS tree.List<org.apache.chemistry.opencmis.commons.data.ObjectParentData>
getParents(String objectId, Filtering filtering)
Gets the parents of the specified object.void
updateDocument(String documentId, boolean overwrite, org.apache.chemistry.opencmis.commons.data.ContentStream contentStream, String language)
Updates the specified document with the new content provided by the given stream.
-
-
-
Method Detail
-
createFolder
public CmisObject createFolder(String folderId, org.apache.chemistry.opencmis.commons.data.Properties properties, String language)
Creates into the specified parent folder aCmisObject
object from its specified CMIS properties expressed in the given language. The concrete type of the CMIS object to create is given by thePropertyIds.OBJECT_TYPE_ID
property. If the creation of instances of such concrete type isn't supported, then aCmisNotSupportedException
exception is thrown.- Parameters:
folderId
- the unique identifier of the parent folder.properties
- the CMIS properties of the object to create.language
- the ISO 639-1 code of the language in which the textual properties are expressed.- Returns:
- the unique identifier of the newly created CMIS object.
-
createDocument
public CmisObject createDocument(String folderId, org.apache.chemistry.opencmis.commons.data.Properties properties, org.apache.chemistry.opencmis.commons.data.ContentStream content, String language)
Creates into the specified parent folder aDocumentFile
object from its specified CMIS properties and from the specified content both expressed in the given language. The concrete type of the CMIS object to create is given by thePropertyIds.OBJECT_TYPE_ID
property and must beTypeId.SILVERPEAS_DOCUMENT
otherwise aCmisNotSupportedException
exception is thrown. If an error occurs while storing the content stream, then aCmisStorageException
exception is thrown.- Parameters:
folderId
- the unique identifier of the parent folder.properties
- the CMIS properties of the document to create.content
- a stream on the document's content to store into a file in Silverpeas. The stream is consumed but not closed by this method.language
- the ISO 639-1 code of the language in which the textual properties are expressed.- Returns:
- the unique identifier of the newly created CMIS object.
-
updateDocument
public void updateDocument(String documentId, boolean overwrite, org.apache.chemistry.opencmis.commons.data.ContentStream contentStream, String language)
Updates the specified document with the new content provided by the given stream.- Parameters:
documentId
- the unique identifier of the document to update.overwrite
- indicates if the document's content must be overwritten by the new one or just to set the content for an empty document. In this last case, if the document isn't really empty then aCmisContentAlreadyExistsException
is thrown.contentStream
- a stream on the document's content to store into a file in Silverpeas. The stream is consumed but not closed by this method.language
- the ISO 639-1 code of the language in which the textual properties are expressed.
-
getObject
public CmisObject getObject(String objectId, Filtering filtering)
Gets the specified object in Silverpeas.- Parameters:
objectId
- the unique identifier of the object.filtering
- filtering parameters to apply on the characteristics to include with the object.- Returns:
- the
CmisObject
instance matching the given identifier.
-
getObjectByPath
public CmisFile getObjectByPath(String path, Filtering filtering)
Gets the object that is defined at the specified path in the organizational CMIS tree.- Parameters:
path
- the path of the object from the root. The path is made up of segments, each of them separated by the '/' character. A segment can be either the name of a CMIS fileable object or its unique identifier. For better performance we recommend strongly to use object's identifiers for segments.filtering
- parameters to apply on the characteristics to include with the object.- Returns:
- the
CmisFile
instance located at the given path.
-
getChildren
public org.apache.chemistry.opencmis.commons.data.ObjectInFolderList getChildren(String folderId, Filtering filtering, Paging paging)
Gets the objects that are children of the specified folder.- Parameters:
folderId
- the unique identifier of a folder, whatever its concrete type in Silverpeas.filtering
- the filtering parameters to apply on the characteristics to include with each object.paging
- paging parameters to apply on the list of objects to return.- Returns:
- a list of
ObjectInFolderData
objects, each of them carrying aCmisFile
instance as a child of the given folder.
-
getDescendants
public List<org.apache.chemistry.opencmis.commons.data.ObjectInFolderContainer> getDescendants(String folderId, Filtering filtering, long depth)
Gets the file-able objects that are the descendents of the specified folder down to the given depth of its offspring tree.- Parameters:
folderId
- the unique identifier of a folder, whatever its concrete type in Silverpeas.filtering
- the filtering parameters to apply on the characteristics to include with each object.depth
- the depth of the offspring tree to walk across. If 1, only the direct children of the specified folder are returned, if negative all descendant objects at all depth levels in the CMIS hierarchy are returned, any positive value means only objects that are children of the folder and descendants down to the given levels deep.- Returns:
- the subtree rooted at the specified folder, upto the given depth value. The tree is a
list of containers of both a
ObjectInFolderData
object and the children of that object. EachObjectInFolderData
instance carries aCmisFile
instance as a descendent.
-
getParents
public List<org.apache.chemistry.opencmis.commons.data.ObjectParentData> getParents(String objectId, Filtering filtering)
Gets the parents of the specified object.- Parameters:
objectId
- the unique identifier of an object in Silverpeas, whatever its concrete type in Silverpeas.filtering
- the filtering parameters to apply on the list of objects to return.- Returns:
- a list of
CmisFolder
instances that are the direct parents of the given object.
-
getContentStream
public org.apache.chemistry.opencmis.commons.data.ContentStream getContentStream(String objectId, String language, long start, long size)
Gets the content of the specified object starting at the given position and at the specified size.- Parameters:
objectId
- the unique identifier of an object in Silverpeas.language
- the ISO 639-1 code of the language of the object's content to get.start
- the starting position in bytes of the content to get.size
- the size of the content, from the starting position, to get.- Returns:
- a stream on the object's content.
-
-