Class CreateItemCommand

  • All Implemented Interfaces:
    ExecutableCommand

    public class CreateItemCommand
    extends ExecutableCommandWrapper
    implements ExecutableCommand

    Creates a new Item in the Integrity database.

    Constraints:

    • The Item must be owned by its Type.

    Notes:

    • A nested SetFieldValueCommand is automatically executed for each field value of this Item.
    • When the command execution is completed, the id of the Item is updated to match the one in the database, so that other commands can be executed on this created Item.
    • If the Item has a Contained By relation to its parent, you can control the insertion location using an instance of InsertLocation.

    Usage:

     new CreateItemCommand(myItem).execute();
     new CreateItemCommand(myItem, InsertLocation.Factory.createFirst()).execute();
     
    See Also:
    SetFieldValueCommand, InsertLocation
    • Constructor Detail

      • CreateItemCommand

        public CreateItemCommand​(Item item)
        Instantiates a command to create an item in the database. The item will be inserted as last child of its parent, if any.
        Parameters:
        item - the item to create in the database.
      • CreateItemCommand

        public CreateItemCommand​(Item item,
                                 InsertLocation insertLocation)
        Instantiates a command to create an item in the database.
        Parameters:
        item - the item to create in the database.
        insertLocation - the location in the document where to insert the item.
        Since:
        1.3.0