Package org.silverpeas.cmis.walkers
Class CmisObjectsTreeWalkerDelegator
- java.lang.Object
-
- org.silverpeas.cmis.walkers.CmisObjectsTreeWalkerDelegator
-
- All Implemented Interfaces:
CmisObjectsTreeWalker
@Technical @Service @Singleton public class CmisObjectsTreeWalkerDelegator extends Object implements CmisObjectsTreeWalker
A dummy tree walker to be used as a delegator ofCmisObjectsTreeWalker
's method invocations to the correctCmisObjectsTreeWalker
objects able to answer this invocation.- Author:
- mmoquillon
-
-
Constructor Summary
Constructors Constructor Description CmisObjectsTreeWalkerDelegator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CmisObject
createChildData(String folderId, CmisProperties properties, org.apache.chemistry.opencmis.commons.data.ContentStream contentStream, String language)
Creates into the specified CMIS folder a newCmisObject
child from the specified CMIS data properties and in the given language.org.apache.chemistry.opencmis.commons.data.ObjectInFolderList
getChildrenData(String folderId, Filtering filtering, Paging paging)
Gets a list of CMIS data of the Silverpeas objects that are children of the CMIS folder uniquely identified by the specified identifier.org.apache.chemistry.opencmis.commons.data.ContentStream
getContentStream(String objectId, String language, long offset, long length)
Gets a stream on the content of the specified object, starting at the given offset position and upto the given length.CmisObject
getObjectData(String objectId, Filtering filtering)
Gets the CMIS data of the Silverpeas object uniquely identified by the specified identifier.CmisFile
getObjectDataByPath(String path, Filtering filtering)
Gets the CMIS data of the Silverpeas object that is located at the specified path in the CMIS objects tree.List<org.apache.chemistry.opencmis.commons.data.ObjectParentData>
getParentsData(String objectId, Filtering filtering)
Gets a list of the CMIS data of the Silverpeas objects that are the direct parents of the CMIS object uniquely identified by the specified identifier.List<org.apache.chemistry.opencmis.commons.data.ObjectInFolderContainer>
getSubTreeData(String folderId, Filtering filtering, long depth)
Gets the CMIS objects subtree rooted to the CMIS folder uniquely identified by the specified identifier.CmisObject
updateObjectData(String objectId, CmisProperties properties, org.apache.chemistry.opencmis.commons.data.ContentStream contentStream, String language)
Updates the specified CMIS object from the specified CMIS data properties and in the given language.
-
-
-
Method Detail
-
createChildData
public CmisObject createChildData(String folderId, CmisProperties properties, org.apache.chemistry.opencmis.commons.data.ContentStream contentStream, String language)
Description copied from interface:CmisObjectsTreeWalker
Creates into the specified CMIS folder a newCmisObject
child from the specified CMIS data properties and in the given language. If the child is a document then the content stream must be not null, otherwise, for any other object types, it is ignored even if it is set. The type of the child to create is provided by thePropertyIds.OBJECT_TYPE_ID
property.If the content stream isn't set whereas the object to create is a document, then a
CmisConstraintException
is thrown.If the content stream is set whereas the object to create isn't a document, it is simply ignored.
If an error occurs while registering the content from the specified content stream, then a
CmisStorageException
is thrown.- Specified by:
createChildData
in interfaceCmisObjectsTreeWalker
- Parameters:
folderId
- the unique identifier of a folder in the CMIS objects tree.properties
- the CMIS properties of the child to create.contentStream
- a stream on a content from which a document has to be created.language
- the ISO 639-1 code of the language in which the textual properties of the object as well as the content (if any) are expressed.- Returns:
- the created
CmisObject
object corresponding to the given CMIS properties.
-
updateObjectData
public CmisObject updateObjectData(String objectId, CmisProperties properties, org.apache.chemistry.opencmis.commons.data.ContentStream contentStream, String language)
Description copied from interface:CmisObjectsTreeWalker
Updates the specified CMIS object from the specified CMIS data properties and in the given language. If the object is a document then the content stream must be not null, otherwise, for any other object types, it is ignored even if it is set.If the content stream isn't set whereas the object to create is a document, then a
CmisConstraintException
is thrown.If the content stream is set whereas the object to create isn't a document, it is simply ignored.
If an error occurs while registering the content from the specified content stream, then a
CmisStorageException
is thrown.- Specified by:
updateObjectData
in interfaceCmisObjectsTreeWalker
- Parameters:
objectId
- the unique identifier of an object in the CMIS objects tree.properties
- the CMIS properties of the object to update.contentStream
- a stream on a content from which a document has to be updated.language
- the ISO 639-1 code of the language in which the textual properties of the object as well as the content (if any) are expressed.- Returns:
- the updated
CmisObject
object corresponding to the given CMIS properties.
-
getObjectData
public CmisObject getObjectData(String objectId, Filtering filtering)
Description copied from interface:CmisObjectsTreeWalker
Gets the CMIS data of the Silverpeas object uniquely identified by the specified identifier. Only the data satisfying the given filtering rules are returned.- Specified by:
getObjectData
in interfaceCmisObjectsTreeWalker
- Parameters:
objectId
- the unique identifier of a Silverpeas object.filtering
- the filtering rules to apply on the data.- Returns:
- a
CmisObject
instance that provides the CMIS data of the specified Silverpeas object.
-
getObjectDataByPath
public CmisFile getObjectDataByPath(String path, Filtering filtering)
Description copied from interface:CmisObjectsTreeWalker
Gets the CMIS data of the Silverpeas object that is located at the specified path in the CMIS objects tree. Only the data satisfying the given filtering rules are returned. The root of the CMIS objects tree is theCmisFilePath.PATH_SEPARATOR
.- Specified by:
getObjectDataByPath
in interfaceCmisObjectsTreeWalker
- Parameters:
path
- the path of the object in Silverpeas to get.filtering
- the filtering rules to apply on the data.- Returns:
- an
ObjectData
instance that provides the CMIS data of the specified Silverpeas object.
-
getParentsData
public List<org.apache.chemistry.opencmis.commons.data.ObjectParentData> getParentsData(String objectId, Filtering filtering)
Description copied from interface:CmisObjectsTreeWalker
Gets a list of the CMIS data of the Silverpeas objects that are the direct parents of the CMIS object uniquely identified by the specified identifier. Only the data satisfying the given filtering rules are returned. A file-able CMIS object can have one or more parents but in Silverpeas, only publications in an EDM can have more than one parent (through the aliasing mechanism), so unless the object referred by the specified identifier is an aliased publication, this method returns usually a list with one element.- Specified by:
getParentsData
in interfaceCmisObjectsTreeWalker
- Parameters:
objectId
- the unique identifier of a Silverpeas resource or contribution.filtering
- the filtering rules to apply on the CMIS data to return.- Returns:
- a list of
ObjectParentData
elements, each of them being a wrapper of anObjectData
instance with the path of the specified object relative to this parent. The CMIS data are carried by theObjectData
object. If the specified object isn't file-able or it is the root folder (the virtual root space in Silverpeas), then an empty list is returned.
-
getChildrenData
public org.apache.chemistry.opencmis.commons.data.ObjectInFolderList getChildrenData(String folderId, Filtering filtering, Paging paging)
Description copied from interface:CmisObjectsTreeWalker
Gets a list of CMIS data of the Silverpeas objects that are children of the CMIS folder uniquely identified by the specified identifier. The CMIS folder represents a Silverpeas resource that is a container of others Silverpeas resources (space, component instance, ...). If this method is invoked for a document instead of a folder, then an emptyObjectInFolderList
list should be returned.- Specified by:
getChildrenData
in interfaceCmisObjectsTreeWalker
- Parameters:
folderId
- the unique identifier of a Silverpeas resource.filtering
- the filtering rules to apply on the CMIS data to return.paging
- the paging to apply on the elements of the list.- Returns:
- an
ObjectInFolderList
instance that is a list ofObjectInFolderData
elements, each of them being a decorator of anObjectData
instance with its path in the CMIS repository tree (if asked by the filtering). The CMIS data are carried by theObjectData
object. If the folder has no children, then an emptyObjectInFolderList
instance is returned.
-
getSubTreeData
public List<org.apache.chemistry.opencmis.commons.data.ObjectInFolderContainer> getSubTreeData(String folderId, Filtering filtering, long depth)
Description copied from interface:CmisObjectsTreeWalker
Gets the CMIS objects subtree rooted to the CMIS folder uniquely identified by the specified identifier. The CMIS folder represents a Silverpeas resource that is a container of others Silverpeas resources (space, component instance, ...). A list of the direct children of the folder (ObjectInFolderContainer
instances) is returned with, for each of them, if any, their own direct children and so on. Each child is described by their CMIS data (a decoratorObjectInFolderData
of anObjectData
instance) filtered with the given filtering rules. If this method is invoked for a document instead of a folder, then an empty list should be returned.- Specified by:
getSubTreeData
in interfaceCmisObjectsTreeWalker
- Parameters:
folderId
- the unique identifier of a Silverpeas resource.filtering
- the filtering rules to apply on the CMIS data to return.depth
- the maximum depth of the subtree to return from the specified folder. If -1, the subtree will contain all the descendents at all depth levels. If 0, nothing. If 1, only the direct children. If greater than 1 only children of the folder and descendants up to the given levels deep. Any other values throws anIllegalArgumentException
error.- Returns:
- a list of
ObjectInFolderContainer
elements (the direct children), each of them being a container of othersObjectInFolderContainer
objects (recursive walk of children) and described by anObjectInFolderData
instance that is a decorator of anObjectData
instance (the CMIS data) with its path in the CMIS repository tree (if asked by the filtering). The CMIS data are carried by theObjectData
object. If the folder has no children, then an empty list is returned.
-
getContentStream
public org.apache.chemistry.opencmis.commons.data.ContentStream getContentStream(String objectId, String language, long offset, long length)
Description copied from interface:CmisObjectsTreeWalker
Gets a stream on the content of the specified object, starting at the given offset position and upto the given length.- Specified by:
getContentStream
in interfaceCmisObjectsTreeWalker
- Parameters:
objectId
- the unique identifier of the object in the CMIS objects tree.language
- the ISO 639-1 code of the language of the content to fetch. If no content exists in the specified language, then it is the content for the first language found that will be returned (seeI18n.getSupportedLanguages()
).offset
- the position in bytes in the content to start the stream.length
- the length in bytes of the stream, id est the length of the content to read by the stream.- Returns:
- a
ContentStream
instance.
-
-