Class CreateItemCommand
- java.lang.Object
-
- com.sodius.mdw.metamodel.integrity.io.command.ExecutableCommandWrapper
-
- com.sodius.mdw.metamodel.integrity.io.command.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 itsType
.
Notes:
- A nested
SetFieldValueCommand
is automatically executed for each field value of thisItem
. - 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 createdItem
. - If the
Item
has aContained By
relation to its parent, you can control the insertion location using an instance ofInsertLocation
.
Usage:
new CreateItemCommand(myItem).execute(); new CreateItemCommand(myItem, InsertLocation.Factory.createFirst()).execute();
- See Also:
SetFieldValueCommand
,InsertLocation
-
-
Constructor Summary
Constructors Constructor Description CreateItemCommand(Item item)
Instantiates a command to create an item in the database.CreateItemCommand(Item item, InsertLocation insertLocation)
Instantiates a command to create an item in the database.
-
Method Summary
-
Methods inherited from class com.sodius.mdw.metamodel.integrity.io.command.ExecutableCommandWrapper
execute
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.sodius.mdw.metamodel.integrity.io.command.ExecutableCommand
execute
-
-
-
-
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
-
-