Search in sources :

Example 1 with ScriptingExpressionEvaluationOptionsType

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

the class PipelineData method prepareXmlData.

public static PipelineDataType prepareXmlData(List<PipelineItem> output, ScriptingExpressionEvaluationOptionsType options) {
    boolean hideResults = options != null && Boolean.TRUE.equals(options.isHideOperationResults());
    PipelineDataType rv = new PipelineDataType();
    if (output != null) {
        for (PipelineItem item : output) {
            PipelineItemType itemType = new PipelineItemType();
            PrismValue value = item.getValue();
            if (value instanceof PrismReferenceValue) {
                // This is a bit of hack: value.getRealValue() would return unserializable object (PRV$1 - does not have type QName)
                ObjectReferenceType ort = new ObjectReferenceType();
                ort.setupReferenceValue((PrismReferenceValue) value);
                itemType.setValue(ort);
            } else {
                itemType.setValue(value.getRealValue());
            }
            if (!hideResults) {
                itemType.setResult(item.getResult().createOperationResultType());
            }
            rv.getItem().add(itemType);
        }
    }
    return rv;
}
Also used : ObjectReferenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType) PipelineItem(com.evolveum.midpoint.model.api.PipelineItem) PipelineItemType(com.evolveum.midpoint.xml.ns._public.model.scripting_3.PipelineItemType) PipelineDataType(com.evolveum.midpoint.xml.ns._public.model.scripting_3.PipelineDataType)

Example 2 with ScriptingExpressionEvaluationOptionsType

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

the class ModelWebService method prepareXmlData.

public static PipelineDataType prepareXmlData(List<PipelineItem> output, ScriptingExpressionEvaluationOptionsType options) throws JAXBException, SchemaException {
    boolean hideResults = options != null && Boolean.TRUE.equals(options.isHideOperationResults());
    PipelineDataType rv = new PipelineDataType();
    if (output != null) {
        for (PipelineItem item : output) {
            PipelineItemType itemType = new PipelineItemType();
            PrismValue value = item.getValue();
            if (value instanceof PrismReferenceValue) {
                // This is a bit of hack: value.getRealValue() would return unserializable object (PRV$1 - does not have type QName)
                ObjectReferenceType ort = new ObjectReferenceType();
                ort.setupReferenceValue((PrismReferenceValue) value);
                itemType.setValue(ort);
            } else {
                // TODO - ok?
                itemType.setValue(value.getRealValue());
            }
            if (!hideResults) {
                itemType.setResult(item.getResult().createOperationResultType());
            }
            rv.getItem().add(itemType);
        }
    }
    return rv;
}
Also used : PrismReferenceValue(com.evolveum.midpoint.prism.PrismReferenceValue) PipelineItemType(com.evolveum.midpoint.xml.ns._public.model.scripting_3.PipelineItemType) PipelineDataType(com.evolveum.midpoint.xml.ns._public.model.scripting_3.PipelineDataType) PrismValue(com.evolveum.midpoint.prism.PrismValue)

Aggregations

PipelineDataType (com.evolveum.midpoint.xml.ns._public.model.scripting_3.PipelineDataType)2 PipelineItemType (com.evolveum.midpoint.xml.ns._public.model.scripting_3.PipelineItemType)2 PipelineItem (com.evolveum.midpoint.model.api.PipelineItem)1 PrismReferenceValue (com.evolveum.midpoint.prism.PrismReferenceValue)1 PrismValue (com.evolveum.midpoint.prism.PrismValue)1 ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)1