Class AbstractSubdocMutationRequest

All Implemented Interfaces:
CouchbaseMessage, CouchbaseRequest, BinaryRequest, BinarySubdocMutationRequest, BinarySubdocRequest
Direct Known Subclasses:
SubArrayRequest, SubCounterRequest, SubDeleteRequest, SubDictAddRequest, SubDictUpsertRequest, SubReplaceRequest

@Committed
@Public
public abstract class AbstractSubdocMutationRequest
extends AbstractSubdocRequest
implements BinarySubdocMutationRequest
Base class for all BinarySubdocMutationRequest.
Since:
1.2
Author:
Simon Baslé
  • Constructor Details

    • AbstractSubdocMutationRequest

      protected AbstractSubdocMutationRequest​(String key, String path, ByteBuf fragment, String bucket, int expiration, long cas)
      Parameters:
      key - the key of the document.
      path - the subdocument path to consider inside the document.
      fragment - the fragment of valid JSON to mutate into at the site denoted by the path.
      bucket - the bucket of the document.
      expiration - the TTL of the whole enclosing document.
      cas - the cas value for the operation
      Throws:
      NullPointerException - if the path is null (see AbstractSubdocRequest.EXCEPTION_NULL_PATH)
    • AbstractSubdocMutationRequest

      protected AbstractSubdocMutationRequest​(String key, String path, ByteBuf fragment, String bucket, int expiration, long cas, rx.subjects.Subject<CouchbaseResponse,​CouchbaseResponse> observable)
      Parameters:
      key - the key of the document.
      path - the subdocument path to consider inside the document.
      fragment - the fragment of valid JSON to mutate into at the site denoted by the path.
      bucket - the bucket of the document.
      expiration - the TTL of the whole enclosing document.
      cas - the cas value for the operation
      observable - the observable which receives responses.
      Throws:
      NullPointerException - if the path is null (see AbstractSubdocRequest.EXCEPTION_NULL_PATH)
  • Method Details

    • expiration

      public int expiration()
      Specified by:
      expiration in interface BinarySubdocMutationRequest
      Returns:
      the expiration (or TTL) to apply to the document along the mutation, 0 for no TTL.
    • fragment

      public ByteBuf fragment()
      Description copied from interface: BinarySubdocMutationRequest
      A ByteBuf containing the JSON fragment for the mutation. It is appended to the BinarySubdocRequest.content(). This buffer is to be automatically released once the content has been written on the wire.
      Specified by:
      fragment in interface BinarySubdocMutationRequest
      Returns:
      the target value for the mutation (a fragment of the whole JSON document, valid JSON itself)
    • createIntermediaryPath

      public boolean createIntermediaryPath()
      Description copied from interface: BinarySubdocMutationRequest
      Sets whether missing nodes in the BinarySubdocRequest.path() should be created as part of this mutation, when possible. This is represented as an additional flag on the wire.
      Specified by:
      createIntermediaryPath in interface BinarySubdocMutationRequest
      Returns:
      true if missing JSON nodes in the path should be created, false otherwise.
    • createIntermediaryPath

      public void createIntermediaryPath​(boolean createIntermediaryPath)
      Modifies the request so that it requires the creation of missing intermediary nodes in the path if set to true.
      Parameters:
      createIntermediaryPath - true if missing intermediary nodes in the path should be created, false if they should be considered as errors.
    • xattr

      public boolean xattr()
      Description copied from interface: BinarySubdocMutationRequest
      Access to extended attribute section of the couchbase document
      Specified by:
      xattr in interface BinarySubdocMutationRequest
      Returns:
      true if accessing extended attribute section
    • xattr

      public void xattr​(boolean xattr)
    • expandMacros

      public boolean expandMacros()
      Description copied from interface: BinarySubdocMutationRequest
      Sets whether macros such as ${Mutation.CAS} should be expanded
      Specified by:
      expandMacros in interface BinarySubdocMutationRequest
      Returns:
      true iff macros should be expanded
    • expandMacros

      public void expandMacros​(boolean expandMacros)
    • cas

      public long cas()
      Specified by:
      cas in interface BinarySubdocMutationRequest
      Returns:
      the CAS to use for the mutation (if needed) or 0L to ignore
    • createDocument

      public boolean createDocument()
      Description copied from interface: BinarySubdocMutationRequest
      Create document if it does not exist. It is deprecated, use BinarySubdocMutationRequest.upsertDocument()
      Specified by:
      createDocument in interface BinarySubdocMutationRequest
      Returns:
      true if creating document
    • createDocument

      public void createDocument​(boolean createDocument)
    • upsertDocument

      public boolean upsertDocument()
      Description copied from interface: BinarySubdocMutationRequest
      Upsert document if it does not exist
      Specified by:
      upsertDocument in interface BinarySubdocMutationRequest
      Returns:
      true if creating document
    • upsertDocument

      public void upsertDocument​(boolean upsertDocument)
    • insertDocument

      public boolean insertDocument()
      Description copied from interface: BinarySubdocMutationRequest
      Add document only if it does not exist
      Specified by:
      insertDocument in interface BinarySubdocMutationRequest
      Returns:
      true if adding document
    • insertDocument

      public void insertDocument​(boolean insertDocument)