Using Commands to interact with Integrity

You can execute atomic commands to interact directly with Integrity database:

A command is a small and direct interaction between the Java program and the Integrity server. When executed, the modification made by the command occurs on the Integrity database itself, not on the Integrity EMF model loaded in memory.

Commands that modify the same specific Item can be grouped in a CompoundCommand. A CompoundCommand is used to minimize the number of executions between a Java program and the Integrity server.

Here is an example to update a field of an existing Item:

import com.sodius.mdw.metamodel.integrity.*;
import com.sodius.mdw.metamodel.integrity.io.command.SetFieldValueCommand;
...

// Get access to a specific Type by its name
Type type = myDatabase.getType("Requirement Document");

// Look for an existing Item using its id
Item myItem = type.getItem(1502);

// Modify a field of this Item (modification in the model only, in memory)
FieldStringValue titleValue = (FieldStringValue) myItem.getValue("Title");
titleValue.setValue("An updated title");

// Execute a command to update the field in Integrity database
new SetFieldValueCommand(titleValue).execute();

Related reference
Commands APIs