public class ConsolidatingChangeLog extends AbstractChangeLog<ConsolidatingChangeLog.CancelableOperation>
ChangeLog
implementation which does basic consolidation on its
Operation
s. That is, cancelling
operations are removed if possible. In general this is not possible across
move
operations. The individual
CancelableOperation
implementations document their behavior
concerning cancellation.Modifier and Type | Class and Description |
---|---|
protected static interface |
ConsolidatingChangeLog.CancelableOperation
This class represent an
Operation which can be cancelled by another operation
or which cancels another operation. |
protected static class |
ConsolidatingChangeLog.CancelableOperations
Factory for creating
CancelableOperation s. |
operations
Constructor and Description |
---|
ConsolidatingChangeLog()
Create a new instance of a consolidating change log.
|
Modifier and Type | Method and Description |
---|---|
void |
addNode(NodeId parentId,
Name nodeName,
Name nodetypeName,
String uuid)
Add a new node to the persistent layer.
|
void |
addOperation(ConsolidatingChangeLog.CancelableOperation op)
Determines the cancellation behavior from the list of
operations
and the current operation op :
When the current operation is cancelled by the last operation, the list of operations
is not modified.
When the current operation and the last operation cancel each other, the last operation is
removed from the list of operations.
When the last operation is cancelled by this operation, the last operation is removed from
the list of operations and determination of cancellation starts from scratch.
Otherwise add the current operation to the list of operations.
|
void |
addProperty(NodeId parentId,
Name propertyName,
QValue value)
Add a new property to the persistent layer.
|
void |
addProperty(NodeId parentId,
Name propertyName,
QValue[] values)
Add a new multi-valued property to the persistent layer.
|
protected static Path |
getPath(ItemId itemId)
|
protected static Path |
getPath(NodeId parentId,
Name name)
|
void |
move(NodeId srcNodeId,
NodeId destParentNodeId,
Name destName)
Move the node identified by the given
srcNodeId to the
new parent identified by destParentNodeId and change its
name to destName . |
void |
remove(ItemId itemId)
Remove an existing item.
|
void |
reorderNodes(NodeId parentId,
NodeId srcNodeId,
NodeId beforeNodeId)
Modify the order of the child nodes identified by the given
NodeId s. |
void |
setMixins(NodeId nodeId,
Name[] mixinNodeTypeNames)
Modify the set of mixin node types present on the node identified by the
given id.
|
void |
setPrimaryType(NodeId nodeId,
Name primaryNodeTypeName)
Change the primary type of the node identified by the given
nodeId . |
void |
setTree(NodeId parentId,
Tree contentTree)
Add a new content tree to the persistent layer.
|
void |
setValue(PropertyId propertyId,
QValue value)
Modify the value of an existing property.
|
void |
setValue(PropertyId propertyId,
QValue[] values)
Modify the value of an existing, multi-valued property.
|
public ConsolidatingChangeLog()
protected static Path getPath(NodeId parentId, Name name) throws javax.jcr.RepositoryException
parentId
- node id of the parentname
- name of the childname
or null
if parentId
's
path is not absolutejavax.jcr.RepositoryException
protected static Path getPath(ItemId itemId)
itemId
- itemId
or null
if itemId
's
path is not absolutepublic void addNode(NodeId parentId, Name nodeName, Name nodetypeName, String uuid) throws javax.jcr.RepositoryException
Batch
parentId
- NodeId identifying the parent node.nodeName
- Name of the node to be created.nodetypeName
- Primary node type name of the node to be created.uuid
- Value for the jcr:uuid property of the node to be created or
null
. If due to an import the uuid of the resulting node is
already defined, it must be passed as separate uuid parameter, indicating
a binding value for the server. Otherwise the uuid must be null
.javax.jcr.ItemExistsException
javax.jcr.PathNotFoundException
javax.jcr.version.VersionException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.nodetype.NoSuchNodeTypeException
javax.jcr.lock.LockException
javax.jcr.AccessDeniedException
javax.jcr.UnsupportedRepositoryOperationException
javax.jcr.RepositoryException
Node.addNode(String)
,
Node.addNode(String, String)
,
Session.importXML(String, java.io.InputStream, int)
,
Query.storeAsNode(String)
public void addProperty(NodeId parentId, Name propertyName, QValue value) throws javax.jcr.RepositoryException
Batch
Note: this call should succeed in case the property already exists.
parentId
- NodeId identifying the parent node.propertyName
- Name of the property to be created.value
- The value of the property to be created.javax.jcr.ValueFormatException
javax.jcr.version.VersionException
javax.jcr.lock.LockException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.PathNotFoundException
javax.jcr.ItemExistsException
javax.jcr.AccessDeniedException
javax.jcr.UnsupportedRepositoryOperationException
javax.jcr.RepositoryException
Node.setProperty(String, javax.jcr.Value)
,
Node.setProperty(String, javax.jcr.Value, int)
,
Node.setProperty(String, String)
,
Node.setProperty(String, String, int)
,
Node.setProperty(String, java.util.Calendar)
,
Node.setProperty(String, boolean)
,
Node.setProperty(String, double)
,
Node.setProperty(String, long)
,
Node.setProperty(String, javax.jcr.Node)
,
Session.importXML(String, java.io.InputStream, int)
,
Query.storeAsNode(String)
public void addProperty(NodeId parentId, Name propertyName, QValue[] values) throws javax.jcr.RepositoryException
Batch
Note: this call should succeed in case the property already exists.
parentId
- NodeId identifying the parent node.propertyName
- Name of the property to be created.values
- The values of the property to be created.javax.jcr.ValueFormatException
javax.jcr.version.VersionException
javax.jcr.lock.LockException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.PathNotFoundException
javax.jcr.ItemExistsException
javax.jcr.AccessDeniedException
javax.jcr.UnsupportedRepositoryOperationException
javax.jcr.RepositoryException
Node.setProperty(String, javax.jcr.Value[])
,
Node.setProperty(String, javax.jcr.Value[], int)
,
Node.setProperty(String, String[])
,
Node.setProperty(String, String[], int)
,
Session.importXML(String, java.io.InputStream, int)
public void move(NodeId srcNodeId, NodeId destParentNodeId, Name destName) throws javax.jcr.RepositoryException
Batch
srcNodeId
to the
new parent identified by destParentNodeId
and change its
name to destName
.srcNodeId
- NodeId identifying the node to be moved.destParentNodeId
- NodeId identifying the new parent.destName
- The new name of the moved node.javax.jcr.ItemExistsException
javax.jcr.PathNotFoundException
javax.jcr.version.VersionException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.lock.LockException
javax.jcr.AccessDeniedException
javax.jcr.UnsupportedRepositoryOperationException
javax.jcr.RepositoryException
Session.move(String, String)
public void remove(ItemId itemId) throws javax.jcr.RepositoryException
Batch
itemId
- ItemId identifying the item to be removed.javax.jcr.version.VersionException
javax.jcr.lock.LockException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.AccessDeniedException
javax.jcr.UnsupportedRepositoryOperationException
javax.jcr.RepositoryException
Item.remove()
public void reorderNodes(NodeId parentId, NodeId srcNodeId, NodeId beforeNodeId) throws javax.jcr.RepositoryException
Batch
NodeId
s.parentId
- NodeId identifying the parent node.srcNodeId
- NodeId identifying the node to be reordered.beforeNodeId
- NodeId identifying the child node, before which the
source node must be placed.javax.jcr.UnsupportedRepositoryOperationException
javax.jcr.version.VersionException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.ItemNotFoundException
javax.jcr.lock.LockException
javax.jcr.AccessDeniedException
javax.jcr.RepositoryException
Node.orderBefore(String, String)
public void setMixins(NodeId nodeId, Name[] mixinNodeTypeNames) throws javax.jcr.RepositoryException
Batch
nodeId
- NodeId identifying the node to be modified.mixinNodeTypeNames
- The new set of mixin types. Compared to the
previous values this may result in both adding and/or removing mixin types.javax.jcr.nodetype.NoSuchNodeTypeException
javax.jcr.version.VersionException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.lock.LockException
javax.jcr.AccessDeniedException
javax.jcr.UnsupportedRepositoryOperationException
javax.jcr.RepositoryException
Node.addMixin(String)
,
Node.removeMixin(String)
public void setPrimaryType(NodeId nodeId, Name primaryNodeTypeName) throws javax.jcr.RepositoryException
Batch
nodeId
.nodeId
- NodeId identifying the node to be modified.javax.jcr.RepositoryException
Node.setPrimaryType(String)
public void setValue(PropertyId propertyId, QValue value) throws javax.jcr.RepositoryException
Batch
null
value.
Removing a property is achieved by calling Batch.remove(ItemId)
.propertyId
- PropertyId identifying the property to be modified.value
- The new value.javax.jcr.ValueFormatException
javax.jcr.version.VersionException
javax.jcr.lock.LockException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.AccessDeniedException
javax.jcr.UnsupportedRepositoryOperationException
javax.jcr.RepositoryException
Property.setValue(javax.jcr.Value)
,
Property.setValue(String)
,
Property.setValue(long)
,
Property.setValue(double)
,
Property.setValue(java.util.Calendar)
,
Property.setValue(boolean)
,
Property.setValue(javax.jcr.Node)
public void setValue(PropertyId propertyId, QValue[] values) throws javax.jcr.RepositoryException
Batch
null
value. Removing a property is achieved by calling Batch.remove(ItemId)
.propertyId
- PropertyId identifying the property to be modified.values
- The new values.javax.jcr.ValueFormatException
javax.jcr.version.VersionException
javax.jcr.lock.LockException
javax.jcr.nodetype.ConstraintViolationException
javax.jcr.AccessDeniedException
javax.jcr.UnsupportedRepositoryOperationException
javax.jcr.RepositoryException
Property.setValue(javax.jcr.Value[])
,
Property.setValue(String[])
public void setTree(NodeId parentId, Tree contentTree) throws javax.jcr.RepositoryException
Batch
javax.jcr.RepositoryException
public void addOperation(ConsolidatingChangeLog.CancelableOperation op) throws javax.jcr.RepositoryException
operations
and the current operation op
:
addOperation
in class AbstractChangeLog<ConsolidatingChangeLog.CancelableOperation>
op
- Operation
to addjavax.jcr.RepositoryException
Copyright © 2004-2020 The Apache Software Foundation. All Rights Reserved.