Class JCRDocumentsUtil
java.lang.Object
org.exoplatform.documents.storage.jcr.util.JCRDocumentsUtil
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcleanFiles(File file) static StringClean string.static Stringstatic StringcleanNameWithAccents(String fileName, String nodeType) static voidcomputeDocumentAcl(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 longcomputeVersionsSize(javax.jcr.Node node) static voidcreateFile(javax.jcr.Node node, String symlinkPath, String sourcePath, String tempFolderPath, javax.jcr.Node parentNode) static voidcreateTempFilesAndFolders(javax.jcr.Node node, String symlinkPath, String sourcePath, String tempFolderPath, String parentPath) Copies the tree under a node, following shortcuts to their targets, each one at its titles path (getPathWithTitles(Node)) lessparentPath, undertempFolderPath.static voidcreateTempFilesAndFolders(javax.jcr.Node node, String symlinkPath, String sourcePath, String tempFolderPath, javax.jcr.Node parentNode) static StringgetFolderLink(javax.jcr.Node node, org.exoplatform.social.core.space.model.Space space) static javax.jcr.NodegetGroupNode(org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator nodeHierarchyCreator, javax.jcr.Session session, String groupId) static StringgetGroupsPath(org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator nodeHierarchyCreator) static javax.jcr.NodegetIdentityRootNode(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.NodegetIdentityRootNode(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 longgetLastModifiedDate(javax.jcr.Node node) static StringgetLastModifier(javax.jcr.Node node) static StringgetLastModifierOrCreator(javax.jcr.Node node) static StringgetMimeType(javax.jcr.Node node) static StringgetNewIndexedName(String exoTitle, String newNameSuffix) static javax.jcr.NodegetNode(javax.jcr.Session session, org.exoplatform.documents.model.FileNode fileNode, DocumentFileSearchResult fileSearchResult) static javax.jcr.NodegetNodeById(javax.jcr.Session session, String nodeId) static javax.jcr.NodegetNodeByIdentifier(javax.jcr.Session session, String nodeId) static javax.jcr.NodegetNodeByPath(javax.jcr.Session session, String nodePath) static org.exoplatform.social.core.identity.model.IdentitygetOwnerIdentityFromNodePath(String path, org.exoplatform.social.core.manager.IdentityManager identityManager, org.exoplatform.social.core.space.spi.SpaceService spaceService) static StringgetPathWithTitles(javax.jcr.Node node) static StringgetSortDirection(org.exoplatform.documents.model.DocumentNodeFilter filter) static StringgetSortField(org.exoplatform.documents.model.DocumentNodeFilter filter, boolean isJcr) static StringgetTitle(javax.jcr.Node node) static longgetUserIdentityId(org.exoplatform.social.core.manager.IdentityManager identityManager, String username) static org.exoplatform.services.jcr.ext.common.SessionProvidergetUserSessionProvider(org.exoplatform.services.jcr.RepositoryService repositoryService, org.exoplatform.services.security.Identity aclIdentity) static Stringstatic org.exoplatform.social.core.identity.model.IdentitygroupToIdentity(String groupId) static booleanhasEditPermission(javax.jcr.Session session, javax.jcr.Node node) static StringincreaseNameIndex(String origin, int count) static booleanisFile(javax.jcr.Node node) static booleanisFolder(javax.jcr.Node node) static booleanisInUserPrivateSpace(javax.jcr.Node node, String username) Whether the node sits insideusername's own Personal Documents ("Private") space.static booleanisValidDocumentTitle(String name) static javax.jcr.SessionopenUserSession(org.exoplatform.services.jcr.RepositoryService repositoryService, org.exoplatform.services.security.Identity aclIdentity) Opens a session of the default workspace that carries the given identity, whatever the identity of the current thread.static voidretrieveFileContentProperties(javax.jcr.Node content, org.exoplatform.documents.model.FileNode fileNode) static voidretrieveFileProperties(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 voidretrieveTrashElementProperties(javax.jcr.Node node, org.exoplatform.documents.model.TrashElementNode trashElementNode) static org.exoplatform.documents.model.DownloadItemtoDownloadInfo(javax.jcr.Node node) Builds aDownloadItemholding the node's identifier, title and mime type, with no content: thejcr:dataproperty is neither read nor tested, whatever the document's size.static org.exoplatform.documents.model.DownloadItemtoDownloadItem(javax.jcr.Node node) static org.exoplatform.documents.model.FileNodetoFileNode(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.FileNodetoFileNode(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 voidtoFileNode(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.FileVersiontoFileVersion(javax.jcr.version.Version version, javax.jcr.Node node, org.exoplatform.social.core.manager.IdentityManager identityManager) static org.exoplatform.documents.model.FolderNodetoFolderNode(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
-
Field Details
-
GROUPS_PATH_ALIAS
- See Also:
-
USERS_PATH_ALIAS
- See Also:
-
DOCUMENTS_NODE
- See Also:
-
USER_PRIVATE_ROOT_NODE
- See Also:
-
USER_PUBLIC_ROOT_NODE
- See Also:
-
MIX_VERSIONABLE
- See Also:
-
SORT_FIELDS_ES_CORRESPONDING
-
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) -
getUsersPath
- Returns:
- the JCR path holding every user's home node, e.g.
/Users.
-
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
-
getLastModifiedDate
public static long getLastModifiedDate(javax.jcr.Node node) throws javax.jcr.RepositoryException - Throws:
javax.jcr.RepositoryException
-
getLastModifierOrCreator
public static String getLastModifierOrCreator(javax.jcr.Node node) throws javax.jcr.RepositoryException - Throws:
javax.jcr.RepositoryException
-
getLastModifier
- 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
-
getNodeById
-
getNodeByPath
-
isInUserPrivateSpace
public static boolean isInUserPrivateSpace(javax.jcr.Node node, String username) throws javax.jcr.RepositoryException Whether the node sits insideusername's own Personal Documents ("Private") space.Whoever owns the containing space must always be able to manage what is inside it, even a node whose own explicit ACL does not grant them
REMOVE/SET_PROPERTY— an ACE that never named the space's owner (e.g. a node created there on somebody else's behalf) must not outrank ownership of the space itself.- Parameters:
node- the node to checkusername- the user whose private space to check against- Returns:
- true when the node's path sits under that user's own Private root
- Throws:
javax.jcr.RepositoryException- if the node's path cannot be read
-
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
-
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) -
openUserSession
public static javax.jcr.Session openUserSession(org.exoplatform.services.jcr.RepositoryService repositoryService, org.exoplatform.services.security.Identity aclIdentity) throws javax.jcr.RepositoryException Opens a session of the default workspace that carries the given identity, whatever the identity of the current thread. A session ofgetUserSessionProvider(RepositoryService, Identity)carries the current thread's identity instead, the JCR login readingConversationState.getCurrent(): it is the given user's only on that user's own request. The caller logs the session out.- Parameters:
repositoryService- the repository serviceaclIdentity- the identity whose rights the session applies- Returns:
- the session
- Throws:
javax.jcr.RepositoryException- when the session cannot be opened
-
getUserIdentityId
public static long getUserIdentityId(org.exoplatform.social.core.manager.IdentityManager identityManager, String username) -
cleanName
-
cleanName
-
cleanNameWithAccents
-
isValidDocumentTitle
-
getMimeType
-
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
-
getNewIndexedName
-
isFolder
public static boolean isFolder(javax.jcr.Node node) throws javax.jcr.RepositoryException - Throws:
javax.jcr.RepositoryException
-
isFile
public static boolean isFile(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
-
toDownloadItem
-
toDownloadInfo
public static org.exoplatform.documents.model.DownloadItem toDownloadInfo(javax.jcr.Node node) throws javax.jcr.RepositoryException Builds aDownloadItemholding the node's identifier, title and mime type, with no content: thejcr:dataproperty is neither read nor tested, whatever the document's size.- Parameters:
node- the document node- Returns:
- the
DownloadItem, its content null, its mime type null for a node withoutjcr:content - Throws:
javax.jcr.RepositoryException- when a property cannot be read
-
createFile
public static void createFile(javax.jcr.Node node, String symlinkPath, String sourcePath, String tempFolderPath, javax.jcr.Node parentNode) throws javax.jcr.RepositoryException, IOException - Throws:
javax.jcr.RepositoryExceptionIOException
-
getPathWithTitles
-
createTempFilesAndFolders
-
createTempFilesAndFolders
public static void createTempFilesAndFolders(javax.jcr.Node node, String symlinkPath, String sourcePath, String tempFolderPath, String parentPath) throws Exception Copies the tree under a node, following shortcuts to their targets, each one at its titles path (getPathWithTitles(Node)) lessparentPath, undertempFolderPath.- Parameters:
parentPath- the titles path the walk strips from each node's: the parent's, or "" when the walking session cannot read the parent, the node's own titles path then starting at the node, with no leading separator- Throws:
Exception
-
cleanFiles
-
zipFiles
-
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
-
getTitle
- Throws:
javax.jcr.RepositoryException
-