Class JCRDocumentsUtil

java.lang.Object
org.exoplatform.documents.storage.jcr.util.JCRDocumentsUtil

public class JCRDocumentsUtil extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
     
    static final String
     
    protected static final Map<org.exoplatform.documents.constant.DocumentSortField,String>
     
    protected static final Map<org.exoplatform.documents.constant.DocumentSortField,String>
     
    static final String
     
    static final String
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
     
    static String
    cleanName(String oldName)
    Clean string.
    static String
    cleanName(String oldName, String nodeType)
     
    static String
    cleanNameWithAccents(String fileName, String nodeType)
     
    static void
    computeDocumentAcl(javax.jcr.Node node, org.exoplatform.documents.model.AbstractNode documentNode, org.exoplatform.services.security.Identity aclIdentity, org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.social.core.space.spi.SpaceService spaceService)
     
    static long
    computeVersionsSize(javax.jcr.Node node)
     
    static void
    createFile(javax.jcr.Node node, String symlinkPath, String sourcePath, String tempFolderPath, String parentPath)
     
    static void
    createTempFilesAndFolders(javax.jcr.Node node, String symlinkPath, String sourcePath, String tempFolderPath, String parentPath)
     
    static String
    getFolderLink(javax.jcr.Node node, org.exoplatform.social.core.space.model.Space space)
     
    static javax.jcr.Node
    getGroupNode(org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator nodeHierarchyCreator, javax.jcr.Session session, String groupId)
     
    static String
    getGroupsPath(org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator nodeHierarchyCreator)
     
    static javax.jcr.Node
    getIdentityRootNode(org.exoplatform.social.core.space.spi.SpaceService spaceService, org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator nodeHierarchyCreator, String username, org.exoplatform.social.core.identity.model.Identity ownerIdentity, org.exoplatform.services.jcr.ext.common.SessionProvider sessionProvider)
     
    static javax.jcr.Node
    getIdentityRootNode(org.exoplatform.social.core.space.spi.SpaceService spaceService, org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator nodeHierarchyCreator, org.exoplatform.social.core.identity.model.Identity ownerIdentity, javax.jcr.Session session)
     
    static String
    getMimeType(javax.jcr.Node node)
     
    static String
    getNewIndexedName(String exoTitle, String newNameSuffix)
     
    static javax.jcr.Node
    getNode(javax.jcr.Session session, org.exoplatform.documents.model.FileNode fileNode, DocumentFileSearchResult fileSearchResult)
     
    static javax.jcr.Node
    getNodeById(javax.jcr.Session session, String nodeId)
     
    static javax.jcr.Node
    getNodeByIdentifier(javax.jcr.Session session, String nodeId)
     
    static javax.jcr.Node
    getNodeByPath(javax.jcr.Session session, String nodePath)
     
    static org.exoplatform.social.core.identity.model.Identity
    getOwnerIdentityFromNodePath(String path, org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.social.core.space.spi.SpaceService spaceService)
     
    static String
    getSortDirection(org.exoplatform.documents.model.DocumentNodeFilter filter)
     
    static String
    getSortField(org.exoplatform.documents.model.DocumentNodeFilter filter, boolean isJcr)
     
    static long
    getUserIdentityId(org.exoplatform.social.core.manager.IdentityManager identityManager, String username)
     
    static org.exoplatform.services.jcr.ext.common.SessionProvider
    getUserSessionProvider(org.exoplatform.services.jcr.RepositoryService repositoryService, org.exoplatform.services.security.Identity aclIdentity)
     
    static org.exoplatform.social.core.identity.model.Identity
     
    static boolean
    hasEditPermission(javax.jcr.Session session, javax.jcr.Node node)
     
    static String
    increaseNameIndex(String origin, int count)
     
    static boolean
    isFolder(javax.jcr.Node node)
     
    static boolean
     
    static void
    retrieveFileContentProperties(javax.jcr.Node content, org.exoplatform.documents.model.FileNode fileNode)
     
    static void
    retrieveFileProperties(org.exoplatform.social.core.manager.IdentityManager identityManager, javax.jcr.Node node, org.exoplatform.services.security.Identity aclIdentity, org.exoplatform.documents.model.AbstractNode documentNode, org.exoplatform.social.core.space.spi.SpaceService spaceService)
     
    static void
    retrieveTrashElementProperties(javax.jcr.Node node, org.exoplatform.documents.model.TrashElementNode trashElementNode)
     
    static org.exoplatform.documents.model.DownloadItem
    toDownloadItem(javax.jcr.Node node)
     
    static org.exoplatform.documents.model.FileNode
    toFileNode(org.exoplatform.social.core.manager.IdentityManager identityManager, javax.jcr.Session session, org.exoplatform.services.security.Identity aclIdentity, SearchResult searchResult, org.exoplatform.social.core.space.spi.SpaceService spaceService)
     
    static org.exoplatform.documents.model.FileNode
    toFileNode(org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.services.security.Identity aclIdentity, javax.jcr.Node node, String sourceID, org.exoplatform.social.core.space.spi.SpaceService spaceService)
     
    static void
    toFileNode(org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.services.security.Identity aclIdentity, javax.jcr.Node node, org.exoplatform.documents.model.FileNode fileNode, org.exoplatform.social.core.space.spi.SpaceService spaceService)
     
    static List<org.exoplatform.documents.model.FileNode>
    toFileNodes(org.exoplatform.social.core.manager.IdentityManager identityManager, javax.jcr.NodeIterator nodeIterator, org.exoplatform.services.security.Identity aclIdentity, javax.jcr.Session session, org.exoplatform.social.core.space.spi.SpaceService spaceService, boolean includeHiddenFiles)
     
    static org.exoplatform.documents.model.FileVersion
    toFileVersion(javax.jcr.version.Version version, javax.jcr.Node node, org.exoplatform.social.core.manager.IdentityManager identityManager)
     
    static org.exoplatform.documents.model.FolderNode
    toFolderNode(org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.services.security.Identity aclIdentity, javax.jcr.Node node, String sourceID, org.exoplatform.social.core.space.spi.SpaceService spaceService)
     
    static List<org.exoplatform.documents.model.AbstractNode>
    toNodes(org.exoplatform.social.core.manager.IdentityManager identityManager, javax.jcr.Session session, javax.jcr.NodeIterator nodeIterator, org.exoplatform.services.security.Identity aclIdentity, org.exoplatform.social.core.space.spi.SpaceService spaceService, boolean includeHiddenFiles, org.exoplatform.documents.model.DocumentFolderFilter filter)
     
    static void
    zipFiles(String zipFilePath, String tempFolderPath)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • GROUPS_PATH_ALIAS

      public static final String GROUPS_PATH_ALIAS
      See Also:
    • DOCUMENTS_NODE

      public static final String DOCUMENTS_NODE
      See Also:
    • USER_PRIVATE_ROOT_NODE

      public static final String USER_PRIVATE_ROOT_NODE
      See Also:
    • USER_PUBLIC_ROOT_NODE

      public static final String USER_PUBLIC_ROOT_NODE
      See Also:
    • MIX_VERSIONABLE

      public static final String MIX_VERSIONABLE
      See Also:
    • SORT_FIELDS_ES_CORRESPONDING

      protected static final Map<org.exoplatform.documents.constant.DocumentSortField,String> SORT_FIELDS_ES_CORRESPONDING
    • SORT_FIELDS_JCR_CORRESPONDING

      protected static final Map<org.exoplatform.documents.constant.DocumentSortField,String> SORT_FIELDS_JCR_CORRESPONDING
  • Method Details

    • getGroupNode

      public static javax.jcr.Node getGroupNode(org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator nodeHierarchyCreator, javax.jcr.Session session, String groupId) throws javax.jcr.RepositoryException
      Throws:
      javax.jcr.RepositoryException
    • getGroupsPath

      public static String getGroupsPath(org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator nodeHierarchyCreator)
    • toFileNodes

      public static List<org.exoplatform.documents.model.FileNode> toFileNodes(org.exoplatform.social.core.manager.IdentityManager identityManager, javax.jcr.NodeIterator nodeIterator, org.exoplatform.services.security.Identity aclIdentity, javax.jcr.Session session, org.exoplatform.social.core.space.spi.SpaceService spaceService, boolean includeHiddenFiles) throws javax.jcr.RepositoryException
      Throws:
      javax.jcr.RepositoryException
    • toNodes

      public static List<org.exoplatform.documents.model.AbstractNode> toNodes(org.exoplatform.social.core.manager.IdentityManager identityManager, javax.jcr.Session session, javax.jcr.NodeIterator nodeIterator, org.exoplatform.services.security.Identity aclIdentity, org.exoplatform.social.core.space.spi.SpaceService spaceService, boolean includeHiddenFiles, org.exoplatform.documents.model.DocumentFolderFilter filter)
    • toFolderNode

      public static org.exoplatform.documents.model.FolderNode toFolderNode(org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.services.security.Identity aclIdentity, javax.jcr.Node node, String sourceID, org.exoplatform.social.core.space.spi.SpaceService spaceService)
    • toFileNode

      public static org.exoplatform.documents.model.FileNode toFileNode(org.exoplatform.social.core.manager.IdentityManager identityManager, javax.jcr.Session session, org.exoplatform.services.security.Identity aclIdentity, SearchResult searchResult, org.exoplatform.social.core.space.spi.SpaceService spaceService)
    • toFileNode

      public static org.exoplatform.documents.model.FileNode toFileNode(org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.services.security.Identity aclIdentity, javax.jcr.Node node, String sourceID, org.exoplatform.social.core.space.spi.SpaceService spaceService)
    • toFileNode

      public static void toFileNode(org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.services.security.Identity aclIdentity, javax.jcr.Node node, org.exoplatform.documents.model.FileNode fileNode, org.exoplatform.social.core.space.spi.SpaceService spaceService)
    • getNode

      public static javax.jcr.Node getNode(javax.jcr.Session session, org.exoplatform.documents.model.FileNode fileNode, DocumentFileSearchResult fileSearchResult) throws javax.jcr.RepositoryException
      Throws:
      javax.jcr.RepositoryException
    • retrieveFileProperties

      public static void retrieveFileProperties(org.exoplatform.social.core.manager.IdentityManager identityManager, javax.jcr.Node node, org.exoplatform.services.security.Identity aclIdentity, org.exoplatform.documents.model.AbstractNode documentNode, org.exoplatform.social.core.space.spi.SpaceService spaceService) throws javax.jcr.RepositoryException
      Throws:
      javax.jcr.RepositoryException
    • retrieveFileContentProperties

      public static void retrieveFileContentProperties(javax.jcr.Node content, org.exoplatform.documents.model.FileNode fileNode) throws javax.jcr.RepositoryException
      Throws:
      javax.jcr.RepositoryException
    • computeVersionsSize

      public static long computeVersionsSize(javax.jcr.Node node)
    • computeDocumentAcl

      public static void computeDocumentAcl(javax.jcr.Node node, org.exoplatform.documents.model.AbstractNode documentNode, org.exoplatform.services.security.Identity aclIdentity, org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.social.core.space.spi.SpaceService spaceService) throws javax.jcr.RepositoryException
      Throws:
      javax.jcr.RepositoryException
    • getNodeByIdentifier

      public static javax.jcr.Node getNodeByIdentifier(javax.jcr.Session session, String nodeId)
    • getNodeById

      public static javax.jcr.Node getNodeById(javax.jcr.Session session, String nodeId)
    • getNodeByPath

      public static javax.jcr.Node getNodeByPath(javax.jcr.Session session, String nodePath)
    • getIdentityRootNode

      public static javax.jcr.Node getIdentityRootNode(org.exoplatform.social.core.space.spi.SpaceService spaceService, org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator nodeHierarchyCreator, String username, org.exoplatform.social.core.identity.model.Identity ownerIdentity, org.exoplatform.services.jcr.ext.common.SessionProvider sessionProvider) throws Exception
      Throws:
      Exception
    • getIdentityRootNode

      public static javax.jcr.Node getIdentityRootNode(org.exoplatform.social.core.space.spi.SpaceService spaceService, org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator nodeHierarchyCreator, org.exoplatform.social.core.identity.model.Identity ownerIdentity, javax.jcr.Session session) throws Exception
      Throws:
      Exception
    • getSortDirection

      public static String getSortDirection(org.exoplatform.documents.model.DocumentNodeFilter filter)
    • getSortField

      public static String getSortField(org.exoplatform.documents.model.DocumentNodeFilter filter, boolean isJcr)
    • getUserSessionProvider

      public static org.exoplatform.services.jcr.ext.common.SessionProvider getUserSessionProvider(org.exoplatform.services.jcr.RepositoryService repositoryService, org.exoplatform.services.security.Identity aclIdentity)
    • getUserIdentityId

      public static long getUserIdentityId(org.exoplatform.social.core.manager.IdentityManager identityManager, String username)
    • cleanName

      public static String cleanName(String oldName)
      Clean string.
      Parameters:
      oldName - the str
      Returns:
      the string
    • cleanName

      public static String cleanName(String oldName, String nodeType)
    • cleanNameWithAccents

      public static String cleanNameWithAccents(String fileName, String nodeType)
    • isValidDocumentTitle

      public static boolean isValidDocumentTitle(String name)
    • getMimeType

      public static String getMimeType(javax.jcr.Node node)
    • getOwnerIdentityFromNodePath

      public static org.exoplatform.social.core.identity.model.Identity getOwnerIdentityFromNodePath(String path, org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.social.core.space.spi.SpaceService spaceService)
    • toFileVersion

      public static org.exoplatform.documents.model.FileVersion toFileVersion(javax.jcr.version.Version version, javax.jcr.Node node, org.exoplatform.social.core.manager.IdentityManager identityManager) throws javax.jcr.RepositoryException
      Throws:
      javax.jcr.RepositoryException
    • increaseNameIndex

      public static String increaseNameIndex(String origin, int count)
    • getNewIndexedName

      public static String getNewIndexedName(String exoTitle, String newNameSuffix)
    • isFolder

      public static boolean isFolder(javax.jcr.Node node) throws javax.jcr.RepositoryException
      Throws:
      javax.jcr.RepositoryException
    • hasEditPermission

      public static boolean hasEditPermission(javax.jcr.Session session, javax.jcr.Node node)
    • groupToIdentity

      public static org.exoplatform.social.core.identity.model.Identity groupToIdentity(String groupId)
    • toDownloadItem

      public static org.exoplatform.documents.model.DownloadItem toDownloadItem(javax.jcr.Node node) throws Exception
      Throws:
      Exception
    • createFile

      public static void createFile(javax.jcr.Node node, String symlinkPath, String sourcePath, String tempFolderPath, String parentPath) throws javax.jcr.RepositoryException, IOException
      Throws:
      javax.jcr.RepositoryException
      IOException
    • createTempFilesAndFolders

      public static void createTempFilesAndFolders(javax.jcr.Node node, String symlinkPath, String sourcePath, String tempFolderPath, String parentPath) throws Exception
      Throws:
      Exception
    • cleanFiles

      public static void cleanFiles(File file)
    • zipFiles

      public static void zipFiles(String zipFilePath, String tempFolderPath) throws Exception
      Throws:
      Exception
    • getFolderLink

      public static String getFolderLink(javax.jcr.Node node, org.exoplatform.social.core.space.model.Space space) throws javax.jcr.RepositoryException
      Throws:
      javax.jcr.RepositoryException
    • retrieveTrashElementProperties

      public static void retrieveTrashElementProperties(javax.jcr.Node node, org.exoplatform.documents.model.TrashElementNode trashElementNode) throws javax.jcr.RepositoryException
      Throws:
      javax.jcr.RepositoryException