Search in sources :

Example 1 with MiscDataUtil

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;
}
Also used : ExpressionVariables(com.evolveum.midpoint.repo.common.expression.ExpressionVariables) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) SpringApplicationContextHolder.getMiscDataUtil(com.evolveum.midpoint.wf.impl.processes.common.SpringApplicationContextHolder.getMiscDataUtil) MiscDataUtil(com.evolveum.midpoint.wf.impl.util.MiscDataUtil) QName(javax.xml.namespace.QName) JAXBException(javax.xml.bind.JAXBException) ObjectDelta(com.evolveum.midpoint.prism.delta.ObjectDelta)

Aggregations

ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)1 ExpressionVariables (com.evolveum.midpoint.repo.common.expression.ExpressionVariables)1 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)1 SpringApplicationContextHolder.getMiscDataUtil (com.evolveum.midpoint.wf.impl.processes.common.SpringApplicationContextHolder.getMiscDataUtil)1 MiscDataUtil (com.evolveum.midpoint.wf.impl.util.MiscDataUtil)1 JAXBException (javax.xml.bind.JAXBException)1 QName (javax.xml.namespace.QName)1