Data States
It is possible to explicitly define states by creating DataStates:
Invoice.xml
<dataElement name="Invoice">
<dataStates>
<dataState name="Initial"/>
<dataState name="Sent"/>
<dataState name="Paid"/>
<dataState name="Booked"/>
</dataStates>
</dataElement>
These values are then expanded as a <dataElement>State
enum:
public enum InvoiceState implements IStateDef {
INITIAL("Initial"),
SENT("Sent"),
PAID("Paid"),
BOOKED("Booked");
private String status;
//...
}
These enums describe the different states, which can be retrieved through the getStatus()
method.
The State class has 2 advantages:
- You can use the
setStatusEnum()
andgetStatusAsEnum()
method to manage the state of a details object. These methods add more type-safety than the standard String-based methods. - The State class is also used with the isBranchingTask Option.