Package org.silverpeas.cmis.walkers
Class TreeWalkerForSimpleDocument
- java.lang.Object
-
- org.silverpeas.cmis.walkers.AbstractCmisObjectsTreeWalker
-
- org.silverpeas.cmis.walkers.TreeWalkerForSimpleDocument
-
- All Implemented Interfaces:
CmisObjectsTreeWalker
,CmisFilePath
@Service @Singleton public class TreeWalkerForSimpleDocument extends AbstractCmisObjectsTreeWalker
ACmisObjectsTreeWalker
object that knows how to walk down the subtree rooted to an attachment of a contribution in a given Silverpeas application. The attachment is here implemented by theSimpleDocument
class that is a localized contribution referring a document file in the filesystem of Silverpeas. The document is expected to be attached either to a folder or to a publication in the CMIS objects tree.- Author:
- mmoquillon
-
-
Field Summary
-
Fields inherited from interface org.silverpeas.core.cmis.model.CmisFilePath
PATH_SEPARATOR
-
-
Constructor Summary
Constructors Constructor Description TreeWalkerForSimpleDocument()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.apache.chemistry.opencmis.commons.data.ObjectInFolderList
browseObjectsInFolder(LocalizedResource object, Filtering filtering, Paging paging)
Browses for the direct children in the CMIS folder represented by the specified Silverpeas object. the browsing of children depends on the type of the specified object in Silverpeas and it is then delegated to the walker that knows how to browse for children such an object.protected List<org.apache.chemistry.opencmis.commons.data.ObjectInFolderContainer>
browseObjectsInFolderTree(LocalizedResource object, Filtering filtering, long depth)
Browses for the objects in the CMIS tree rooted at the specified object in Silverpeas.protected List<org.apache.chemistry.opencmis.commons.data.ObjectParentData>
browseParentsOfObject(LocalizedResource object, Filtering filtering)
Browses for the parents in the CMIS objects tree of the specified Silverpeas object.protected CmisObject
createObjectData(CmisProperties properties, org.apache.chemistry.opencmis.commons.data.ContentStream contentStream, String language)
Creates a newCmisObject
instance from the specified CMIS data properties and in the given language.protected DocumentFile
encodeToCmisObject(LocalizedResource resource, String language)
Encodes the specified Silverpeas object into its CMIS counterpart.protected Stream<LocalizedResource>
getAllowedChildrenOfSilverpeasObject(ResourceIdentifier parentId, User user)
Gets in Silverpeas all the children objects of the specified parent and that are accessible to the given user.protected org.apache.chemistry.opencmis.commons.data.ContentStream
getContentStream(LocalizedResource object, String language, long offset, long length)
protected Document
getSilverpeasObjectById(String objectId)
Gets in Silverpeas the object identified by the specified unique identifier.protected boolean
isObjectSupported(String objectId)
Is the object with the specified identifier supported by this walker?protected boolean
isTypeSupported(TypeId typeId)
Is the specified CMIS type supported by this walker?protected CmisObject
updateObjectData(LocalizedResource object, CmisProperties properties, org.apache.chemistry.opencmis.commons.data.ContentStream contentStream, String language)
Updates the specified Silverpeas object with the given CMIS properties and content stream, and for the given language.-
Methods inherited from class org.silverpeas.cmis.walkers.AbstractCmisObjectsTreeWalker
browseObjectsInFolderSubTrees, buildObjectInFolderContainer, buildObjectInFolderData, buildObjectInFolderList, buildObjectParentData, createChildData, getChildrenData, getCmisObject, getContentStream, getController, getObjectData, getObjectDataByPath, getObjectFactory, getParentsData, getSubTreeData, getTreeWalkerSelector, prepareChildDataCreation, setObjectDataFields, updateObjectData
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.silverpeas.core.cmis.model.CmisFilePath
toString
-
-
-
-
Method Detail
-
createObjectData
protected CmisObject createObjectData(CmisProperties properties, org.apache.chemistry.opencmis.commons.data.ContentStream contentStream, String language)
Description copied from class:AbstractCmisObjectsTreeWalker
Creates a newCmisObject
instance from the specified CMIS data properties and in the given language. This method is called by theAbstractCmisObjectsTreeWalker.createChildData(String, CmisProperties, ContentStream, String)
method after the CMIS properties and content stream has been prepared by the walker in charge of the object parent of the child to create. By default, this method throws theCmisNotSupportedException
exception.- Overrides:
createObjectData
in classAbstractCmisObjectsTreeWalker
- Parameters:
properties
- the CMIS properties of the object to create.contentStream
- a stream on a content from which a document has to be created. If not a document, can be null.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. - See Also:
AbstractCmisObjectsTreeWalker.createChildData(String, CmisProperties, ContentStream, String)
-
getContentStream
protected org.apache.chemistry.opencmis.commons.data.ContentStream getContentStream(LocalizedResource object, String language, long offset, long length)
- Overrides:
getContentStream
in classAbstractCmisObjectsTreeWalker
-
updateObjectData
protected CmisObject updateObjectData(LocalizedResource object, CmisProperties properties, org.apache.chemistry.opencmis.commons.data.ContentStream contentStream, String language)
Description copied from class:AbstractCmisObjectsTreeWalker
Updates the specified Silverpeas object with the given CMIS properties and content stream, and for the given language. This method is invoked by theAbstractCmisObjectsTreeWalker.updateObjectData(String, CmisProperties, ContentStream, String)
method to effectively perform the update. By default, this method throws theCmisNotSupportedException
exception.- Overrides:
updateObjectData
in classAbstractCmisObjectsTreeWalker
- Parameters:
object
- the Silverpeas object to update.properties
- the CMIS properties that contain the data with which the object has to be updated.contentStream
- a stream on a content with which the content of the object has to be updated. It can be null if the object has no content or if the content hasn't 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 created
CmisObject
object corresponding to the given CMIS properties.
-
getSilverpeasObjectById
protected Document getSilverpeasObjectById(String objectId)
Description copied from class:AbstractCmisObjectsTreeWalker
Gets in Silverpeas the object identified by the specified unique identifier. The way how to get such an object depends on its type and it is then delegated to the walker that handles such a type of Silverpeas objects.- Specified by:
getSilverpeasObjectById
in classAbstractCmisObjectsTreeWalker
- Parameters:
objectId
- the unique identifier of an object in Silverpeas.- Returns:
- a Silverpeas object or null if no such object exists.
-
getAllowedChildrenOfSilverpeasObject
protected Stream<LocalizedResource> getAllowedChildrenOfSilverpeasObject(ResourceIdentifier parentId, User user)
Description copied from class:AbstractCmisObjectsTreeWalker
Gets in Silverpeas all the children objects of the specified parent and that are accessible to the given user. The way how to get such an object depends on its type and it is then delegated to the walker that handles such a type of Silverpeas objects.- Specified by:
getAllowedChildrenOfSilverpeasObject
in classAbstractCmisObjectsTreeWalker
- Parameters:
parentId
- the unique identifier of the parent in Silverpeas.user
- the user for which the children are get.- Returns:
- a stream over all the allowed children of the specified parent in Silverpeas.
-
encodeToCmisObject
protected DocumentFile encodeToCmisObject(LocalizedResource resource, String language)
Description copied from class:AbstractCmisObjectsTreeWalker
Encodes the specified Silverpeas object into its CMIS counterpart. The CMIS representation depends on the concrete type of the Silverpeas object. The way how create such a CMIS object depends on the type of the Silverpeas object and it is then delegated to the walker that handles such a type of Silverpeas objects.- Specified by:
encodeToCmisObject
in classAbstractCmisObjectsTreeWalker
- Parameters:
resource
- a localized resource in Silverpeas.language
- the language to use in the localization of the CMIS object.- Returns:
- a
CmisObject
instance.
-
isObjectSupported
protected boolean isObjectSupported(String objectId)
Description copied from class:AbstractCmisObjectsTreeWalker
Is the object with the specified identifier supported by this walker?- Specified by:
isObjectSupported
in classAbstractCmisObjectsTreeWalker
- Parameters:
objectId
- the unique identifier of an object.- Returns:
- true if the walker knows how to work with objects with such an identifier pattern. False otherwise.
-
isTypeSupported
protected boolean isTypeSupported(TypeId typeId)
Description copied from class:AbstractCmisObjectsTreeWalker
Is the specified CMIS type supported by this walker?- Specified by:
isTypeSupported
in classAbstractCmisObjectsTreeWalker
- Parameters:
typeId
- the unique identifier of a CMIS type.- Returns:
- true if the walker knows how to work with objects of the specified CMIS type. False otherwise.
-
browseObjectsInFolderTree
protected List<org.apache.chemistry.opencmis.commons.data.ObjectInFolderContainer> browseObjectsInFolderTree(LocalizedResource object, Filtering filtering, long depth)
Description copied from class:AbstractCmisObjectsTreeWalker
Browses for the objects in the CMIS tree rooted at the specified object in Silverpeas. The browsing depends on the type of the specified object in Silverpeas and it is then delegated to the walker that knows how to browse a tree rooted at such a tree.- Specified by:
browseObjectsInFolderTree
in classAbstractCmisObjectsTreeWalker
- Parameters:
object
- an identifiable object in Silverpeas.filtering
- the filtering rules to apply on the CMIS data to return.depth
- the depth of the browsing of the tree.- Returns:
- a list of
ObjectInFolderContainer
elements (the direct children), each of them being a container of othersObjectInFolderContainer
objects (recursive walk of the different tree's nodes) 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.
-
browseObjectsInFolder
protected org.apache.chemistry.opencmis.commons.data.ObjectInFolderList browseObjectsInFolder(LocalizedResource object, Filtering filtering, Paging paging)
Description copied from class:AbstractCmisObjectsTreeWalker
Browses for the direct children in the CMIS folder represented by the specified Silverpeas object. the browsing of children depends on the type of the specified object in Silverpeas and it is then delegated to the walker that knows how to browse for children such an object.- Specified by:
browseObjectsInFolder
in classAbstractCmisObjectsTreeWalker
- Parameters:
object
- an identifiable object in Silverpeas.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.
-
browseParentsOfObject
protected List<org.apache.chemistry.opencmis.commons.data.ObjectParentData> browseParentsOfObject(LocalizedResource object, Filtering filtering)
Description copied from class:AbstractCmisObjectsTreeWalker
Browses for the parents in the CMIS objects tree of the specified Silverpeas object. In a CMIS objects tree, a child can have direct one or several parents. This method returns all of them. However, as the browsing of the CMIS objects tree depends on the type of its node and hence on the type of the objects in Silverpeas, the browsing is delegated to the walker that knows how to handle such a Silverpeas object.- Specified by:
browseParentsOfObject
in classAbstractCmisObjectsTreeWalker
- Parameters:
object
- an identifiable object in Silverpeas.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.
-
-