use of com.evolveum.midpoint.prism.marshaller.XNodeProcessorEvaluationMode in project midpoint by Evolveum.
the class TestModelWebServiceNegative method createShadowReplaceChange.
// TODO: more negative tests
private ObjectDeltaType createShadowReplaceChange(String oid, String path, final String value, QName type) {
ObjectDeltaType objectChange = new ObjectDeltaType();
objectChange.setOid(oid);
objectChange.setChangeType(ChangeTypeType.MODIFY);
objectChange.setObjectType(ObjectTypes.SHADOW.getTypeQName());
ItemDeltaType itemDeltaType = new ItemDeltaType();
itemDeltaType.setModificationType(ModificationTypeType.REPLACE);
ItemPathType itemPath = new ItemPathType(path);
itemDeltaType.setPath(itemPath);
PrimitiveXNode<String> xnode = new PrimitiveXNode<>();
ValueParser<String> valueParser = new ValueParser<String>() {
@Override
public String parse(QName typeName, XNodeProcessorEvaluationMode mode) throws SchemaException {
return value;
}
@Override
public boolean isEmpty() {
return false;
}
@Override
public String getStringValue() {
return value;
}
@Override
public Map<String, String> getPotentiallyRelevantNamespaces() {
throw new UnsupportedOperationException();
}
};
xnode.setValueParser(valueParser);
if (type != null) {
xnode.setExplicitTypeDeclaration(true);
xnode.setTypeQName(type);
}
RawType rawValue = new RawType(xnode, prismContext);
itemDeltaType.getValue().add(rawValue);
objectChange.getItemDelta().add(itemDeltaType);
return objectChange;
}
Aggregations