use of com.evolveum.prism.xml.ns._public.types_3.RawType 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;
}
use of com.evolveum.prism.xml.ns._public.types_3.RawType in project midpoint by Evolveum.
the class TestFundamentals method testRawTypeClone.
@Test
public void testRawTypeClone() throws Exception {
System.out.println("\n\n===[ testRawTypeClone ]===\n");
// GIVEN
QName typeQName = new QName("abcdef");
MapXNode mapXNode = new MapXNode();
mapXNode.setTypeQName(typeQName);
RawType rawType = new RawType(mapXNode, PrismTestUtil.getPrismContext());
// WHEN
RawType rawTypeClone = rawType.clone();
// THEN
assertEquals("Wrong or missing type QName", typeQName, rawTypeClone.getXnode().getTypeQName());
}
use of com.evolveum.prism.xml.ns._public.types_3.RawType in project midpoint by Evolveum.
the class AccountConstructionType method clone.
public AccountConstructionType clone() {
AccountConstructionType clone = new AccountConstructionType();
clone.howto = howto;
if (when != null) {
clone.when = (XMLGregorianCalendar) when.clone();
}
for (RawType value : getValue()) {
clone.getValue().add(value.clone());
}
return clone;
}
use of com.evolveum.prism.xml.ns._public.types_3.RawType in project midpoint by Evolveum.
the class TestParseMapping method makePPV.
// a bit of hack: RawType gets parsed very soon, so we must test for it almost immediately after parsing
@Override
protected PrismPropertyValue<MappingType> makePPV(MappingType mapping, PrismPropertyDefinition definition) {
RawType variableValue = (RawType) mapping.getExpression().getVariable().get(0).getValue();
AssertJUnit.assertNull("Unexpected raw value in expression variable: " + variableValue.getXnode(), variableValue.getXnode());
return super.makePPV(mapping, definition);
}
use of com.evolveum.prism.xml.ns._public.types_3.RawType in project midpoint by Evolveum.
the class DeltaConvertor method addOldValues.
private static void addOldValues(ItemDelta delta, ItemDeltaType mod, Collection<PrismValue> values, DeltaConversionOptions options) throws SchemaException {
if (values == null || values.isEmpty()) {
// RawType modValue = new RawType(delta.getPrismContext());
// mod.getEstimatedOldValue().add(modValue);
} else {
for (PrismValue value : values) {
XNode xnode = toXNode(delta, value, options);
RawType modValue = new RawType(xnode, delta.getPrismContext());
mod.getEstimatedOldValue().add(modValue);
}
}
}
Aggregations