public final class JCRAutoSplitUtils extends Object
| Constructor and Description |
|---|
JCRAutoSplitUtils() |
| Modifier and Type | Method and Description |
|---|---|
static JCRNodeWrapper |
addNodeWithAutoSplitting(JCRNodeWrapper parentNode,
String nodeName,
String nodeType,
String splitConfig,
String splitNodeType,
Object valueBean)
This method uses the valueBean to auto-split the node at creation time, instead of moving it like the other
auto-splitting methods do it.
|
static JCRNodeWrapper |
applyAutoSplitRules(JCRNodeWrapper node)
Moves the specified node according to the auto-split policy set on the
parent node.
Splitting is supported by a particular string property value (e.g. |
static JCRNodeWrapper |
applyAutoSplitRules(JCRNodeWrapper node,
JCRNodeWrapper parent) |
static Map<JCRNodeWrapper,JCRNodeWrapper> |
applyAutoSplitRulesOnSubnodes(JCRNodeWrapper node)
Iterates over all sub nodes of the specified node and applies auto-split
rules on them.
|
static void |
enableAutoSplitting(JCRNodeWrapper node,
String splitConfig,
String splitFolderNodeType)
Adds a mixin type to the specified node to enable auto-splitting of the
child nodes, based on the provided configuration.
|
public static JCRNodeWrapper applyAutoSplitRules(JCRNodeWrapper node) throws javax.jcr.RepositoryException
property,jcr:creator;date,jcr:created,yyyy;date,jcr:created,MM
will split the child nodes first into folders, based on the creator name
(jcr:createdBy), than by creation year (jcr:created) and than by creation
month (jcr:created).
|_sergiy
|_2010
|_07
|_report.pdf
The intermediate folders will be created.node - the node to be movedjavax.jcr.RepositoryException - in case of an error when relocating nodepublic static JCRNodeWrapper applyAutoSplitRules(JCRNodeWrapper node, JCRNodeWrapper parent) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionpublic static Map<JCRNodeWrapper,JCRNodeWrapper> applyAutoSplitRulesOnSubnodes(JCRNodeWrapper node) throws javax.jcr.RepositoryException
node - the node, which children should be moved to split foldersjavax.jcr.RepositoryException - in case of an errorpublic static void enableAutoSplitting(JCRNodeWrapper node, String splitConfig, String splitFolderNodeType) throws javax.jcr.RepositoryException
node - the node to enable splitting of children onsplitConfig - auto-splitting settings;splitFolderNodeType - javax.jcr.RepositoryException - in case of JCR-related errorspublic static JCRNodeWrapper addNodeWithAutoSplitting(JCRNodeWrapper parentNode, String nodeName, String nodeType, String splitConfig, String splitNodeType, Object valueBean) throws javax.jcr.RepositoryException
type,propertyName,type_parameters;type,propertyName,type_parameters;...
where type is one of :
- constant : the property name will be used as a node name
- property : the value of the specified property will be used as a node name
- firstChars : takes as a type_parameter the number of characters to use from the value of the property name
to split
- substring : will use a substring of the property's value. The range is specified using "-" as a separator.
- date : will use the type_parameter as a configuration for the SimpleDateFormat parser.
the propertyName is the name of the property on which this criteria will operate on. There is a reserved
"j:nodename" property name that can be used to reference the nodeName passed to the method.
For example the following settings
property,creator;date,creationDate,yyyy;date,creationDate,MM
and the following bean :
public class MyBean {
public String getCreator();
public Date getCreationDate();
}
will split the child nodes first into folders, based on the creator property value
(creator), than by creation year (creationDate) and than by creation
month (creationDate).
|_sergiy
|_2010
|_07
|_report.pdf
The intermediate folders will be created.parentNode - the parent node in which to auto-split the node that will be created.nodeName - the node name to use to create the new node. Note that if the node name is already present, this
method will call the findAvailableNodeName automatically to append a number to the node.nodeType - the node type to use when creating the node at the auto-split location.splitConfig - the auto-splitting configurationsplitNodeType - the node type to use to create the intermediary nodes when auto-splitting.valueBean - an Object on which the auto-split rules will be applied. This object must be a proper JavaBean
object, as BeanUtils method will be used to evaluate the properties specified in the auto-split configuration.javax.jcr.RepositoryException - if there is an internal errorCopyright © 2004–2020 Jahia Solutions Group SA. All rights reserved.