Interface StateEntityService<T extends StateEntity>

Type Parameters:
T - the actual state entity
All Known Implementing Classes:
StateEntityServiceImpl

public interface StateEntityService<T extends StateEntity>
All workflow entities (aka State entities) are managed using this interface.
Workflow entities contain state. State marches forward in accordance with a State Transition Diagram (STD)
The STD is read by a State Transition Machine.
All State entities are either created or processed in accordance with certain rules defined in the State Transition Diagram. Read more about state machines here.
  • Method Details

    • process

      StateEntityServiceResponse<T> process(T entity, String event, Object payload)
      Parameters:
      entity - the entity on which the event has happened
      event - - the name of the event that happened on the entity
      payload - - Additional parameters for the event (event specific)
      Returns:
      a StateEntityServiceResponse with the mutated entity
    • processById

      StateEntityServiceResponse<T> processById(String id, String event, Object payload)
      Parameters:
      id - - the ID of the event. This is useful if the entire entity is not passed by the front end
      event - - Name of the event that has happened on the entity
      payload - - Additional parameters for the event (event specific)
      Returns:
      a StateEntityServiceResponse with the mutated entity
    • create

      StateEntityServiceResponse<T> create(T entity)
      Parameters:
      entity - the state entity that needs to be created.
      Returns:
      the state entity along with the allowed actions on the state entity. The state entity that is returned, will have the initial state initialized (along with other obvious attributes such as ID, created by, tenancy (if applicable) etc.
    • retrieve

      Parameters:
      id - The ID of the state entity
      Returns:
      the state entity along with allowed actions
    • getAllowedActionsAndMetadata

      List<Map<String,String>> getAllowedActionsAndMetadata(State state)
    • getAllowedActionsAndMetadata

      List<Map<String,String>> getAllowedActionsAndMetadata(String id)