Class CreateRelationshipCommand

  • All Implemented Interfaces:
    ExecutableCommand

    public class CreateRelationshipCommand
    extends ExecutableCommandWrapper
    implements ExecutableCommand
    Creates new relationships between Items in the Integrity database.

    Constraints:

    • The FieldValue must be owned by its source Item.
    • The FieldValue must reference a Field.
    • All Items (either source or targets of the relation) must already exist in the database.

    Notes:

    • You might want to group the execution of multiple updates using a CompoundCommand.

    Usage:

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

      • CreateRelationshipCommand

        public CreateRelationshipCommand​(FieldValue fieldValue,
                                         Element targetElement)
        Instantiates a command to add a relationship in the database.
        Parameters:
        fieldValue - the field value which references a relation to create.
        targetElement - the target element of the relationship.
      • CreateRelationshipCommand

        public CreateRelationshipCommand​(FieldValue fieldValue,
                                         Collection<? extends Element> targetElements)
        Instantiates a command to add a relationship in the database.
        Parameters:
        fieldValue - the field value which references a relation to create.
        targetElements - the target elements of the relationship.