Class UpdateOp
- java.lang.Object
-
- org.apache.jackrabbit.oak.plugins.document.UpdateOp
-
public final class UpdateOp extends java.lang.ObjectA DocumentStore "update" operation for one document.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classUpdateOp.ConditionA condition to check before an update is applied.static classUpdateOp.KeyA key for an operation consists of a property name and an optional revision.static classUpdateOp.OperationA DocumentStore operation for a given key within a document.
-
Constructor Summary
Constructors Constructor Description UpdateOp(@NotNull java.lang.String id, boolean isNew)Create an update operation for the document with the given id.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description UpdateOpcopy()Creates a deep copy of this update operation.java.util.Map<UpdateOp.Key,UpdateOp.Operation>getChanges()java.util.Map<UpdateOp.Key,UpdateOp.Condition>getConditions()@NotNull java.lang.StringgetId()UpdateOpgetReverseOperation()booleanhasChanges()Checks if the UpdateOp has any change operation is registered with current update operationvoidincrement(@NotNull java.lang.String property, long value)Increment the value.booleanisNew()voidremove(@NotNull java.lang.String property)Remove a property.voidremoveMapEntry(@NotNull java.lang.String property, @NotNull Revision revision)Remove a map entry.voidset(java.lang.String property, boolean value)Set the property to the given boolean value.voidset(java.lang.String property, long value)Set the property to the given long value.voidset(java.lang.String property, java.lang.String value)Set the property to the given String value.voidsetNew(boolean isNew)UpdateOpshallowCopy(java.lang.String id)Creates an update operation for the document with the given id.java.lang.StringtoString()
-
-
-
Constructor Detail
-
UpdateOp
public UpdateOp(@NotNull @NotNull java.lang.String id, boolean isNew)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 Detail
-
shallowCopy
public UpdateOp shallowCopy(java.lang.String id)
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
public UpdateOp copy()
Creates a deep copy of this update operation. Changes to the returnedUpdateOpdo not affect this object.- Returns:
- a copy of this operation.
-
getId
@NotNull public @NotNull java.lang.String getId()
-
isNew
public boolean isNew()
-
setNew
public void setNew(boolean isNew)
-
getChanges
public java.util.Map<UpdateOp.Key,UpdateOp.Operation> getChanges()
-
getConditions
public java.util.Map<UpdateOp.Key,UpdateOp.Condition> 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
public void remove(@NotNull @NotNull java.lang.String property)Remove a property.- Parameters:
property- the property name
-
removeMapEntry
public void removeMapEntry(@NotNull @NotNull java.lang.String property, @NotNull @NotNull Revision revision)Remove a map entry. The property is a map of revisions / values.- Parameters:
property- the propertyrevision- the revision
-
set
public void set(java.lang.String property, long value)Set the property to the given long value.- Parameters:
property- the property namevalue- the value
-
set
public void set(java.lang.String property, boolean value)Set the property to the given boolean value.- Parameters:
property- the property namevalue- the value
-
set
public void set(java.lang.String property, java.lang.String value)Set the property to the given String value.Note that
Document.IDmust 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:
java.lang.IllegalArgumentException- if an attempt is made to setDocument.ID.
-
increment
public void increment(@NotNull @NotNull java.lang.String property, long value)Increment the value.- Parameters:
property- the keyvalue- the increment
-
getReverseOperation
public UpdateOp getReverseOperation()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-