public final class JCRContentUtils extends Object implements org.springframework.web.context.ServletContextAware
| Modifier and Type | Field and Description |
|---|---|
static Pattern |
COLON_PATTERN |
static Comparator<javax.jcr.nodetype.NodeType> |
NODE_TYPE_NAME_COMPARATOR |
| Constructor and Description |
|---|
JCRContentUtils(Map<String,List<String>> mimeTypes,
Map<String,String> fileExtensionIcons,
Map<String,String> defaultUserFolderTypes)
Initializes an instance of this class.
|
| Modifier and Type | Method and Description |
|---|---|
static int |
callDataStoreGarbageCollector()
Calls the datastore garbage collector and returns the number of data entries deleted.
|
static boolean |
check(String icon) |
static void |
clearAllLocks(String path,
boolean processChildNodes,
String workspace)
Removes all locks on the current node and optionally on its children.
|
static javax.jcr.Value |
createValue(Object objectValue,
javax.jcr.ValueFactory factory)
Creates the JCR property value, depending on the type of the corresponding value.
|
static javax.jcr.Value[] |
createValues(Collection<?> objectValues,
javax.jcr.ValueFactory factory)
Creates the JCR property values, depending on the type of the corresponding value.
|
static String |
decodeJCRNamePrefix(String encodedPrefix)
Reverse operation of encodeJCRNamePrefix.
|
static void |
deleteJackrabbitIndexes(File repositoryHome)
Can be used to delete the Jackrabbit indexes folders for version and workspaces to force re-indexing on the next repository startup.
|
static File |
downloadFileContent(JCRNodeWrapper node)
Downloads the JCR content to a temporary file.
|
static File |
downloadFileContent(JCRNodeWrapper node,
File targetFile)
Downloads the JCR content to a specified file.
|
static String |
encodeJCRNamePrefix(String originalPrefix)
Encode a JCR qualified form name prefix, according to the grammar defined in section 3.2.5.2
of the JCR 2.0 specification http://www.day.com/specs/jcr/2.0/3_Repository_Model.html#Names
Note : this is not yet complete as it depends on the restrictions imposed on XML namespaces as
defined here http://www.w3.org/TR/REC-xml-names/
|
static String |
escapeLocalNodeName(String name) |
static String |
escapeNodePath(String path) |
static String |
findAvailableNodeName(javax.jcr.Node dest,
String name)
Returns the next available name for a node, appending if needed numbers.
|
static String |
findAvailableNodeName(javax.jcr.Node dest,
String name,
boolean hasExtension)
Returns the next available name for a node, appending if needed numbers.
|
static JCRNodeWrapper |
findDisplayableNode(JCRNodeWrapper node,
RenderContext context) |
static JCRNodeWrapper |
findDisplayableNode(JCRNodeWrapper node,
RenderContext context,
JCRSiteNode contextSite) |
String |
generateNodeName(JCRNodeWrapper parent,
String nodeType)
Generates the node name by using a configurable NameGenerationHelper implementation.
|
String |
generateNodeName(JCRNodeWrapper parent,
String defaultLanguage,
ExtendedNodeType nodeType,
String targetName)
Generates the node name by using a configurable NameGenerationHelper implementation.
|
static String |
generateNodeName(String text) |
static String |
generateNodeName(String text,
int maxLength)
Generates the JCR node name from the provided text by normalizing it,
converting to lower case, replacing spaces with dashes and truncating to
$
maxLength characters. |
static Set<String> |
getAssignableMixins(JCRNodeWrapper node)
Returns a set of all mixin types, which can be added to the provided node.
|
static List<JCRNodeWrapper> |
getChildrenOfType(JCRNodeWrapper node,
String type)
Returns a list of child nodes of the provided node, matching the specified node type (multiple node types can be specified, separated
by a comma).
|
static List<JCRNodeWrapper> |
getChildrenOfType(JCRNodeWrapper node,
String type,
int limit) |
static String |
getContentNodeName(javax.jcr.Node node)
Returns a content object key for a node if available.
|
static String |
getContentObjectPath(javax.jcr.Node node)
Returns a node path, composed using only content object keys, i.e.
|
JCRNodeWrapper |
getDefaultUserFolder(JCRSessionWrapper session,
String path) |
JCRNodeWrapper |
getDefaultUserFolder(JCRSessionWrapper session,
String path,
boolean saveIfCreate)
Retrieves the default user folder found at the specified path, creating it (and all intermediate folders) if needed, saving the session if requested.
|
static javax.jcr.NodeIterator |
getDescendantNodes(JCRNodeWrapper node,
String type) |
static String |
getDisplayLabel(Object item,
Locale locale,
ExtendedNodeType nodeTypeForSearchingLabel)
Get the node or property display name depending on the locale
|
static String |
getExpandedName(String name,
javax.jcr.NamespaceRegistry namespaceRegistry) |
Map<String,String> |
getFileExtensionIcons()
Returns a mapping between file extensions and corresponding icons.
|
Pattern |
getHandleFallbackLocaleForPathPattern() |
static String |
getIcon(ExtendedNodeType type)
Returns the icon path for the specified type
|
static String |
getIcon(JCRNodeWrapper f) |
static String |
getIconsFolder(ExtendedNodeType primaryNodeType)
For a nodetype gets the folder that contains its icon
for system and module default nodetypes, icons asset folder is returned
|
static String |
getIconWithContext(ExtendedNodeType type) |
static String |
getIconWithContext(JCRNodeWrapper f,
boolean useContext) |
static JCRContentUtils |
getInstance() |
static String |
getJCRName(String qualifiedName,
javax.jcr.NamespaceRegistry namespaceRegistry) |
static JCRNodeLockType |
getLockType(String lockTypeToken)
Returns the parsed lock type from the provided token.
|
static Set<JCRNodeLockType> |
getLockTypes(Map<String,List<String>> lockInfos)
Returns a set of lock types for the current node.
|
static String |
getMimeType(String fileName)
Detects the mime-type for the specified file name, based on its extension (uses mime types, configured in the web.xml deployment
descriptor).
|
static String |
getMimeType(String fileName,
String fallbackMimeType)
Detects the mime-type for the specified file name, based on its extension (uses mime types, configured in the web.xml deployment
descriptor).
|
Map<String,List<String>> |
getMimeTypes()
Return a map of mime types (file formats) to be available in the
advanced search form.
|
static String |
getNameFromPath(String path)
Returns the last part of a path, so the last name.
|
NameGenerationHelper |
getNameGenerationHelper() |
static List<JCRNodeWrapper> |
getNodes(JCRNodeWrapper node,
String type) |
static List<JCRNodeWrapper> |
getNodes(JCRNodeWrapper node,
String type,
int limit) |
static JCRNodeWrapper |
getOrAddPath(JCRSessionWrapper session,
JCRNodeWrapper parentNode,
String path,
String pathNodeType)
Little utility method to retrieve or create a path, building it if necessary.
|
static String |
getParentJCRPath(String path)
A small utility method to retrieve the parent path of a path that contains expanded form names.
|
static JCRNodeWrapper |
getParentOfType(JCRNodeWrapper node,
String type) |
static JCRNodeWrapper |
getParentWithAclInheritanceBroken(JCRNodeWrapper node)
Returns the first parent of the specified node, which has the ACL inheritance broken.
|
static JCRNodeWrapper |
getPathFolder(JCRNodeWrapper root,
String name,
String options,
String nodeType) |
static javax.jcr.nodetype.PropertyDefinition |
getPropertyDefinition(javax.jcr.nodetype.NodeType type,
String property) |
static javax.jcr.nodetype.PropertyDefinition |
getPropertyDefinition(String nodeType,
String property) |
static int |
getPropertyDefSelector(javax.jcr.nodetype.ItemDefinition itemDef) |
static List<Map<String,Object>> |
getRolesForNode(JCRNodeWrapper node,
boolean includeInherited,
boolean expandGroups,
String roles,
int limit,
boolean latestFirst) |
static String |
getSiteKey(String jcrNodePath)
If the node path contains site information (i.e.
|
static String |
getSystemSitePath() |
Set<String> |
getUnsupportedMarkForDeletionNodeTypes() |
JCRNodeWrapper |
getUserPrivateFilesFolder(JCRSessionWrapper session)
Returns the /files/private folder for the current session user, creating it if it does not exist yet.
|
static Object |
getValue(javax.jcr.Value propertyValue)
Returns an object value that corresponds to the provided JCR property value depending on its type.
|
static boolean |
hasPermission(String workspaceName,
String permissionName,
String nodeUUID)
Used by portlet backends to determine if a user is part of a specific permissionName on a node specified by it's
UUID
|
static void |
importSkeletons(String skeletonLocations,
String targetPath,
JCRSessionWrapper session)
Performs import of JCR data using provided skeleton locations.
|
static void |
importSkeletons(String skeletonLocations,
String targetPath,
JCRSessionWrapper session,
int importUUIDBehavior,
Map<String,String> replacements)
Performs import of JCR data using provided skeleton locations.
|
static void |
importSkeletons(String skeletonLocations,
String targetPath,
JCRSessionWrapper session,
Map<String,String> replacements)
Performs import of JCR data using provided skeleton locations.
|
static boolean |
isADisplayableNode(JCRNodeWrapper node,
RenderContext context) |
static boolean |
isLanguageInvalid(javax.jcr.Node node,
String languageCode)
Checks if the specified language is marked as invalid for displaying.
|
static boolean |
isLockedAndCannotBeEdited(JCRNodeWrapper node)
Returns
true if the node is locked and cannot be edited by current user. |
static boolean |
isMimeTypeGroup(String mimeType,
String... mimeTypeGroups)
Checks if the specified mime type belongs to one of the specified groups (like pdf,word,openoffice, etc.).
|
static boolean |
isMimeTypeGroup(String mimeType,
String mimeTypeGroup)
Checks if the specified mime type belongs to one of the specified groups (like pdf,word,openoffice, etc.).
|
static boolean |
isNodeType(JCRNodeWrapper node,
Iterable<String> types)
Returns
true if the provided node matches one of the specified node types. |
static boolean |
isNodeType(JCRNodeWrapper node,
String... types)
Returns
true if the provided node matches one of the specified node types. |
static boolean |
isNodeType(JCRNodeWrapper node,
String type)
Returns
true if the provided node matches the specified node type (multiple node types can be specified, separated by a
comma). |
static boolean |
isNotJcrUuid(String uuid)
Deprecated.
without any replacement
|
static boolean |
isUserMemberOfGroup(String siteKey,
String groupName,
String userName,
String userRealm,
boolean isRoot)
Check if user is member of the given group
|
static boolean |
isValidFilename(String name) |
static boolean |
isValidWorkspace(String workspace)
Validates if the specified name is a valid JCR workspace (either
default or live). |
static boolean |
isValidWorkspace(String workspace,
boolean allowBlank)
Validates if the specified name is a valid JCR workspace (either
default or live). |
static boolean |
needVersion(JCRNodeWrapper node,
Set<String> versionedTypes)
this method checks if the node type is versionable from a jahia property
|
static void |
registerNamespace(javax.jcr.Session session,
String prefix,
String uri)
Small utility method to help with proper namespace registration in all JCR providers.
|
static String |
replaceColon(String name) |
static <T> Map<String,T> |
reverse(Map<String,T> orderedMap) |
void |
setHandleFallbackLocaleForPath(String handleFallbackLocaleForPath) |
void |
setNameGenerationHelper(NameGenerationHelper nameGenerationHelper) |
void |
setServletContext(javax.servlet.ServletContext servletContext) |
void |
setUnsupportedMarkForDeletionNodeTypes(Set<String> unsupportedMarkForDeletionNodeTypes) |
static long |
size(javax.jcr.RangeIterator iterator)
Returns the number of elements in the provided iterator.
|
static Set<String> |
splitAndUnify(String input,
String separator)
this method splits a String with a separator and put all its elements in a Set
|
static String[] |
splitJCRPath(String path)
Utility method to split a JCR path into names.
|
static String |
sqlEncode(String s)
Encode a string to be used in a JCR SQL2 query by "escaping" the single quotes.
|
static String |
stringToJCRPathExp(String str)
Convert a path string to encoded path Strings in XPATH queries
|
static String |
stringToJCRSearchExp(String str)
Convert a string to a JCR search expression literal, suitable for use in
jcr:contains() (inside XPath) or contains (SQL2).
|
static String |
stringToQueryLiteral(String str)
Convert a string to a literal, suitable for inclusion
in a query.
|
static String |
unescapeLocalNodeName(String encodedLocalName)
Decode an encoded JCR local name encoded with the
escapeLocalNodeName(String) method |
public static final Pattern COLON_PATTERN
public static final Comparator<javax.jcr.nodetype.NodeType> NODE_TYPE_NAME_COMPARATOR
public JCRContentUtils(Map<String,List<String>> mimeTypes, Map<String,String> fileExtensionIcons, Map<String,String> defaultUserFolderTypes)
mimeTypes - a map with mime type mappingsfileExtensionIcons - mapping between file extensions and corresponding iconspublic static JCRContentUtils getInstance()
public static int callDataStoreGarbageCollector()
throws javax.jcr.RepositoryException
javax.jcr.RepositoryException - in case of an errorpublic static boolean check(String icon)
public static void clearAllLocks(String path, boolean processChildNodes, String workspace) throws javax.jcr.RepositoryException
path - the path of the node remove locks fromprocessChildNodes - do we need to also remove locks in children?workspace - workspacejavax.jcr.RepositoryException - in case of an errorpublic static javax.jcr.Value createValue(Object objectValue, javax.jcr.ValueFactory factory)
objectValue - the object value to be convertedfactory - the ValueFactory instancepublic static javax.jcr.Value[] createValues(Collection<?> objectValues, javax.jcr.ValueFactory factory)
objectValues - the object values to be convertedfactory - the ValueFactory instancepublic static String decodeJCRNamePrefix(String encodedPrefix)
encodedPrefix - public static void deleteJackrabbitIndexes(File repositoryHome)
repositoryHome - the repository home folderpublic static File downloadFileContent(JCRNodeWrapper node) throws IOException
node - the JCR node with the file contentIOException - in case of an errorpublic static File downloadFileContent(JCRNodeWrapper node, File targetFile) throws IOException
node - the JCR node with the file contenttargetFile - target file to write data intoIOException - in case of an errorpublic static String encodeJCRNamePrefix(String originalPrefix)
originalPrefix - public static String findAvailableNodeName(javax.jcr.Node dest, String name)
dest - the destination node, where the new one will be createdname - the name of the new nodepublic static String findAvailableNodeName(javax.jcr.Node dest, String name, boolean hasExtension)
dest - the destination node, where the new one will be createdname - the name of the new nodehasExtension - true if the name has an extension (e.g. in case of file names)public static JCRNodeWrapper findDisplayableNode(JCRNodeWrapper node, RenderContext context)
public static JCRNodeWrapper findDisplayableNode(JCRNodeWrapper node, RenderContext context, JCRSiteNode contextSite)
public static String generateNodeName(String text, int maxLength)
maxLength characters.text - the original text to be used as a sourcemaxLength - the maximum length of the resulting name (it will be
truncated if needed)maxLength characterspublic static Set<String> getAssignableMixins(JCRNodeWrapper node) throws javax.jcr.RepositoryException
node - the node to add mixin types tojavax.jcr.RepositoryException - in case of a repository access errorpublic static List<JCRNodeWrapper> getChildrenOfType(JCRNodeWrapper node, String type)
node - the parent node to retrieve children fromtype - the node type to be matched by a retrieved child. Multiple node types can be specified, separated by a comma.public static List<JCRNodeWrapper> getChildrenOfType(JCRNodeWrapper node, String type, int limit)
public static String getContentNodeName(javax.jcr.Node node) throws javax.jcr.RepositoryException
node - the node to get namejavax.jcr.RepositoryException - in case of JCR-related errorspublic static String getContentObjectPath(javax.jcr.Node node) throws javax.jcr.RepositoryException
/mySite/ContentPage_1/ContentPage_19/ContentContainerList_21/ContentContainer_13node - the content node to compute path forjavax.jcr.RepositoryException - in case of JCR-related errorspublic static javax.jcr.NodeIterator getDescendantNodes(JCRNodeWrapper node, String type)
public static String getDisplayLabel(Object item, Locale locale, ExtendedNodeType nodeTypeForSearchingLabel)
item - the item to get the label forlocale - current localenodeTypeForSearchingLabel - public static String getExpandedName(String name, javax.jcr.NamespaceRegistry namespaceRegistry) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic static String getJCRName(String qualifiedName, javax.jcr.NamespaceRegistry namespaceRegistry) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic static String getIconWithContext(ExtendedNodeType type) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic static String getIcon(ExtendedNodeType type) throws javax.jcr.RepositoryException
type - wanted typejavax.jcr.RepositoryException - in case of JCR-related errorspublic static String getIcon(JCRNodeWrapper f) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic static String getIconWithContext(JCRNodeWrapper f, boolean useContext) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic static String getIconsFolder(ExtendedNodeType primaryNodeType) throws javax.jcr.RepositoryException
primaryNodeType - javax.jcr.RepositoryException - in case of JCR-related errorspublic static JCRNodeLockType getLockType(String lockTypeToken)
lockTypeToken - the token to detect lock type frompublic static Set<JCRNodeLockType> getLockTypes(Map<String,List<String>> lockInfos)
lockInfos - the lock information of a nodepublic static String getNameFromPath(String path)
path - the path to get the name frompublic static List<JCRNodeWrapper> getNodes(JCRNodeWrapper node, String type)
public static List<JCRNodeWrapper> getNodes(JCRNodeWrapper node, String type, int limit)
public static JCRNodeWrapper getOrAddPath(JCRSessionWrapper session, JCRNodeWrapper parentNode, String path, String pathNodeType) throws javax.jcr.RepositoryException
session - parentNode - the parent node in from which we want to retrieve the relative path.path - the path to retrieve or create. Note that this path MUST be relativepathNodeType - the type to use for the intermediary nodes (and the last path too !) if they need to be
created. Usually you'll want to use Constants.JAHIANT_CONTENTLIST here.javax.jcr.RepositoryException - occurs if there is any problem accessing content or creating the nodes.public static String getParentJCRPath(String path)
path - the path for which we want to retrieve the parent path.public static JCRNodeWrapper getParentOfType(JCRNodeWrapper node, String type)
public static JCRNodeWrapper getPathFolder(JCRNodeWrapper root, String name, String options, String nodeType) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic static javax.jcr.nodetype.PropertyDefinition getPropertyDefinition(javax.jcr.nodetype.NodeType type,
String property)
throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic static javax.jcr.nodetype.PropertyDefinition getPropertyDefinition(String nodeType, String property) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic static int getPropertyDefSelector(javax.jcr.nodetype.ItemDefinition itemDef)
public static String getSiteKey(String jcrNodePath)
/sites/<siteKey>/...) this method returns the site key
part; otherwise null is returned.jcrNodePath - the JCR node path/sites/<siteKey>/...) this method returns the
site key part; otherwise null is returnedpublic static String getSystemSitePath()
public static Object getValue(javax.jcr.Value propertyValue) throws javax.jcr.ValueFormatException, javax.jcr.RepositoryException
propertyValue - the JCR property value to be convertedjavax.jcr.RepositoryException - in case of a conversion errorjavax.jcr.ValueFormatException - in case of a conversion errorpublic static boolean hasPermission(String workspaceName, String permissionName, String nodeUUID)
workspaceName - the name of the workspace in which we load the node from.permissionName - nodeUUID - public static void importSkeletons(String skeletonLocations, String targetPath, JCRSessionWrapper session) throws IOException, javax.jcr.InvalidSerializedDataException, javax.jcr.RepositoryException
skeletonLocations - the (pattern-based) location to search for resources. Multiple locations can be provided separated by comma (or any
delimiter, defined in ConfigurableApplicationContext.CONFIG_LOCATION_DELIMITERS )targetPath - target JCR path to perform import intosession - the current JCR sessionIOException - in case of skeleton lookup errorjavax.jcr.InvalidSerializedDataException - import related exceptionjavax.jcr.RepositoryException - general JCR exceptionpublic static void importSkeletons(String skeletonLocations, String targetPath, JCRSessionWrapper session, int importUUIDBehavior, Map<String,String> replacements) throws IOException, javax.jcr.InvalidSerializedDataException, javax.jcr.RepositoryException
skeletonLocations - the (pattern-based) location to search for resources. Multiple locations can be provided separated by comma (or any
delimiter, defined in ConfigurableApplicationContext.CONFIG_LOCATION_DELIMITERS )targetPath - target JCR path to perform import intosession - the current JCR sessionimportUUIDBehavior - the ImportUUIDBehavior to use during importreplacements - IOException - in case of skeleton lookup errorjavax.jcr.InvalidSerializedDataException - import related exceptionjavax.jcr.RepositoryException - general JCR exceptionpublic static void importSkeletons(String skeletonLocations, String targetPath, JCRSessionWrapper session, Map<String,String> replacements) throws IOException, javax.jcr.InvalidSerializedDataException, javax.jcr.RepositoryException
skeletonLocations - the (pattern-based) location to search for resources. Multiple locations can be provided separated by comma (or any
delimiter, defined in ConfigurableApplicationContext.CONFIG_LOCATION_DELIMITERS )targetPath - target JCR path to perform import intosession - the current JCR sessionreplacements - IOException - in case of skeleton lookup errorjavax.jcr.InvalidSerializedDataException - import related exceptionjavax.jcr.RepositoryException - general JCR exceptionpublic static boolean isADisplayableNode(JCRNodeWrapper node, RenderContext context)
public static boolean isMimeTypeGroup(String mimeType, String mimeTypeGroup)
mimeType - the mime type to be checkedmimeTypeGroup - the group (or multiple groups, separated by comma) the specified mime type should belong topublic static boolean isMimeTypeGroup(String mimeType, String... mimeTypeGroups)
mimeType - the mime type to be checkedmimeTypeGroups - the groups the specified mime type should belong topublic static boolean isLanguageInvalid(javax.jcr.Node node,
String languageCode)
throws javax.jcr.RepositoryException
node - the node to be checkedlanguageCode - language code to be testedtrue if the specified language is in the list of languages marked as invalid for displaying; false
otherwise.javax.jcr.RepositoryException - in case of an exceptionpublic static boolean isLockedAndCannotBeEdited(JCRNodeWrapper node) throws javax.jcr.RepositoryException
true if the node is locked and cannot be edited by current user.node - the node to be testedtrue if the node is locked and cannot be edited by current userjavax.jcr.RepositoryException - in case of a JCR errorpublic static boolean isNodeType(JCRNodeWrapper node, Iterable<String> types) throws javax.jcr.RepositoryException
true if the provided node matches one of the specified node types.node - the node to be testedtypes - an array of node types to be matched.true if the provided node matches one of the specified node typesjavax.jcr.RepositoryException - in case of a JCR errorpublic static boolean isNodeType(JCRNodeWrapper node, String... types) throws javax.jcr.RepositoryException
true if the provided node matches one of the specified node types.node - the node to be testedtypes - an array of node types to be matched.true if the provided node matches one of the specified node typesjavax.jcr.RepositoryException - in case of a JCR errorpublic static boolean isNodeType(JCRNodeWrapper node, String type) throws javax.jcr.RepositoryException
true if the provided node matches the specified node type (multiple node types can be specified, separated by a
comma).node - the node to be testedtype - the node type to be matched. Multiple node types can be specified, separated by a comma.true if the provided node matches the specified node type (multiple node types can be specified, separated by a
comma).javax.jcr.RepositoryException - in case of a JCR error@Deprecated public static boolean isNotJcrUuid(String uuid)
true if the provided UUID string does not seem like a valid Jackrabbit node UUID. In such a case it comes from a
different provide, like VFS.uuid - the UUID string to checkpublic static boolean isValidFilename(String name)
public static final boolean isValidWorkspace(String workspace)
default or live).workspace - the workspace name to checktrue if the specified name is a valid JCR workspace (either default or live);
otherwise returns falsepublic static final boolean isValidWorkspace(String workspace, boolean allowBlank)
default or live).workspace - the workspace name to checkallowBlank - set to true if the workspace name is allowed to be null or emptytrue if the specified name is a valid JCR workspace (either default or live);
otherwise returns falsepublic static void registerNamespace(javax.jcr.Session session,
String prefix,
String uri)
throws javax.jcr.RepositoryException
session - prefix - uri - javax.jcr.RepositoryException - in case of JCR-related errorspublic static long size(javax.jcr.RangeIterator iterator)
iterator - the item iterator to check the sizepublic static String[] splitJCRPath(String path)
path - a relative or absolute path, with node names in qualified or expanded formpublic static String stringToJCRPathExp(String str)
str - Any string.public static String stringToJCRSearchExp(String str)
str - Any string.public static String stringToQueryLiteral(String str)
str - Any string.public static String unescapeLocalNodeName(String encodedLocalName)
escapeLocalNodeName(String) methodencodedLocalName - the node name to unescapepublic String generateNodeName(JCRNodeWrapper parent, String nodeType)
public String generateNodeName(JCRNodeWrapper parent, String defaultLanguage, ExtendedNodeType nodeType, String targetName)
public Map<String,String> getFileExtensionIcons()
public Map<String,List<String>> getMimeTypes()
public NameGenerationHelper getNameGenerationHelper()
public void setNameGenerationHelper(NameGenerationHelper nameGenerationHelper)
public void setUnsupportedMarkForDeletionNodeTypes(Set<String> unsupportedMarkForDeletionNodeTypes)
public Pattern getHandleFallbackLocaleForPathPattern()
public void setHandleFallbackLocaleForPath(String handleFallbackLocaleForPath)
public static List<Map<String,Object>> getRolesForNode(JCRNodeWrapper node, boolean includeInherited, boolean expandGroups, String roles, int limit, boolean latestFirst)
public static String sqlEncode(String s)
s - the string to be encodedpublic static JCRNodeWrapper getParentWithAclInheritanceBroken(JCRNodeWrapper node) throws javax.jcr.RepositoryException
null is
returned.node - the node to search parent fornull is returnedjavax.jcr.RepositoryException - in case of JCR errorspublic static String getMimeType(String fileName)
fileName - the name of the file to detect mime type forpublic static String getMimeType(String fileName, String fallbackMimeType)
fileName - the name of the file to detect mime type forfallbackMimeType - the fallback mime-type to use if the type cannot be detectedpublic void setServletContext(javax.servlet.ServletContext servletContext)
setServletContext in interface org.springframework.web.context.ServletContextAwarepublic JCRNodeWrapper getUserPrivateFilesFolder(JCRSessionWrapper session) throws javax.jcr.RepositoryException
session - current JCR sessionjavax.jcr.RepositoryException - in case of an errorpublic JCRNodeWrapper getDefaultUserFolder(JCRSessionWrapper session, String path) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic JCRNodeWrapper getDefaultUserFolder(JCRSessionWrapper session, String path, boolean saveIfCreate) throws javax.jcr.RepositoryException
session - the session with which to access the JCR datapath - the path of the default user folder to retrieve, if path is empty or null the user's node is returnedsaveIfCreate - true if we want the session to be immediately saved, false if the client code will save the session to commit the changesjavax.jcr.RepositoryException - in case of JCR-related errorspublic static boolean isUserMemberOfGroup(String siteKey, String groupName, String userName, String userRealm, boolean isRoot)
siteKey - the site keygroupName - the group nameuserName - the user nameuserRealm - hte user realmisRoot - is the user root ?public static boolean needVersion(JCRNodeWrapper node, Set<String> versionedTypes) throws javax.jcr.RepositoryException
node - the node we want to versionversionedTypes - the jahia property with types to versionjavax.jcr.RepositoryExceptionpublic static Set<String> splitAndUnify(String input, String separator)
input - String containing different inputs with a separatorseparator - string specifying the separator to split withCopyright © 2004–2020 Jahia Solutions Group SA. All rights reserved.