Class UpdateOp


  • public final class UpdateOp
    extends Object
    A DocumentStore "update" operation for one document.
    • Constructor Detail

      • UpdateOp

        public UpdateOp​(@NotNull
                        @NotNull 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 key
        isNew - whether this is a new document
    • Method Detail

      • shallowCopy

        public UpdateOp shallowCopy​(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 returned UpdateOp do not affect this object.
        Returns:
        a copy of this operation.
      • getId

        @NotNull
        public @NotNull String getId()
      • isNew

        public boolean isNew()
      • setNew

        public void setNew​(boolean isNew)
      • 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 String property)
        Remove a property.
        Parameters:
        property - the property name
      • removeMapEntry

        public void removeMapEntry​(@NotNull
                                   @NotNull String property,
                                   @NotNull
                                   @NotNull Revision revision)
        Remove a map entry. The property is a map of revisions / values.
        Parameters:
        property - the property
        revision - the revision
      • set

        public void set​(String property,
                        long value)
        Set the property to the given long value.
        Parameters:
        property - the property name
        value - the value
      • set

        public void set​(String property,
                        boolean value)
        Set the property to the given boolean value.
        Parameters:
        property - the property name
        value - the value
      • set

        public void set​(String property,
                        String value)
        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 name
        value - the value
        Throws:
        IllegalArgumentException - if an attempt is made to set Document.ID.
      • increment

        public void increment​(@NotNull
                              @NotNull String property,
                              long value)
        Increment the value.
        Parameters:
        property - the key
        value - the increment
      • getReverseOperation

        public UpdateOp getReverseOperation()