Class SerializableBatch
- java.lang.Object
-
- org.apache.jackrabbit.spi.commons.SerializableBatch
-
- All Implemented Interfaces:
java.io.Serializable
,Batch
public class SerializableBatch extends java.lang.Object implements Batch, java.io.Serializable
SerializableBatch
implements a serializable SPI Batch, which simply records all calls and replays them when asked for. The client of this batch must ensure that the passedQValue
instances are serializable, otherwise the serializing theBatch
will fail!- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
SerializableBatch.Operation
-
Constructor Summary
Constructors Constructor Description SerializableBatch(ItemId itemId)
Creates a newSerializableBatch
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addNode(NodeId parentId, Name nodeName, Name nodetypeName, java.lang.String uuid)
Add a new node to the persistent layer.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.ItemId
getSaveTarget()
void
move(NodeId srcNodeId, NodeId destParentNodeId, Name destName)
Move the node identified by the givensrcNodeId
to the new parent identified bydestParentNodeId
and change its name todestName
.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 givenNodeId
s.void
replay(Batch batch)
Replays this batch on the givenbatch
.void
setMixins(NodeId nodeId, Name[] mixinNodeTypeIds)
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 givennodeId
.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.
-
-
-
Constructor Detail
-
SerializableBatch
public SerializableBatch(ItemId itemId)
Creates a newSerializableBatch
.- Parameters:
itemId
- the id of the item where save was called. To indicate that save was called on the session, the id of the root node must be passed.
-
-
Method Detail
-
getSaveTarget
public ItemId getSaveTarget()
- Returns:
- the item id where save was called for this batch.
-
replay
public void replay(Batch batch) throws PathNotFoundException, ItemNotFoundException, NoSuchNodeTypeException, ValueFormatException, VersionException, LockException, ConstraintViolationException, AccessDeniedException, UnsupportedRepositoryOperationException, RepositoryException
Replays this batch on the givenbatch
. For a description of the exception seeRepositoryService.submit(Batch)
.
-
addNode
public void addNode(NodeId parentId, Name nodeName, Name nodetypeName, java.lang.String uuid)
Description copied from interface:Batch
Add a new node to the persistent layer.- Specified by:
addNode
in interfaceBatch
- 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
.- 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)
Description copied from interface:Batch
Add a new property to the persistent layer.Note: this call should succeed in case the property already exists.
- Specified by:
addProperty
in interfaceBatch
- Parameters:
parentId
- NodeId identifying the parent node.propertyName
- Name of the property to be created.value
- The value of the property to be created.- 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)
Description copied from interface:Batch
Add a new multi-valued property to the persistent layer.Note: this call should succeed in case the property already exists.
- Specified by:
addProperty
in interfaceBatch
- Parameters:
parentId
- NodeId identifying the parent node.propertyName
- Name of the property to be created.values
- The values of the property to be created.- 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)
-
setValue
public void setValue(PropertyId propertyId, QValue value)
Description copied from interface:Batch
Modify the value of an existing property. Note that in contrast to the JCR API this method should not accept anull
value. Removing a property is achieved by callingBatch.remove(ItemId)
.- Specified by:
setValue
in interfaceBatch
- Parameters:
propertyId
- PropertyId identifying the property to be modified.value
- The new value.- 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)
Description copied from interface:Batch
Modify the value of an existing, multi-valued property. Note that in contrast to the JCR API this method should not accept anull
value. Removing a property is achieved by callingBatch.remove(ItemId)
.- Specified by:
setValue
in interfaceBatch
- Parameters:
propertyId
- PropertyId identifying the property to be modified.values
- The new values.- See Also:
Property.setValue(javax.jcr.Value[])
,Property.setValue(String[])
-
remove
public void remove(ItemId itemId)
Description copied from interface:Batch
Remove an existing item.- Specified by:
remove
in interfaceBatch
- Parameters:
itemId
- ItemId identifying the item to be removed.- See Also:
Item.remove()
-
reorderNodes
public void reorderNodes(NodeId parentId, NodeId srcNodeId, NodeId beforeNodeId)
Description copied from interface:Batch
Modify the order of the child nodes identified by the givenNodeId
s.- Specified by:
reorderNodes
in interfaceBatch
- 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.- See Also:
Node.orderBefore(String, String)
-
setMixins
public void setMixins(NodeId nodeId, Name[] mixinNodeTypeIds)
Description copied from interface:Batch
Modify the set of mixin node types present on the node identified by the given id.- Specified by:
setMixins
in interfaceBatch
- Parameters:
nodeId
- NodeId identifying the node to be modified.mixinNodeTypeIds
- The new set of mixin types. Compared to the previous values this may result in both adding and/or removing mixin types.- See Also:
Node.addMixin(String)
,Node.removeMixin(String)
-
setPrimaryType
public void setPrimaryType(NodeId nodeId, Name primaryNodeTypeName) throws RepositoryException
Description copied from interface:Batch
Change the primary type of the node identified by the givennodeId
.- Specified by:
setPrimaryType
in interfaceBatch
- Parameters:
nodeId
- NodeId identifying the node to be modified.- Throws:
RepositoryException
- See Also:
Node.setPrimaryType(String)
-
move
public void move(NodeId srcNodeId, NodeId destParentNodeId, Name destName)
Description copied from interface:Batch
Move the node identified by the givensrcNodeId
to the new parent identified bydestParentNodeId
and change its name todestName
.- Specified by:
move
in interfaceBatch
- Parameters:
srcNodeId
- NodeId identifying the node to be moved.destParentNodeId
- NodeId identifying the new parent.destName
- The new name of the moved node.- See Also:
Session.move(String, String)
-
setTree
public void setTree(NodeId parentId, Tree contentTree) throws RepositoryException
Description copied from interface:Batch
Add a new content tree to the persistent layer.- Specified by:
setTree
in interfaceBatch
- Throws:
RepositoryException
-
-