public class DefaultCmmnEngine extends Object implements CmmnEngine
<p>Exposes API to create state models and to trigger events on them. This class is to be used as a singleton (e.g. via Spring). It manages the state models in an internal cache.</p>
LowLevelStateModelUpdater.RecursionControl
Constructor and Description |
---|
DefaultCmmnEngine(Synchronizer synchronizer,
CmmnActionListener cmmnActionListener,
StateModelCache stateModelCache)
Instantiate the class given a particular cache implementation.
|
DefaultCmmnEngine(Synchronizer synchronizer,
StateModelCache stateModelCache)
Instantiate the class given a particular synchronizer cache implementation.
|
Modifier and Type | Method and Description |
---|---|
void |
caseTaskCompletionCheck(CasePlanModel casePlanModel,
TransitionData transitionData,
EngineListeners engineListeners,
PersistenceListeners persistenceListeners)
If this case is a child case (case task) of some other case (and it is in a terminal State), send the parent a corresponding termination event for this case task.
|
StateModel |
createStateModel(String caseClientId,
String parentCaseId,
Map<String,String> clientProperties,
TransitionData transitionData,
EngineListeners engineListeners,
PersistenceListeners persistenceListeners)
Create a particular state model for a new case.
|
List<AvailableAction> |
getAvailableActions(String caseClientId,
TransitionData transitionData,
EngineListeners engineListeners,
PersistenceListeners persistenceListeners)
Get the list of available actions for the case identified by the passed
caseClientId . |
List<CaseFileItem> |
getCaseFileItemInstances(String caseClientId,
String definitionType,
TransitionData transitionData,
PersistenceListeners persistenceListeners)
Query the static CMMN model of the case identified by the passed case client Id and return the list of configured
case file items.
|
CasePlanModel |
getCasePlanModel(String caseClientId,
TransitionData transitionData,
PersistenceListeners persistenceListeners)
Get the plan item representing the case’s Case Plan Model.
|
SynchronizedLowLevelCmmnService |
getCmmnService() |
List<CurrentState> |
getCurrentStates(String caseClientId,
TransitionData transitionData,
EngineListeners engineListeners,
PersistenceListeners persistenceListeners)
Get the list of current states for the case identified by the passed
caseClientId . |
PlanItemView |
getPlanItem(String caseClientId,
String planItemId,
TransitionData transitionData,
PersistenceListeners persistenceListeners,
EvaluationListeners evaluationListeners,
ViewCreators viewCreators)
Query a runtime case model and return a view on a particular plan item.
|
PlanItem |
getPlanItemInstance(String caseClientId,
String planItemId,
TransitionData transitionData,
PersistenceListeners persistenceListeners)
Query a runtime case model and return a particular plan item instance.
|
List<PlanItem> |
getPlanItemInstances(String caseClientId,
Class<? extends PlanItem> planItemType,
boolean singleInstanceMode,
TransitionData transitionData,
PersistenceListeners persistenceListeners)
Query a runtime case model and return all plan item instances of a certain type.
|
List<PlanItem> |
getPlanItemInstances(String caseClientId,
Class<? extends PlanItem> planItemType,
TransitionData transitionData,
PersistenceListeners persistenceListeners)
Calls
StateModelInspector.getPlanItemInstances(String, Class, boolean, TransitionData, PersistenceListeners) , passing false
for singleInstanceMode parameter. |
List<Map<String,Object>> |
getPlanItemProperties(String caseClientId,
Class<? extends PlanItem> planItemType,
boolean singleInstanceMode,
String[] properties,
TransitionData transitionData,
PersistenceListeners persistenceListeners,
EvaluationListeners evaluationListeners)
Query a runtime case model and return information about plan item instances of a certain type.
|
Map<String,Object> |
getPlanItemProperties(String caseClientId,
String planItemId,
String[] properties,
TransitionData transitionData,
PersistenceListeners persistenceListeners,
EvaluationListeners evaluationListeners)
Query a runtime case model and return information about the selected plan item.
|
List<PlanItemView> |
getPlanItems(String caseClientId,
Class<? extends PlanItem> planItemType,
boolean singleInstanceMode,
TransitionData transitionData,
PersistenceListeners persistenceListeners,
EvaluationListeners evaluationListeners,
ViewCreators viewCreators)
Query a runtime case model and return a list of views on plan items of a certain type.
|
List<PlanItemView> |
getPlanItems(String caseClientId,
Class<? extends PlanItem> planItemType,
TransitionData transitionData,
PersistenceListeners persistenceListeners,
EvaluationListeners evaluationListeners,
ViewCreators viewCreators)
Calls
StateModelInspector.getPlanItems(String, Class, boolean, TransitionData, PersistenceListeners, EvaluationListeners, ViewCreators) , passing false
for singleInstanceMode parameter. |
StateModel |
getStateModel(String caseClientId,
Map<String,String> clientProperties,
PersistenceListeners persistenceListeners)
Restore a state model either from cache or, if not in the cache, from the original case XML and the stored (persisted) runtime state of the case.
|
void |
handleCaseFileItemTransition(String caseClientId,
String sourceCaseFileItemId,
CaseFileItemTransition caseFileItemTransition,
TransitionData transitionData,
EngineListeners engineListeners,
PersistenceListeners persistenceListeners,
LowLevelStateModelUpdater.RecursionControl recursionControl)
Same as
StateModelUpdater.handleCaseFileItemTransition(String, String, com.edorasware.cmmn.model.xml.CaseFileItemTransition,
com.edorasware.cmmn.model.TransitionData, EngineListeners, PersistenceListeners) but with an additional parameter recursionControl . |
void |
handleCaseMigration(String caseClientId,
String oldCmmnXml,
String newCmmnXml,
Map<String,String> clientProperties,
TransitionData transitionData,
EngineListeners engineListeners,
PersistenceListeners persistenceListeners,
LowLevelStateModelUpdater.RecursionControl recursionControl)
Same as
StateModelUpdater.handleCaseMigration(String, String, String, Map, TransitionData, EngineListeners, PersistenceListeners)
but with an additional parameter recursionControl . |
void |
handleDiscretionaryItemPlanning(String caseClientId,
String discretionaryItemId,
TransitionData transitionData,
EngineListeners engineListeners,
PersistenceListeners persistenceListeners,
LowLevelStateModelUpdater.RecursionControl recursionControl)
Same as
StateModelUpdater.handleDiscretionaryItemPlanning(String, String,
com.edorasware.cmmn.model.TransitionData, com.edorasware.cmmn.engine.hooks.EngineListeners,
com.edorasware.cmmn.engine.hooks.PersistenceListeners)
but with an additional parameter recursionControl . |
void |
handlePlanItemTransition(String caseClientId,
String sourcePlanItemId,
PlanItemTransition planItemTransition,
TransitionData transitionData,
EngineListeners engineListeners,
PersistenceListeners persistenceListeners,
LowLevelStateModelUpdater.RecursionControl recursionControl)
Same as
StateModelUpdater.handlePlanItemTransition(String, String, com.edorasware.cmmn.model.xml.PlanItemTransition,
com.edorasware.cmmn.model.TransitionData, EngineListeners, PersistenceListeners) but with an additional parameter recursionControl . |
void |
handleStateUpdate(String caseClientId,
TransitionData transitionData,
EngineListeners engineListeners,
PersistenceListeners persistenceListeners,
LowLevelStateModelUpdater.RecursionControl recursionControl)
Same as
StateModelUpdater.handleStateUpdate(String, com.edorasware.cmmn.model.TransitionData,
com.edorasware.cmmn.engine.hooks.EngineListeners, com.edorasware.cmmn.engine.hooks.PersistenceListeners) but with an additional parameter recursionControl . |
static <T> T |
runtimeException(Exception e)
Wrap an exception in a
RuntimeException if necessary. |
void |
setCmmnService(SynchronizedLowLevelCmmnService cmmnService) |
public DefaultCmmnEngine(Synchronizer synchronizer, StateModelCache stateModelCache)
Instantiate the class given a particular synchronizer cache implementation.
synchronizer
- the synchronizer instance used to synchronize cross-case calls.public DefaultCmmnEngine(Synchronizer synchronizer, CmmnActionListener cmmnActionListener, StateModelCache stateModelCache)
Instantiate the class given a particular cache implementation.
synchronizer
- the synchronizer instance used to synchronize cross-case calls.cmmnActionListener
- an optional action listener implementation to receive action event notifications.public StateModel createStateModel(String caseClientId, String parentCaseId, Map<String,String> clientProperties, TransitionData transitionData, EngineListeners engineListeners, PersistenceListeners persistenceListeners) throws JAXBException, IOException
StateModelManager
Create a particular state model for a new case.
createStateModel
in interface StateModelManager
caseClientId
- the client ID for the case.parentCaseId
- the ID of the parent case. This applies only to cases created as a result of a CaseTask.clientProperties
- the client propertiestransitionData
- the transition dataengineListeners
- a callback object allowing the state engine to trigger actions in the calling client based on results (if any) from the executed transition.persistenceListeners
- persistence callbacks.JAXBException
- if there was a problem creating the state model from the XML.IOException
- if there was a problem creating the state model from the XML or if the initial state of the newly created state model could not be persisted.public void handleStateUpdate(String caseClientId, TransitionData transitionData, EngineListeners engineListeners, PersistenceListeners persistenceListeners, LowLevelStateModelUpdater.RecursionControl recursionControl) throws IOException, JAXBException
LowLevelStateModelUpdater
Same as StateModelUpdater.handleStateUpdate(String, com.edorasware.cmmn.model.TransitionData,
com.edorasware.cmmn.engine.hooks.EngineListeners, com.edorasware.cmmn.engine.hooks.PersistenceListeners)
but with an additional parameter recursionControl
.
handleStateUpdate
in interface LowLevelStateModelUpdater
IOException
JAXBException
public void handlePlanItemTransition(String caseClientId, String sourcePlanItemId, PlanItemTransition planItemTransition, TransitionData transitionData, EngineListeners engineListeners, PersistenceListeners persistenceListeners, LowLevelStateModelUpdater.RecursionControl recursionControl) throws IOException, JAXBException
LowLevelStateModelUpdater
Same as StateModelUpdater.handlePlanItemTransition(String, String, com.edorasware.cmmn.model.xml.PlanItemTransition,
com.edorasware.cmmn.model.TransitionData, EngineListeners, PersistenceListeners)
but with an additional parameter recursionControl
.
handlePlanItemTransition
in interface LowLevelStateModelUpdater
IOException
JAXBException
public void handleCaseFileItemTransition(String caseClientId, String sourceCaseFileItemId, CaseFileItemTransition caseFileItemTransition, TransitionData transitionData, EngineListeners engineListeners, PersistenceListeners persistenceListeners, LowLevelStateModelUpdater.RecursionControl recursionControl) throws IOException, JAXBException
LowLevelStateModelUpdater
Same as StateModelUpdater.handleCaseFileItemTransition(String, String, com.edorasware.cmmn.model.xml.CaseFileItemTransition,
com.edorasware.cmmn.model.TransitionData, EngineListeners, PersistenceListeners)
but with an additional parameter recursionControl
.
handleCaseFileItemTransition
in interface LowLevelStateModelUpdater
IOException
JAXBException
public void handleDiscretionaryItemPlanning(String caseClientId, String discretionaryItemId, TransitionData transitionData, EngineListeners engineListeners, PersistenceListeners persistenceListeners, LowLevelStateModelUpdater.RecursionControl recursionControl) throws IOException, JAXBException
LowLevelStateModelUpdater
Same as StateModelUpdater.handleDiscretionaryItemPlanning(String, String,
com.edorasware.cmmn.model.TransitionData, com.edorasware.cmmn.engine.hooks.EngineListeners,
com.edorasware.cmmn.engine.hooks.PersistenceListeners)
but with an additional parameter recursionControl
.
handleDiscretionaryItemPlanning
in interface LowLevelStateModelUpdater
IOException
JAXBException
public void handleCaseMigration(String caseClientId, String oldCmmnXml, String newCmmnXml, Map<String,String> clientProperties, TransitionData transitionData, EngineListeners engineListeners, PersistenceListeners persistenceListeners, LowLevelStateModelUpdater.RecursionControl recursionControl) throws IOException, JAXBException
LowLevelStateModelUpdater
Same as StateModelUpdater.handleCaseMigration(String, String, String, Map, TransitionData, EngineListeners, PersistenceListeners)
but with an additional parameter recursionControl
.
handleCaseMigration
in interface LowLevelStateModelUpdater
IOException
JAXBException
public List<CurrentState> getCurrentStates(String caseClientId, TransitionData transitionData, EngineListeners engineListeners, PersistenceListeners persistenceListeners) throws JAXBException, IOException
StateModelInspector
Get the list of current states for the case identified by the passed caseClientId
.
getCurrentStates
in interface StateModelInspector
caseClientId
- identifies the case (the case ID).transitionData
- optional evaluation context. Parameters passed here will be available for evaluation in run-time expressions.engineListeners
- a callback object allowing the state engine to trigger actions in the calling client based on results (if any) from the executed transition.persistenceListeners
- persistence callbacks.JAXBException
- if there was a problem creating the state model from the XML.IOException
- if there was a problem creating the state model from the XML or if the initial state of the newly created state model could not be persisted.public List<AvailableAction> getAvailableActions(String caseClientId, TransitionData transitionData, EngineListeners engineListeners, PersistenceListeners persistenceListeners) throws JAXBException, IOException
StateModelInspector
Get the list of available actions for the case identified by the passed caseClientId
.
getAvailableActions
in interface StateModelInspector
caseClientId
- identifies the case (the case ID).transitionData
- optional evaluation context. Parameters passed here will be available for evaluation in run-time expressions.engineListeners
- a callback object allowing the state engine to trigger actions in the calling client based on results (if any) from the executed transition.persistenceListeners
- persistence callbacks.JAXBException
- if there was a problem creating the state model from the XML.IOException
- if there was a problem creating the state model from the XML or if the initial state of the newly created state model could not be persisted.public PlanItemView getPlanItem(String caseClientId, String planItemId, TransitionData transitionData, PersistenceListeners persistenceListeners, EvaluationListeners evaluationListeners, ViewCreators viewCreators) throws JAXBException, IOException
StateModelInspector
Query a runtime case model and return a view on a particular plan item.
getPlanItem
in interface StateModelInspector
caseClientId
- identifies the case (the case ID).planItemId
- the plan item Id - model Id, instance Id, client Id or client reference (will match in this order).
In case of ambiguity, selects the highest instance Id for the selected model element.transitionData
- optional evaluation context. Parameters passed here will be available for evaluation in run-time expressions.persistenceListeners
- persistence callbacks.viewCreators
- view creator callbacks.planItemId
.JAXBException
- if there was a problem creating the state model from the XML.IOException
- if there was a problem creating the state model from the XML or if the initial state of the newly created state model could not be persisted.public List<PlanItemView> getPlanItems(String caseClientId, Class<? extends PlanItem> planItemType, TransitionData transitionData, PersistenceListeners persistenceListeners, EvaluationListeners evaluationListeners, ViewCreators viewCreators) throws JAXBException, IOException
StateModelInspector
Calls StateModelInspector.getPlanItems(String, Class, boolean, TransitionData, PersistenceListeners, EvaluationListeners, ViewCreators)
, passing false
for singleInstanceMode
parameter.
getPlanItems
in interface StateModelInspector
JAXBException
IOException
public List<PlanItemView> getPlanItems(String caseClientId, Class<? extends PlanItem> planItemType, boolean singleInstanceMode, TransitionData transitionData, PersistenceListeners persistenceListeners, EvaluationListeners evaluationListeners, ViewCreators viewCreators) throws JAXBException, IOException
StateModelInspector
Query a runtime case model and return a list of views on plan items of a certain type.
getPlanItems
in interface StateModelInspector
caseClientId
- identifies the case (the case ID).planItemType
- the type of plan item to collect. Honors class hierarchy, i.e. you can pass any super-class
type to get all plan item instances of the super-class type and any sub-types.singleInstanceMode
- pass true
to only select one instance per model plan item (selects the one with the highest instance Id).transitionData
- optional evaluation context. Parameters passed here will be available for evaluation in run-time expressions.persistenceListeners
- persistence callbacks.viewCreators
- view creator callbacks.planItemType
.JAXBException
- if there was a problem creating the state model from the XML.IOException
- if there was a problem creating the state model from the XML or if the initial state of the newly created state model could not be persisted.public Map<String,Object> getPlanItemProperties(String caseClientId, String planItemId, String[] properties, TransitionData transitionData, PersistenceListeners persistenceListeners, EvaluationListeners evaluationListeners) throws JAXBException, IOException
StateModelInspector
Query a runtime case model and return information about the selected plan item. The information collected and returned is
specified via the properties
parameter. The result of the method is a map representing the plan item instance.
The map elements to be populated are specified via the properties
parameter. Each property listed will be available in the
result map as a key/value pair. The properties are resolved via reflection against
a DefaultPlanItemView
.
getPlanItemProperties
in interface StateModelInspector
caseClientId
- identifies the case (the case ID).planItemId
- the plan item Id - model Id, instance Id, client Id or client reference (will match in this order).
In case of ambiguity, selects the highest instance Id for the selected model element.properties
- the list of bean properties to get.transitionData
- optional evaluation context. Parameters passed here will be available for evaluation in run-time expressions.persistenceListeners
- persistence callbacks.JAXBException
- if there was a problem creating the state model from the XML.IOException
- if there was a problem creating the state model from the XML or if the initial state of the newly created state model could not be persisted.public List<Map<String,Object>> getPlanItemProperties(String caseClientId, Class<? extends PlanItem> planItemType, boolean singleInstanceMode, String[] properties, TransitionData transitionData, PersistenceListeners persistenceListeners, EvaluationListeners evaluationListeners) throws JAXBException, IOException
StateModelInspector
Query a runtime case model and return information about plan item instances of a certain type. The information collected and returned is
specified via the properties
parameter. The result of the method is a list of maps. Each map represents a plan item instance.
The map elements to be populated are specified via the properties
parameter. Each property listed will be available in the
respective result map as a key/value pair. The properties are resolved via reflection against
a DefaultPlanItemView
for each selected plan item. Make sure to include a suitable id property
in your properties list to make sure that you can clearly associate the returned maps to plan item instances.
getPlanItemProperties
in interface StateModelInspector
caseClientId
- identifies the case (the case ID).planItemType
- the type of plan item to collect. Honors class hierarchy, i.e. you can pass any super-class
type to get all plan item instances of the super-class type and any sub-types.singleInstanceMode
- pass true
to only select one instance per model plan item (selects the one with the highest instance Id).properties
- the list of bean properties to get.transitionData
- optional evaluation context. Parameters passed here will be available for evaluation in run-time expressions.persistenceListeners
- persistence callbacks.planItemType
.JAXBException
- if there was a problem creating the state model from the XML.IOException
- if there was a problem creating the state model from the XML or if the initial state of the newly created state model could not be persisted.public PlanItem getPlanItemInstance(String caseClientId, String planItemId, TransitionData transitionData, PersistenceListeners persistenceListeners) throws JAXBException, IOException
StateModelInspector
Query a runtime case model and return a particular plan item instance.
getPlanItemInstance
in interface StateModelInspector
caseClientId
- identifies the case (the case ID).planItemId
- the plan item Id - model Id, instance Id, client Id or client reference (will match in this order).
In case of ambiguity, selects the highest instance Id for the selected model element.transitionData
- optional evaluation context. Parameters passed here will be available for evaluation in run-time expressions.persistenceListeners
- persistence callbacks.planItemId
.JAXBException
- if there was a problem creating the state model from the XML.IOException
- if there was a problem creating the state model from the XML or if the initial state of the newly created state model could not be persisted.public CasePlanModel getCasePlanModel(String caseClientId, TransitionData transitionData, PersistenceListeners persistenceListeners) throws JAXBException, IOException
StateModelInspector
Get the plan item representing the case’s Case Plan Model.
getCasePlanModel
in interface StateModelInspector
caseClientId
- identifies the case (the case ID).transitionData
- optional evaluation context. Parameters passed here will be available for evaluation in run-time expressions.persistenceListeners
- persistence callbacks.JAXBException
- if there was a problem creating the state model from the XML.IOException
- if there was a problem creating the state model from the XML or if the initial state of the newly created state model could not be persisted.public List<PlanItem> getPlanItemInstances(String caseClientId, Class<? extends PlanItem> planItemType, TransitionData transitionData, PersistenceListeners persistenceListeners) throws JAXBException, IOException
StateModelInspector
Calls StateModelInspector.getPlanItemInstances(String, Class, boolean, TransitionData, PersistenceListeners)
, passing false
for singleInstanceMode
parameter.
getPlanItemInstances
in interface StateModelInspector
JAXBException
IOException
public List<PlanItem> getPlanItemInstances(String caseClientId, Class<? extends PlanItem> planItemType, boolean singleInstanceMode, TransitionData transitionData, PersistenceListeners persistenceListeners) throws JAXBException, IOException
StateModelInspector
Query a runtime case model and return all plan item instances of a certain type.
getPlanItemInstances
in interface StateModelInspector
caseClientId
- identifies the case (the case ID).planItemType
- the type of plan item to collect. Honors class hierarchy, i.e. you can pass any super-class
type to get all plan item instances of the super-class type and any sub-types.singleInstanceMode
- pass true
to only select one instance per model plan item (selects the one with the highest instance Id).transitionData
- optional evaluation context. Parameters passed here will be available for evaluation in run-time expressions.persistenceListeners
- persistence callbacks.planItemType
.JAXBException
- if there was a problem creating the state model from the XML.IOException
- if there was a problem creating the state model from the XML or if the initial state of the newly created state model could not be persisted.public List<CaseFileItem> getCaseFileItemInstances(String caseClientId, String definitionType, TransitionData transitionData, PersistenceListeners persistenceListeners) throws JAXBException, IOException
StateModelInspector
Query the static CMMN model of the case identified by the passed case client Id and return the list of configured case file items.
getCaseFileItemInstances
in interface StateModelInspector
caseClientId
- identifies the case (the case ID).definitionType
- the type of case file items to return. Passing null
returns any type.transitionData
- optional evaluation context. Parameters passed here will be available for evaluation in run-time expressions.persistenceListeners
- persistence callbacks.JAXBException
- if there was a problem creating the state model from the XML.IOException
- if there was a problem creating the state model from the XML or if the initial state of the newly created state model could not be persisted.public void caseTaskCompletionCheck(CasePlanModel casePlanModel, TransitionData transitionData, EngineListeners engineListeners, PersistenceListeners persistenceListeners) throws IOException, JAXBException
If this case is a child case (case task) of some other case (and it is in a terminal State), send the parent a corresponding termination event for this case task.
casePlanModel
- the case plan model to test.engineListeners
- a callback object allowing the state engine to trigger actions in the calling client based on results (if any) from the executed transition.persistenceListeners
- after the event (transition) has been handled, the updated state of the case is persisted using this listener implementation.IOException
- in case of an IO exception.JAXBException
- in case of a JAXB exception.public StateModel getStateModel(String caseClientId, Map<String,String> clientProperties, PersistenceListeners persistenceListeners) throws JAXBException, IOException
StateModelManager
Restore a state model either from cache or, if not in the cache, from the original case XML and the stored (persisted) runtime state of the case.
getStateModel
in interface StateModelManager
caseClientId
- the case client ID.persistenceListeners
- persistence callbacks.JAXBException
- if there was a problem restoring the state model from the XML.IOException
- if there was a problem creating the state model from the XML or from the saved case state.public void setCmmnService(SynchronizedLowLevelCmmnService cmmnService)
setCmmnService
in interface CmmnEngine
public SynchronizedLowLevelCmmnService getCmmnService()
getCmmnService
in interface CmmnEngine
public static <T> T runtimeException(Exception e) throws RuntimeException
Wrap an exception in a RuntimeException
if necessary.
T
- the return type. Can be any type.e
- the exception.RuntimeException
- the wrapped (if necessary) runtime exception.Copyright © 2010 - 2019 edorasware ag. All Rights Reserved.