Class UpdateOp
java.lang.Object
org.apache.jackrabbit.oak.plugins.document.UpdateOp
A DocumentStore "update" operation for one document.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
A condition to check before an update is applied.static final class
A key for an operation consists of a property name and an optional revision.static final class
A DocumentStore operation for a given key within a document. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopy()
Creates a deep copy of this update operation.@NotNull String
getId()
boolean
Checks if the UpdateOp has any change operation is registered with current update operationvoid
Increment the value.boolean
isNew()
void
Remove a property.void
removeMapEntry
(@NotNull String property, @NotNull Revision revision) Remove a map entry.void
Set the property to the given boolean value.void
Set the property to the given long value.void
Set the property to the given String value.void
setNew
(boolean isNew) shallowCopy
(String id) Creates an update operation for the document with the given id.toString()
-
Constructor Details
-
UpdateOp
Create an update operation for the document with the given id. The commit root is assumed to be the path, unless this is changed later on.- Parameters:
id
- the primary keyisNew
- whether this is a new document
-
-
Method Details
-
shallowCopy
Creates an update operation for the document with the given id. The changes are shared with the this update operation.- Parameters:
id
- the primary key.
-
copy
Creates a deep copy of this update operation. Changes to the returnedUpdateOp
do not affect this object.- Returns:
- a copy of this operation.
-
getId
-
isNew
public boolean isNew() -
setNew
public void setNew(boolean isNew) -
getChanges
-
getConditions
-
hasChanges
public boolean hasChanges()Checks if the UpdateOp has any change operation is registered with current update operation- Returns:
- true if any change operation is created
-
remove
Remove a property.- Parameters:
property
- the property name
-
removeMapEntry
Remove a map entry. The property is a map of revisions / values.- Parameters:
property
- the propertyrevision
- the revision
-
set
Set the property to the given long value.- Parameters:
property
- the property namevalue
- the value
-
set
Set the property to the given boolean value.- Parameters:
property
- the property namevalue
- the value
-
set
Set the property to the given String value.Note that
Document.ID
must not be set using this method; it is sufficiently specified by the id parameter set in the constructor.- Parameters:
property
- the property namevalue
- the value- Throws:
IllegalArgumentException
- if an attempt is made to setDocument.ID
.
-
increment
Increment the value.- Parameters:
property
- the keyvalue
- the increment
-
getReverseOperation
-
toString
-