Search in sources :

Example 1 with XNodeFactory

use of com.evolveum.midpoint.prism.xnode.XNodeFactory in project midpoint by Evolveum.

the class TestJaxbConstruction method createFilter.

private MapXNode createFilter() {
    XNodeFactory factory = getPrismContext().xnodeFactory();
    Map<QName, XNode> equalsElementSource = new HashMap<>();
    PrimitiveXNode<ItemPathType> pathElement = factory.primitive(new ItemPathType(new ItemName("name")));
    equalsElementSource.put(new QName(SchemaConstantsGenerated.NS_QUERY, "path"), pathElement);
    PrimitiveXNode<String> valueElement = factory.primitive("čučoriedka");
    equalsElementSource.put(new QName(SchemaConstantsGenerated.NS_QUERY, "value"), valueElement);
    MapXNode equalsElement = factory.map(equalsElementSource);
    return factory.map(new QName(SchemaConstantsGenerated.NS_QUERY, "equal"), equalsElement);
}
Also used : HashMap(java.util.HashMap) QName(javax.xml.namespace.QName) ItemPathType(com.evolveum.prism.xml.ns._public.types_3.ItemPathType) XNode(com.evolveum.midpoint.prism.xnode.XNode) MapXNode(com.evolveum.midpoint.prism.xnode.MapXNode) PrimitiveXNode(com.evolveum.midpoint.prism.xnode.PrimitiveXNode) ItemName(com.evolveum.midpoint.prism.path.ItemName) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) MapXNode(com.evolveum.midpoint.prism.xnode.MapXNode) XNodeFactory(com.evolveum.midpoint.prism.xnode.XNodeFactory)

Example 2 with XNodeFactory

use of com.evolveum.midpoint.prism.xnode.XNodeFactory in project midpoint by Evolveum.

the class ScriptExecutor method replaceScriptArgumentWithComputedValues.

private void replaceScriptArgumentWithComputedValues(ProvisioningScriptArgumentType argument, Collection<PrismPropertyValue<String>> values) {
    argument.getExpressionEvaluator().clear();
    if (values.isEmpty()) {
        // We need to create at least one evaluator. Otherwise the expression code will complain
        JAXBElement<RawType> el = new JAXBElement<>(SchemaConstants.C_VALUE, RawType.class, new RawType(b.prismContext));
        argument.getExpressionEvaluator().add(el);
    } else {
        for (PrismPropertyValue<String> val : values) {
            XNodeFactory factory = b.prismContext.xnodeFactory();
            PrimitiveXNode<String> prim = factory.primitive(val.getValue(), DOMUtil.XSD_STRING);
            JAXBElement<RawType> el = new JAXBElement<>(SchemaConstants.C_VALUE, RawType.class, new RawType(prim.frozen(), b.prismContext));
            argument.getExpressionEvaluator().add(el);
        }
    }
}
Also used : RawType(com.evolveum.prism.xml.ns._public.types_3.RawType) JAXBElement(javax.xml.bind.JAXBElement) XNodeFactory(com.evolveum.midpoint.prism.xnode.XNodeFactory)

Aggregations

XNodeFactory (com.evolveum.midpoint.prism.xnode.XNodeFactory)2 ItemName (com.evolveum.midpoint.prism.path.ItemName)1 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)1 MapXNode (com.evolveum.midpoint.prism.xnode.MapXNode)1 PrimitiveXNode (com.evolveum.midpoint.prism.xnode.PrimitiveXNode)1 XNode (com.evolveum.midpoint.prism.xnode.XNode)1 ItemPathType (com.evolveum.prism.xml.ns._public.types_3.ItemPathType)1 RawType (com.evolveum.prism.xml.ns._public.types_3.RawType)1 HashMap (java.util.HashMap)1 JAXBElement (javax.xml.bind.JAXBElement)1 QName (javax.xml.namespace.QName)1