public class ItemValidator extends Object
Modifier and Type | Field and Description |
---|---|
static int |
CHECK_ACCESS
check access permissions
|
static int |
CHECK_CHECKED_OUT
option to check checked-out status
|
static int |
CHECK_CONSTRAINTS
option to check if the item is protected by it's nt definition
|
static int |
CHECK_HOLD
option to check for effective holds
|
static int |
CHECK_LOCK
option to check lock status
|
static int |
CHECK_PENDING_CHANGES
option to check for pending changes on the session
|
static int |
CHECK_PENDING_CHANGES_ON_NODE
option to check for pending changes on the specified node
|
static int |
CHECK_REFERENCES
check for referential integrity upon removal
|
static int |
CHECK_RETENTION
option to check for effective retention policies
|
protected SessionContext |
context
Component context of the associated session.
|
Constructor and Description |
---|
ItemValidator(SessionContext context)
Creates a new
ItemValidator instance. |
Modifier and Type | Method and Description |
---|---|
boolean |
canModify(ItemImpl item,
int options,
int permissions) |
void |
checkModify(ItemImpl item,
int options,
int permissions) |
void |
checkRemove(ItemImpl item,
int options,
int permissions) |
QNodeDefinition |
findApplicableNodeDefinition(Name name,
Name nodeTypeName,
NodeState parentState)
Helper method that finds the applicable definition for a child node with
the given name and node type in the parent node's node type and
mixin types.
|
QPropertyDefinition |
findApplicablePropertyDefinition(Name name,
int type,
boolean multiValued,
NodeState parentState)
Helper method that finds the applicable definition for a property with
the given name, type and multiValued characteristic in the parent node's
node type and mixin types.
|
QPropertyDefinition |
findApplicablePropertyDefinition(Name name,
int type,
NodeState parentState)
Helper method that finds the applicable definition for a property with
the given name, type in the parent node's node type and mixin types.
|
EffectiveNodeType |
getEffectiveNodeType(NodeState state)
Helper method that builds the effective (i.e.
|
<T> T |
performRelaxed(SessionOperation<T> operation,
int checksToDisable)
Performs the given session operation with the specified checks disabled.
|
String |
safeGetJCRPath(ItemId id)
Failsafe translation of internal
ItemId to JCR path for use
in error messages etc. |
String |
safeGetJCRPath(Path path)
Failsafe conversion of internal
Path to JCR path for use in
error messages etc. |
void |
validate(NodeState nodeState)
Checks whether the given node state satisfies the constraints specified
by its primary and mixin node types.
|
void |
validate(PropertyState propState)
Checks whether the given property state satisfies the constraints
specified by its definition.
|
public static final int CHECK_ACCESS
public static final int CHECK_LOCK
public static final int CHECK_CHECKED_OUT
public static final int CHECK_REFERENCES
public static final int CHECK_CONSTRAINTS
public static final int CHECK_PENDING_CHANGES
public static final int CHECK_PENDING_CHANGES_ON_NODE
public static final int CHECK_HOLD
public static final int CHECK_RETENTION
protected final SessionContext context
public ItemValidator(SessionContext context)
ItemValidator
instance.context
- component context of this sessionpublic <T> T performRelaxed(SessionOperation<T> operation, int checksToDisable) throws javax.jcr.RepositoryException
operation
- the session operation to be performedchecksToDisable
- bit mask of checks to be disabledjavax.jcr.RepositoryException
- if the operation could not be performedpublic void validate(NodeState nodeState) throws javax.jcr.nodetype.ConstraintViolationException, javax.jcr.RepositoryException
nodeState
- state of node to be validatedjavax.jcr.nodetype.ConstraintViolationException
- if any of the validations failjavax.jcr.RepositoryException
- if another error occurspublic void validate(PropertyState propState) throws javax.jcr.nodetype.ConstraintViolationException, javax.jcr.RepositoryException
propState
- state of property to be validatedjavax.jcr.nodetype.ConstraintViolationException
- if any of the validations failjavax.jcr.RepositoryException
- if another error occurspublic void checkModify(ItemImpl item, int options, int permissions) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public void checkRemove(ItemImpl item, int options, int permissions) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public boolean canModify(ItemImpl item, int options, int permissions) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public EffectiveNodeType getEffectiveNodeType(NodeState state) throws javax.jcr.RepositoryException
state
- javax.jcr.RepositoryException
public QNodeDefinition findApplicableNodeDefinition(Name name, Name nodeTypeName, NodeState parentState) throws javax.jcr.RepositoryException, javax.jcr.nodetype.ConstraintViolationException
name
- nodeTypeName
- parentState
- QNodeDefinition
javax.jcr.nodetype.ConstraintViolationException
- if no applicable child node definition
could be foundjavax.jcr.RepositoryException
- if another error occurspublic QPropertyDefinition findApplicablePropertyDefinition(Name name, int type, boolean multiValued, NodeState parentState) throws javax.jcr.RepositoryException, javax.jcr.nodetype.ConstraintViolationException
name
- type
- multiValued
- parentState
- QPropertyDefinition
javax.jcr.nodetype.ConstraintViolationException
- if no applicable property definition
could be foundjavax.jcr.RepositoryException
- if another error occurspublic QPropertyDefinition findApplicablePropertyDefinition(Name name, int type, NodeState parentState) throws javax.jcr.RepositoryException, javax.jcr.nodetype.ConstraintViolationException
findApplicablePropertyDefinition(Name, int, boolean, NodeState)
this method does not take the multiValued flag into account in the
selection algorithm. If there more than one applicable definitions then
the following rules are applied:
name
- type
- parentState
- QPropertyDefinition
javax.jcr.nodetype.ConstraintViolationException
- if no applicable property definition
could be foundjavax.jcr.RepositoryException
- if another error occurspublic String safeGetJCRPath(Path path)
Path
to JCR path for use in
error messages etc.path
- path to convertCopyright © 2004-2020 The Apache Software Foundation. All Rights Reserved.