diff --git a/modules/flowable-cmmn-api/src/main/java/org/flowable/cmmn/api/runtime/CaseInstance.java b/modules/flowable-cmmn-api/src/main/java/org/flowable/cmmn/api/runtime/CaseInstance.java index 613cc9d84f7..121ff6240ec 100644 --- a/modules/flowable-cmmn-api/src/main/java/org/flowable/cmmn/api/runtime/CaseInstance.java +++ b/modules/flowable-cmmn-api/src/main/java/org/flowable/cmmn/api/runtime/CaseInstance.java @@ -38,4 +38,22 @@ public interface CaseInstance { */ Map getCaseVariables(); + /** + * Returns the variable with the requested name, if it exists and if the variables have been requested when fetching this case instance. + * + * @param variableName the name of the variable to return its value + * @return the variable value or {@code null} if it does not exist or if the variables have not been requested when fetching this case + */ + Object getVariable(String variableName); + + /** + * + * Returns the variable with the requested name, if it exists and if the variables have been requested when fetching this case instance. + * + * @param variableName the name of the variable to return its value + * @param variableClass the expected class of the variable value for type safe access + * @param the type of the variable value + * @return the variable value or {@code null} if it does not exist or if the variables have not been requested when fetching this case + */ + T getVariable(String variableName, Class variableClass); } diff --git a/modules/flowable-engine/src/main/java/org/flowable/engine/runtime/ProcessInstance.java b/modules/flowable-engine/src/main/java/org/flowable/engine/runtime/ProcessInstance.java index af9bc61ca17..a360f3c70f7 100644 --- a/modules/flowable-engine/src/main/java/org/flowable/engine/runtime/ProcessInstance.java +++ b/modules/flowable-engine/src/main/java/org/flowable/engine/runtime/ProcessInstance.java @@ -68,6 +68,25 @@ public interface ProcessInstance extends Execution { */ Map getProcessVariables(); + /** + * Returns the variable with the requested name, if it exists and if the variables have been requested when fetching this case instance. + * + * @param variableName the name of the variable to return its value + * @return the variable value or {@code null} if it does not exist or if the variables have not been requested when fetching this case + */ + Object getVariable(String variableName); + + /** + * + * Returns the variable with the requested name, if it exists and if the variables have been requested when fetching this case instance. + * + * @param variableName the name of the variable to return its value + * @param variableClass the expected class of the variable value for type safe access + * @param the type of the variable value + * @return the variable value or {@code null} if it does not exist or if the variables have not been requested when fetching this case + */ + T getVariable(String variableName, Class variableClass); + /** * The tenant identifier of this process instance */