Class SetFieldValueCommand

  • All Implemented Interfaces:
    ExecutableCommand

    public class SetFieldValueCommand
    extends ExecutableCommandWrapper
    implements ExecutableCommand
    Updates the value of specific Item field in the Integrity database.

    Constraints:

    • The FieldValue must be owned by its Item.
    • The FieldValue must reference a Field.

    Notes:

    • In case the value is a reference to Items (e.g. FieldElementValue or FieldElementListValue), only references to Items which already exist in the database (i.e. whose id is not 0) are created.
    • In case the value is a reference to Items, you might prefer to use a CreateRelationshipCommand to control exactly which relations are to be created.
    • You might want to group the execution of multiple updates using a CompoundCommand.
    • To set a FieldIntValue, FieldDoubleValue or a FieldBooleanValue with the value null, you need to use a specific workaround. For that you need to use a FieldStringValue instead of one of them, referencing the Field to set (setField(Field)) with the value null (setValue(null)).
    • Usage:

       new SetFieldValueCommand(myValue).execute();
       
    See Also:
    CompoundCommand, CreateRelationshipCommand
    • Constructor Detail

      • SetFieldValueCommand

        public SetFieldValueCommand​(FieldValue fieldValue)
        Instantiates a command to update the value of an item.
        Parameters:
        fieldValue - references the field that must be updated and the new value to assign.