This chapter describes how to query for specific criticality aspects, how specific activity processing influences the recalculation of activity criticality and how the recalculation behavior can be controlled.
To retrieve the current criticality of an activity instance, use the method getCriticality of the ActivityInstance object.
/** * Returns the current criticality of an activity instance * * @return the value if the criticality */ double getCriticality();
The ActivityInstanceQuery and the WorklistQuery provide the following query functionality for criticality:
Sorting and filtering for criticality attributes is possible through the filterable CRITICALITY attribute of the ActivityInstanceQuery and the ACTIVITY_INSTANCE_CRITICALITY attribute of the WorklistQuery. Those can be added to the queries as in following example:
ActivityInstanceQuery query = ActivityInstanceQuery.findAlive(); query.where(ActivityInstanceQuery.CRITICALITY.greaterOrEqual(limit)); ActivityInstances ais = qrService.getAllActivityInstances(query); WorklistQuery wQuery = WorklistQuery.findCompleteWorklist(); wQuery.where(WorklistQuery.ACTIVITY_INSTANCE_CRITICALITY.between(0, 1)); Worklist wList = wfService.getWorklist(wQuery);
The following use cases results in recalculation of the activity criticality:
Whenever you change the priority for the process instance containing the current activity, the activity criticality is recalculated and stored analogously. The following methods to change process priority result in a reevaluation of the dependent activity criticality:
ProcessInstance setProcessInstancePriority(long oid, int priority) ProcessInstance setProcessInstancePriority(long oid, int priority, boolean propagateToSubProcessesRefer to chapter Changing Process Instance Priorities for details on these methods.
Activity criticality is recalculated whenever any of the following suspend()-methods of the WorkflowService is called:
The recalculation behavior can be configured with the following Preferences keys within the Preference store:
These keys can be used to specify whether criticality should be reevaluated for the following use cases or not:
The scope for the preferences is PARTITION, the module id is engine-internals and the preference id is workflow-criticalities. To change the preferences accordingly:
Preferences getPreferences("PARTITION","engine-internals", "workflow-criticalities");
void savePreferences(Preferences preferences);
Refer to section Retrieving preferences from a given scope and Saving Preferences of chapter Retrieving and Changing Preferences respectively for details on getting and saving preferences methods of the AdministrationService.