Class TermedDocumentUpdateBuilder

Direct Known Subclasses:
ItemUpdateBuilder, PropertyUpdateBuilder

public abstract class TermedDocumentUpdateBuilder extends LabeledDocumentUpdateBuilder
Builder for incremental construction of TermedStatementDocumentUpdate objects.
  • Constructor Details

    • TermedDocumentUpdateBuilder

      protected TermedDocumentUpdateBuilder(EntityIdValue entityId, long revisionId)
      Initializes new builder object for constructing update of entity with given ID.
      Parameters:
      entityId - ID of the entity that is to be updated
      revisionId - ID of the base entity revision to be updated or zero if not available
      Throws:
      NullPointerException - if entityId is null
      IllegalArgumentException - if entityId is a placeholder ID
    • TermedDocumentUpdateBuilder

      protected TermedDocumentUpdateBuilder(TermedStatementDocument revision)
      Initializes new builder object for constructing update of given base entity revision.
      Parameters:
      revision - base entity revision to be updated
      Throws:
      NullPointerException - if revision is null
      IllegalArgumentException - if revision has placeholder ID
  • Method Details

    • forBaseRevisionId

      public static TermedDocumentUpdateBuilder forBaseRevisionId(EntityIdValue entityId, long revisionId)
      Creates new builder object for constructing update of entity with given revision ID.

      Supported entity IDs include ItemIdValue and PropertyIdValue.

      Parameters:
      entityId - ID of the entity that is to be updated
      revisionId - ID of the base entity revision to be updated or zero if not available
      Returns:
      builder object matching entity type
      Throws:
      NullPointerException - if entityId is null
      IllegalArgumentException - if entityId is of unrecognized type or it is a placeholder ID
    • forEntityId

      public static TermedDocumentUpdateBuilder forEntityId(EntityIdValue entityId)
      Creates new builder object for constructing update of entity with given ID.

      Supported entity IDs include ItemIdValue and PropertyIdValue.

      Parameters:
      entityId - ID of the entity that is to be updated
      Returns:
      builder object matching entity type
      Throws:
      NullPointerException - if entityId is null
      IllegalArgumentException - if entityId is of unrecognized type or it is a placeholder ID
    • forBaseRevision

      public static TermedDocumentUpdateBuilder forBaseRevision(TermedStatementDocument revision)
      Creates new builder object for constructing update of given base entity revision. Provided entity document might not represent the latest revision of the entity as currently stored in Wikibase. It will be used for validation in builder methods. If the document has revision ID, it will be used to detect edit conflicts.

      Supported entity types include ItemDocument and PropertyDocument.

      Parameters:
      revision - base entity revision to be updated
      Returns:
      builder object matching entity type
      Throws:
      NullPointerException - if revision is null
      IllegalArgumentException - if revision is of unrecognized type or its ID is a placeholder ID
    • updateStatements

      public TermedDocumentUpdateBuilder updateStatements(StatementUpdate update)
      Description copied from class: StatementDocumentUpdateBuilder
      Updates entity statements. If this method is called multiple times, changes are accumulated. If base entity revision was provided, the update is checked against it and redundant changes are silently ignored, resulting in empty update.
      Overrides:
      updateStatements in class LabeledDocumentUpdateBuilder
      Parameters:
      update - statement update, possibly empty
      Returns:
      this (fluent method)
    • updateLabels

      public TermedDocumentUpdateBuilder updateLabels(TermUpdate update)
      Description copied from class: LabeledDocumentUpdateBuilder
      Updates entity labels. If this method is called multiple times, changes are accumulated. If base entity revision was provided, redundant changes are silently ignored, resulting in empty update.
      Overrides:
      updateLabels in class LabeledDocumentUpdateBuilder
      Parameters:
      update - changes in entity labels
      Returns:
      this (fluent method)
    • updateDescriptions

      public TermedDocumentUpdateBuilder updateDescriptions(TermUpdate update)
      Updates entity descriptions. If this method is called multiple times, changes are accumulated. If base entity revision was provided, redundant changes are silently ignored, resulting in empty update.
      Parameters:
      update - changes in entity descriptions
      Returns:
      this (fluent method)
      Throws:
      NullPointerException - if update is null
    • updateAliases

      public TermedDocumentUpdateBuilder updateAliases(String language, AliasUpdate update)
      Updates entity aliases. If this method is called multiple times, changes are accumulated. If base entity revision was provided, the update is checked against it and redundant changes are silently ignored, resulting in empty update.
      Parameters:
      language - language code of the altered aliases
      update - alias changes
      Returns:
      this (fluent method)
      Throws:
      NullPointerException - if language or aliases is null
      IllegalArgumentException - if language is blank or aliases has inconsistent language code
    • build

      public abstract TermedStatementDocumentUpdate build()
      Creates new TermedStatementDocumentUpdate object with contents of this builder object.
      Specified by:
      build in class LabeledDocumentUpdateBuilder
      Returns:
      constructed object