API java: get old variable value

1
+1
-1

Hi, I have an active process with three tasks (task1, task2, task3) and one variable "name". Each task sets the value of the variable name: task1 => name = 'Pippo' task2 => name = 'Pluto' task3 => name = 'Mario'

Using processAPI.getProcessDataInstances or processAPI.getArchivedProcessDataInstances Bonita always returns the value of task3 Mario.

How should I do to get the value of the task1 'Pippo'?

Thanks Manolo

2 answers

1
0
-1

Ok, thanks.

I try it.

Manolo

1
0
-1

Hi Manolo,

I don't think there such a method in the API. But you can use the method ProcessAPI#evaluateExpressionsOnCompletedActivityInstance with an expression of type Variable. Something like:

  1. Map<Expression, Map<String, Serializable>> expressions = new HashMap<Expression, Map<String,Serializable>>();
  2. ExpressionBuilder expressionBuilder = new ExpressionBuilder();
  3. expressionBuilder.createDataExpression("name", String.class.getName());
  4. expressions.put(expressionBuilder.done(), new HashMap<String, Serializable>());
  5. Map<String, Serializable> evaluationResult = processAPI.evaluateExpressionsOnCompletedActivityInstance(archivedActivityInstanceId, expressions);
  6. String nameDataValue = evaluationResult.get("name");

Hope that helps Anthony

Notifications