Class WorkContextDelegate
- java.lang.Object
-
- com.redhat.parodos.workflow.context.WorkContextDelegate
-
public class WorkContextDelegate extends Object
Contains useful logic that is valuable for any WorkFlowTask implementation- Author:
- Luke Shannon (Github: lshannon), Richard Wang (Github: richardw98), Annel Ketcha (Github: anludke)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWorkContextDelegate.ProcessTypestatic classWorkContextDelegate.Resource
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringbuildKey(WorkContextDelegate.ProcessType processType, WorkContextDelegate.Resource resource)Used for creating a Key to store a value in the WorkFlowContextstatic StringbuildKey(WorkContextDelegate.ProcessType processType, String workflowTaskName, WorkContextDelegate.Resource resource)Used for creating a Key to store a value in the WorkFlowContextstatic StringgetOptionalValueFromRequestParams(WorkContext workContext, String key, String defaultValue)Gets an optional String value from the WorkContext with a known keystatic StringgetRequiredValueFromRequestParams(WorkContext workContext, String key)Gets a required value from the WorkContext with a known keystatic Objectread(WorkContext workContext, WorkContextDelegate.ProcessType processType, WorkContextDelegate.Resource resource)Gets a value from the WorkflowContext by generating a Key based on the characteristics of the value supplied to this methodstatic Objectread(WorkContext workContext, WorkContextDelegate.ProcessType processType, String workflowTaskName, WorkContextDelegate.Resource resource)Gets a value from the WorkflowContext by generating a Key based on the characteristics of the value supplied to this methodstatic voidwrite(WorkContext workContext, WorkContextDelegate.ProcessType processType, WorkContextDelegate.Resource resource, Object object)Gets a value from the WorkflowContext by generating a Key based on the characteristics of the value supplied to this methodstatic voidwrite(WorkContext workContext, WorkContextDelegate.ProcessType processType, String workName, WorkContextDelegate.Resource resource, Object object)Writes a value to the WorkflowContext.
-
-
-
Method Detail
-
buildKey
public static String buildKey(WorkContextDelegate.ProcessType processType, WorkContextDelegate.Resource resource)
Used for creating a Key to store a value in the WorkFlowContext- Parameters:
processType- the type of Workflow object being persisted (ie: WORKFLOW_TASK_DEFINITION)resource- the object related to the processType (ie: PARAMETERS)- Returns:
- the generated key
-
buildKey
public static String buildKey(WorkContextDelegate.ProcessType processType, String workflowTaskName, WorkContextDelegate.Resource resource)
Used for creating a Key to store a value in the WorkFlowContext- Parameters:
processType- the type of Workflow object being persisted (ie: WORKFLOW_TASK_DEFINITION)workflowTaskName- a unique identifier of a WorkflowTask in the event that multiple WorkflowTasks are persisting values for the the same processTpe and resourceresource- resource the object related to the processType (ie: PARAMETERS)- Returns:
-
read
public static Object read(WorkContext workContext, WorkContextDelegate.ProcessType processType, String workflowTaskName, WorkContextDelegate.Resource resource)
Gets a value from the WorkflowContext by generating a Key based on the characteristics of the value supplied to this method- Parameters:
workContext- reference to the contextprocessType- the type of Workflow object being persisted (ie: WORKFLOW_TASK_DEFINITION)workflowTaskName- a unique identifier of a WorkflowTask in the event that multiple WorkflowTasks have persisted this informationresource- the object related to the processType (ie: PARAMETERS)- Returns:
- the object obtained from the WorkflowContext using the generated key. A null is returned if the key does not return a value
-
write
public static void write(WorkContext workContext, WorkContextDelegate.ProcessType processType, String workName, WorkContextDelegate.Resource resource, Object object)
Writes a value to the WorkflowContext. A Key will be generated based on the characteristics of the value supplied to this method- Parameters:
workContext- reference to the contextprocessType- the type of Workflow object being persisted (ie: WORKFLOW_TASK_DEFINITION)workName- a unique identifier of a WorkflowTask in the event that multiple WorkflowTasks have persisted this informationresource- the object related to the processType (ie: PARAMETERS)object- the reference to store
-
read
public static Object read(WorkContext workContext, WorkContextDelegate.ProcessType processType, WorkContextDelegate.Resource resource)
Gets a value from the WorkflowContext by generating a Key based on the characteristics of the value supplied to this method- Parameters:
workContext- reference to the contextprocessType- the type of Workflow object being persisted (ie: WORKFLOW_TASK_DEFINITION)resource- the object related to the processType (ie: PARAMETERS)- Returns:
- the object obtained from the WorkflowContext using the generated key. A null is returned if the key does not return a value
-
write
public static void write(WorkContext workContext, WorkContextDelegate.ProcessType processType, WorkContextDelegate.Resource resource, Object object)
Gets a value from the WorkflowContext by generating a Key based on the characteristics of the value supplied to this method- Parameters:
workContext- reference to the contextprocessType- the type of Workflow object being persisted (ie: WORKFLOW_TASK_DEFINITION)resource- the object related to the processType (ie: PARAMETERS)
-
getRequiredValueFromRequestParams
public static String getRequiredValueFromRequestParams(WorkContext workContext, String key) throws MissingParameterException
Gets a required value from the WorkContext with a known key- Parameters:
workContext- reference from the workflow-engine that is shared across WorkFlowTaskskey- used to put/get values from the WorkContext- Returns:
- String value from the Map
- Throws:
MissingParameterException- if the value not found
-
getOptionalValueFromRequestParams
public static String getOptionalValueFromRequestParams(WorkContext workContext, String key, String defaultValue)
Gets an optional String value from the WorkContext with a known key- Parameters:
workContext- reference from the workflow-engine that is shared across WorkFlowTaskskey- used to put/get values from the WorkContext- Returns:
- String value from the Map or a null if that key does not exist
-
-