Class FormUpdateBuilder
java.lang.Object
org.wikidata.wdtk.datamodel.helpers.EntityUpdateBuilder
org.wikidata.wdtk.datamodel.helpers.StatementDocumentUpdateBuilder
org.wikidata.wdtk.datamodel.helpers.FormUpdateBuilder
Builder for incremental construction of
FormUpdate
objects.-
Method Summary
Modifier and TypeMethodDescriptionappend
(FormUpdate update) Replays all changes in provided update into this builder object.build()
Creates newStatementDocumentUpdate
object with contents of this builder object.static FormUpdateBuilder
forBaseRevision
(FormDocument revision) Creates new builder object for constructing update of given base form entity revision.static FormUpdateBuilder
forBaseRevisionId
(FormIdValue formId, long revisionId) Creates new builder object for constructing update of form entity with given revision ID.static FormUpdateBuilder
forEntityId
(FormIdValue formId) Creates new builder object for constructing update of form entity with given ID.setGrammaticalFeatures
(Collection<ItemIdValue> features) Sets grammatical features of the form.updateRepresentations
(TermUpdate update) Updates form representations.updateStatements
(StatementUpdate update) Updates entity statements.Methods inherited from class org.wikidata.wdtk.datamodel.helpers.StatementDocumentUpdateBuilder
forBaseRevision, forBaseRevisionId, forEntityId
Methods inherited from class org.wikidata.wdtk.datamodel.helpers.EntityUpdateBuilder
forBaseRevision
-
Method Details
-
forBaseRevisionId
Creates new builder object for constructing update of form entity with given revision ID.- Parameters:
formId
- ID of the form that is to be updatedrevisionId
- ID of the base form revision to be updated or zero if not available- Returns:
- update builder object
- Throws:
NullPointerException
- ifformId
isnull
IllegalArgumentException
- ifformId
is a placeholder ID
-
forEntityId
Creates new builder object for constructing update of form entity with given ID.- Parameters:
formId
- ID of the form that is to be updated- Returns:
- update builder object
- Throws:
NullPointerException
- ifformId
isnull
IllegalArgumentException
- ifformId
is a placeholder ID
-
forBaseRevision
Creates new builder object for constructing update of given base form entity revision. Provided form document might not represent the latest revision of the form 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.- Parameters:
revision
- base form entity revision to be updated- Returns:
- update builder object
- Throws:
NullPointerException
- ifrevision
isnull
IllegalArgumentException
- ifrevision
has placeholder ID
-
updateStatements
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 classStatementDocumentUpdateBuilder
- Parameters:
update
- statement update, possibly empty- Returns:
this
(fluent method)
-
updateRepresentations
Updates form representations. 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 form representations- Returns:
this
(fluent method)- Throws:
NullPointerException
- ifupdate
isnull
-
setGrammaticalFeatures
Sets grammatical features of the form. Any previously assigned grammatical features are removed. To remove all grammatical features without replacement, call this method with empty collection. If base entity revision was provided, attempt to replace grammatical features with identical set is silently ignored, resulting in empty update.- Parameters:
features
- new grammatical features of the form- Returns:
this
(fluent method)- Throws:
NullPointerException
- iffeatures
or any of its items isnull
IllegalArgumentException
- if any item ID infeatures
is a placeholder ID or if there are duplicate features
-
append
Replays all changes in provided update into this builder object. Changes from the update are added on top of changes already present in this builder object.- Parameters:
update
- form update to replay- Returns:
this
(fluent method)- Throws:
NullPointerException
- ifupdate
isnull
IllegalArgumentException
- ifupdate
cannot be applied to base entity revision (if available)
-
build
Description copied from class:StatementDocumentUpdateBuilder
Creates newStatementDocumentUpdate
object with contents of this builder object.- Specified by:
build
in classStatementDocumentUpdateBuilder
- Returns:
- constructed object
-