use of com.evolveum.midpoint.wf.impl.util.MiscDataUtil in project midpoint by Evolveum.
the class WfExpressionEvaluationHelper method getDefaultVariables.
public ExpressionVariables getDefaultVariables(@Nullable DelegateExecution execution, Task wfTask, OperationResult result) throws SchemaException, ObjectNotFoundException {
MiscDataUtil miscDataUtil = getMiscDataUtil();
ExpressionVariables variables = new ExpressionVariables();
variables.addVariableDefinition(C_REQUESTER, miscDataUtil.resolveObjectReference(wfTask.getWorkflowContext().getRequesterRef(), result));
variables.addVariableDefinition(C_OBJECT, miscDataUtil.resolveObjectReference(wfTask.getWorkflowContext().getObjectRef(), result));
// might be null
variables.addVariableDefinition(C_TARGET, miscDataUtil.resolveObjectReference(wfTask.getWorkflowContext().getTargetRef(), result));
ObjectDelta objectDelta;
try {
objectDelta = miscDataUtil.getFocusPrimaryDelta(wfTask.getWorkflowContext(), true);
} catch (JAXBException e) {
throw new SchemaException("Couldn't get object delta: " + e.getMessage(), e);
}
variables.addVariableDefinition(SchemaConstants.T_OBJECT_DELTA, objectDelta);
// Activiti process instance variables (use with care)
if (execution != null) {
execution.getVariables().entrySet().forEach(e -> variables.addVariableDefinition(new QName("_" + e.getKey()), e.getValue()));
}
return variables;
}
Aggregations