Class TreeWalkerSelector


  • @Service
    @Singleton
    public class TreeWalkerSelector
    extends Object
    A selector of the correct AbstractCmisObjectsTreeWalker object to use for walking the subtree rooted to a node of a given type in the CMIS objects tree. The selector plays then the role of the delegator to the AbstractCmisObjectsTreeWalker object that knows how to handle the CMIS object (and hence the Silverpeas object mapped with it) that is implied in the method invocation.

    The CMIS objects tree is made up of branches whose nodes can be of several types. Each type provides to the node some properties like, for example, the types of nodes it can have as children. So, because walking the subtree rooted to a given node depends of the type of that node, it is required for each type of node to have a specific AbstractCmisObjectsTreeWalker object. The selector responsibility is to find this walker and then to delegate the method call to it.

    Author:
    mmoquillon
    • Constructor Detail

      • TreeWalkerSelector

        public TreeWalkerSelector()
    • Method Detail

      • selectByObjectIdOrFail

        protected AbstractCmisObjectsTreeWalker selectByObjectIdOrFail​(String objectId)
        Selects an instance of CmisObjectsTreeWalker that knows how to browse for and to handle the type of Silverpeas objects the format of the specified unique identifier is related to.
        Parameters:
        objectId - a unique identifier of a Silverpeas object.
        Returns:
        an instance of a concrete type of AbstractCmisObjectsTreeWalker that has the knowledge to handle the type of the Silverpeas objects referred by the format of the given identifier.
        Throws:
        org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException - if there is no CmisObjectsTreeWalker that supports the type og the objects the format of the given identifier is related to.
      • selectByObjectId

        protected Optional<AbstractCmisObjectsTreeWalker> selectByObjectId​(String objectId)
        Selects an instance of CmisObjectsTreeWalker that knows how to browse for and to handle the type of Silverpeas objects the format of the specified unique identifier is related to. If no such tree walker exists for the format matching by the given identifier, then nothing is returned.
        Parameters:
        objectId - a unique identifier of a Silverpeas object.
        Returns:
        either an instance of a concrete type of CmisObjectsTreeWalker that has the knowledge to handle the type of the Silverpeas objects referred by the format of the given identifier or nothing.
      • selectByObjectTypeId

        protected AbstractCmisObjectsTreeWalker selectByObjectTypeId​(TypeId typeId)
        Selects an instance of CmisObjectsTreeWalker that knows how to browse for and to handle the specified type of CMIS objects. It must exist a walker handling such a type otherwise a CmisRuntimeException is thrown to remind the developer this missing has to be fixed!
        Parameters:
        typeId - a unique identifier of a CMIS type.
        Returns:
        an instance of a concrete type of CmisObjectsTreeWalker that has the knowledge to handle the type of CMIS objects.