Class 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
    • 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.
    • Constructor Detail

      • SilverpeasCmisRepository

        public SilverpeasCmisRepository()
    • 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) if true the repository MUST return the property definitions for each object type returned (default is false)
        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 folder
        filter - (optional) a comma-separated list of query names that defines which properties must be returned by the repository (default is repository specific)
        includeAllowableActions - (optional) if true, then the repository must return the available actions for each object in the result set (default is false)
        includeRelationships - (optional) indicates what relationships in which the objects participate must be returned (default is IncludeRelationships.NONE)
        includePathSegment - (optional) if true, returns a path segment for each child object for use in constructing that object's path (default is false)
        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 with getDescendants(String, BigInteger, String, Boolean, IncludeRelationships, Boolean) is that this method returns only folders and not documents.
        Parameters:
        folderId - the identifier for the folder
        depth - the number of levels of depth in the folder hierarchy from which to return results
        filter - (optional) a comma-separated list of query names that defines which properties must be returned by the repository (default is repository specific)
        includeAllowableActions - (optional) if true, then the repository must return the available actions for each object in the result set (default is false)
        includeRelationships - (optional) indicates what relationships in which the objects participate must be returned (default is IncludeRelationships.NONE)
        includePathSegment - (optional) if true, returns a path segment for each child object for use in constructing that object's path (default is false)
        Returns:
        the folder tree. Each descendent carried by the ObjectInFolderData objects in the listed containers is a CmisFolder 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 object
        filter - (optional) a comma-separated list of query names that defines which properties must be returned by the repository (default is repository specific)
        includeAllowableActions - (optional) if true, then the repository must return the available actions for each object in the result set (default is false)
        includeRelativePathSegment - (optional) if true, returns a relative path segment for each parent object for use in constructing that object's path (default is false)
        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 object
        filter - (optional) a comma-separated list of query names that defines which properties must be returned by the repository (default is repository specific)
        includeAllowableActions - (optional) if true, then the repository must return the allowable actions for the object (default is false)
        includeRelationships - (optional) indicates what relationships in which the object participates must be returned (default is IncludeRelationships.NONE)
        includeAcl - (optional) if true, then the repository must return the ACL for the object (default is false)
        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 object
        filter - (optional) a comma-separated list of query names that defines which properties must be returned by the repository (default is repository specific)
        includeAllowableActions - (optional) if true, then the repository must return the allowable actions for the object (default is false)
        includeRelationships - (optional) indicates what relationships in which the object participates must be returned (default is IncludeRelationships.NONE)
        includeAcl - (optional) if true, then the repository must return the ACL for the object (default is false)
        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 object
        offset - 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 a CmisNotSupportedException exception is thrown.
        Parameters:
        properties - the property values that must be applied to the newly created folder object
        parentId - 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 object
        folderId - the identifier for the parent folder
        stream - 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 in contentStream is consumed but not closed by this method.
        Parameters:
        documentId - the identifier for the document.
        overwrite - If true, then the repository must replace the existing content stream for the object (if any) with the input content stream. If false, then the repository must only set the input content stream for the object if the object currently does not have a content stream (default is true)
        contentStream - the stream on the document's content. The stream is consumed but not closed by this method.