Class ConsolidatingChangeLog
- java.lang.Object
-
- org.apache.jackrabbit.spi.commons.batch.AbstractChangeLog<ConsolidatingChangeLog.CancelableOperation>
-
- org.apache.jackrabbit.spi.commons.batch.ConsolidatingChangeLog
-
public class ConsolidatingChangeLog extends AbstractChangeLog<ConsolidatingChangeLog.CancelableOperation>
AChangeLogimplementation which does basic consolidation on itsOperations. That is, cancelling operations are removed if possible. In general this is not possible acrossmoveoperations. The individualCancelableOperationimplementations document their behavior concerning cancellation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interfaceConsolidatingChangeLog.CancelableOperationThis class represent anOperationwhich can be cancelled by another operation or which cancels another operation.protected static classConsolidatingChangeLog.CancelableOperationsFactory for creatingCancelableOperations.
-
Field Summary
-
Fields inherited from class org.apache.jackrabbit.spi.commons.batch.AbstractChangeLog
operations
-
-
Constructor Summary
Constructors Constructor Description ConsolidatingChangeLog()Create a new instance of a consolidating change log.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddNode(NodeId parentId, Name nodeName, Name nodetypeName, String uuid)Add a new node to the persistent layer.voidaddOperation(ConsolidatingChangeLog.CancelableOperation op)Determines the cancellation behavior from the list ofoperationsand the current operationop: 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.voidaddProperty(NodeId parentId, Name propertyName, QValue value)Add a new property to the persistent layer.voidaddProperty(NodeId parentId, Name propertyName, QValue[] values)Add a new multi-valued property to the persistent layer.protected static PathgetPath(ItemId itemId)protected static PathgetPath(NodeId parentId, Name name)voidmove(NodeId srcNodeId, NodeId destParentNodeId, Name destName)Move the node identified by the givensrcNodeIdto the new parent identified bydestParentNodeIdand change its name todestName.voidremove(ItemId itemId)Remove an existing item.voidreorderNodes(NodeId parentId, NodeId srcNodeId, NodeId beforeNodeId)Modify the order of the child nodes identified by the givenNodeIds.voidsetMixins(NodeId nodeId, Name[] mixinNodeTypeNames)Modify the set of mixin node types present on the node identified by the given id.voidsetPrimaryType(NodeId nodeId, Name primaryNodeTypeName)Change the primary type of the node identified by the givennodeId.voidsetTree(NodeId parentId, Tree contentTree)Add a new content tree to the persistent layer.voidsetValue(PropertyId propertyId, QValue value)Modify the value of an existing property.voidsetValue(PropertyId propertyId, QValue[] values)Modify the value of an existing, multi-valued property.
-
-
-
Method Detail
-
getPath
protected static Path getPath(NodeId parentId, Name name) throws RepositoryException
- Parameters:
parentId- node id of the parentname- name of the child- Returns:
- the path of the item
nameornullifparentId's path is not absolute - Throws:
RepositoryException
-
getPath
protected static Path getPath(ItemId itemId)
- Parameters:
itemId-- Returns:
- path of the item
itemIdornullifitemId's path is not absolute
-
addNode
public void addNode(NodeId parentId, Name nodeName, Name nodetypeName, String uuid) throws RepositoryException
Description copied from interface:BatchAdd a new node to the persistent layer.- Parameters:
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 ornull. 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 benull.- Throws:
ItemExistsExceptionPathNotFoundExceptionVersionExceptionConstraintViolationExceptionNoSuchNodeTypeExceptionLockExceptionAccessDeniedExceptionUnsupportedRepositoryOperationExceptionRepositoryException- See Also:
Node.addNode(String),Node.addNode(String, String),Session.importXML(String, java.io.InputStream, int),Query.storeAsNode(String)
-
addProperty
public void addProperty(NodeId parentId, Name propertyName, QValue value) throws RepositoryException
Description copied from interface:BatchAdd a new property to the persistent layer.Note: this call should succeed in case the property already exists.
- Parameters:
parentId- NodeId identifying the parent node.propertyName- Name of the property to be created.value- The value of the property to be created.- Throws:
ValueFormatExceptionVersionExceptionLockExceptionConstraintViolationExceptionPathNotFoundExceptionItemExistsExceptionAccessDeniedExceptionUnsupportedRepositoryOperationExceptionRepositoryException- See Also:
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)
-
addProperty
public void addProperty(NodeId parentId, Name propertyName, QValue[] values) throws RepositoryException
Description copied from interface:BatchAdd a new multi-valued property to the persistent layer.Note: this call should succeed in case the property already exists.
- Parameters:
parentId- NodeId identifying the parent node.propertyName- Name of the property to be created.values- The values of the property to be created.- Throws:
ValueFormatExceptionVersionExceptionLockExceptionConstraintViolationExceptionPathNotFoundExceptionItemExistsExceptionAccessDeniedExceptionUnsupportedRepositoryOperationExceptionRepositoryException- See Also:
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)
-
move
public void move(NodeId srcNodeId, NodeId destParentNodeId, Name destName) throws RepositoryException
Description copied from interface:BatchMove the node identified by the givensrcNodeIdto the new parent identified bydestParentNodeIdand change its name todestName.- Parameters:
srcNodeId- NodeId identifying the node to be moved.destParentNodeId- NodeId identifying the new parent.destName- The new name of the moved node.- Throws:
ItemExistsExceptionPathNotFoundExceptionVersionExceptionConstraintViolationExceptionLockExceptionAccessDeniedExceptionUnsupportedRepositoryOperationExceptionRepositoryException- See Also:
Session.move(String, String)
-
remove
public void remove(ItemId itemId) throws RepositoryException
Description copied from interface:BatchRemove an existing item.- Parameters:
itemId- ItemId identifying the item to be removed.- Throws:
VersionExceptionLockExceptionConstraintViolationExceptionAccessDeniedExceptionUnsupportedRepositoryOperationExceptionRepositoryException- See Also:
Item.remove()
-
reorderNodes
public void reorderNodes(NodeId parentId, NodeId srcNodeId, NodeId beforeNodeId) throws RepositoryException
Description copied from interface:BatchModify the order of the child nodes identified by the givenNodeIds.- Parameters:
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.- Throws:
UnsupportedRepositoryOperationExceptionVersionExceptionConstraintViolationExceptionItemNotFoundExceptionLockExceptionAccessDeniedExceptionRepositoryException- See Also:
Node.orderBefore(String, String)
-
setMixins
public void setMixins(NodeId nodeId, Name[] mixinNodeTypeNames) throws RepositoryException
Description copied from interface:BatchModify the set of mixin node types present on the node identified by the given id.- Parameters:
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.- Throws:
NoSuchNodeTypeExceptionVersionExceptionConstraintViolationExceptionLockExceptionAccessDeniedExceptionUnsupportedRepositoryOperationExceptionRepositoryException- See Also:
Node.addMixin(String),Node.removeMixin(String)
-
setPrimaryType
public void setPrimaryType(NodeId nodeId, Name primaryNodeTypeName) throws RepositoryException
Description copied from interface:BatchChange the primary type of the node identified by the givennodeId.- Parameters:
nodeId- NodeId identifying the node to be modified.- Throws:
RepositoryException- See Also:
Node.setPrimaryType(String)
-
setValue
public void setValue(PropertyId propertyId, QValue value) throws RepositoryException
Description copied from interface:BatchModify the value of an existing property. Note that in contrast to the JCR API this method should not accept anullvalue. Removing a property is achieved by callingBatch.remove(ItemId).- Parameters:
propertyId- PropertyId identifying the property to be modified.value- The new value.- Throws:
ValueFormatExceptionVersionExceptionLockExceptionConstraintViolationExceptionAccessDeniedExceptionUnsupportedRepositoryOperationExceptionRepositoryException- See Also:
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)
-
setValue
public void setValue(PropertyId propertyId, QValue[] values) throws RepositoryException
Description copied from interface:BatchModify the value of an existing, multi-valued property. Note that in contrast to the JCR API this method should not accept anullvalue. Removing a property is achieved by callingBatch.remove(ItemId).- Parameters:
propertyId- PropertyId identifying the property to be modified.values- The new values.- Throws:
ValueFormatExceptionVersionExceptionLockExceptionConstraintViolationExceptionAccessDeniedExceptionUnsupportedRepositoryOperationExceptionRepositoryException- See Also:
Property.setValue(javax.jcr.Value[]),Property.setValue(String[])
-
setTree
public void setTree(NodeId parentId, Tree contentTree) throws RepositoryException
Description copied from interface:BatchAdd a new content tree to the persistent layer.- Throws:
RepositoryException
-
addOperation
public void addOperation(ConsolidatingChangeLog.CancelableOperation op) throws RepositoryException
Determines the cancellation behavior from the list ofoperationsand the current operationop:- 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.
- Overrides:
addOperationin classAbstractChangeLog<ConsolidatingChangeLog.CancelableOperation>- Parameters:
op-Operationto add- Throws:
RepositoryException
-
-