Search in sources :

Example 1 with ExpressionWrapper

use of com.evolveum.midpoint.prism.ExpressionWrapper in project midpoint by Evolveum.

the class PrismQueryExpressionSupport method parseScript.

@Override
public ExpressionWrapper parseScript(Map<String, String> namespaceContext, String language, String script) {
    ExpressionType expressionT = new ExpressionType();
    var scriptValue = new ScriptExpressionEvaluatorType();
    if (!Strings.isNullOrEmpty(language)) {
        scriptValue.setLanguage(language);
    }
    scriptValue.setCode(script);
    expressionT.expressionEvaluator(new JAXBElement<>(SCRIPT, ScriptExpressionEvaluatorType.class, scriptValue));
    return new ExpressionWrapper(EXPRESSION, expressionT);
}
Also used : ExpressionType(com.evolveum.midpoint.xml.ns._public.common.common_3.ExpressionType) ScriptExpressionEvaluatorType(com.evolveum.midpoint.xml.ns._public.common.common_3.ScriptExpressionEvaluatorType) ExpressionWrapper(com.evolveum.midpoint.prism.ExpressionWrapper)

Example 2 with ExpressionWrapper

use of com.evolveum.midpoint.prism.ExpressionWrapper in project midpoint by Evolveum.

the class AbstractIntegrationTest method assertExpression.

protected <T> void assertExpression(PrismProperty<T> prop, String evaluatorName) {
    PrismPropertyValue<T> pval = prop.getValue();
    ExpressionWrapper expressionWrapper = pval.getExpression();
    assertNotNull("No expression wrapper in " + prop, expressionWrapper);
    Object expressionObj = expressionWrapper.getExpression();
    assertNotNull("No expression in " + prop, expressionObj);
    assertTrue("Wrong expression type: " + expressionObj.getClass(), expressionObj instanceof ExpressionType);
    ExpressionType expressionType = (ExpressionType) expressionObj;
    JAXBElement<?> evaluatorElement = expressionType.getExpressionEvaluator().iterator().next();
    assertEquals("Wrong expression evaluator name", evaluatorName, evaluatorElement.getName().getLocalPart());
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) ExpressionWrapper(com.evolveum.midpoint.prism.ExpressionWrapper)

Aggregations

ExpressionWrapper (com.evolveum.midpoint.prism.ExpressionWrapper)2 PrismObject (com.evolveum.midpoint.prism.PrismObject)1 ExpressionType (com.evolveum.midpoint.xml.ns._public.common.common_3.ExpressionType)1 ScriptExpressionEvaluatorType (com.evolveum.midpoint.xml.ns._public.common.common_3.ScriptExpressionEvaluatorType)1