Search in sources :

Example 1 with ScriptingVariableDefinitionType

use of com.evolveum.midpoint.xml.ns._public.model.scripting_3.ScriptingVariableDefinitionType in project midpoint by Evolveum.

the class VariablesUtil method addDerivedVariables.

private static void addDerivedVariables(VariablesMap resultingVariables, ScriptingVariablesDefinitionType definitions, VariableResolutionContext ctx, OperationResult result) throws SchemaException, ObjectNotFoundException, ExpressionEvaluationException, CommunicationException, ConfigurationException, SecurityViolationException {
    if (definitions == null) {
        return;
    }
    for (ScriptingVariableDefinitionType definition : definitions.getVariable()) {
        if (definition.getExpression() == null) {
            // todo or throw an exception?
            continue;
        }
        String shortDesc = "scripting variable " + definition.getName();
        TypedValue valueAndDef;
        if (definition.getExpression().getExpressionEvaluator().size() == 1 && QNameUtil.match(SchemaConstantsGenerated.C_PATH, definition.getExpression().getExpressionEvaluator().get(0).getName())) {
            valueAndDef = variableFromPathExpression(resultingVariables, definition.getExpression().getExpressionEvaluator().get(0), ctx, shortDesc, result);
        } else {
            valueAndDef = variableFromOtherExpression(resultingVariables, definition, ctx, shortDesc, result);
        }
        putImmutableValue(resultingVariables, definition.getName(), valueAndDef);
    }
}
Also used : ScriptingVariableDefinitionType(com.evolveum.midpoint.xml.ns._public.model.scripting_3.ScriptingVariableDefinitionType) TypedValue(com.evolveum.midpoint.schema.expression.TypedValue)

Aggregations

TypedValue (com.evolveum.midpoint.schema.expression.TypedValue)1 ScriptingVariableDefinitionType (com.evolveum.midpoint.xml.ns._public.model.scripting_3.ScriptingVariableDefinitionType)1