Querying and Recalculating Activity Criticality

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.

Retrieving Criticality of an Activity Instance

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();

Querying for Criticality

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);

Calculation and Recalculation during Activity Processing

The following use cases results in recalculation of the activity criticality:

Activity creation

When you create a new activity, the initial activity criticality value is calculated using the javaScript formula for the model containing the current activity and the corresponding algorithm.

Changing Process Priority

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:

Modifying Process Data via suspend()

Activity criticality is recalculated whenever any of the following suspend()-methods of the WorkflowService is called:

Controlling Recalculation Behavior

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:

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.