use of com.evolveum.midpoint.prism.impl.xnode.MapXNodeImpl in project midpoint by Evolveum.
the class PerfTestPrismObjectSize method createXNodeAssignment.
private static final MapXNodeImpl createXNodeAssignment(String uuid, int id) {
MapXNodeImpl assignment = new MapXNodeImpl();
if (id > 0) {
assignment.put(CONTAINER_ID, attribute(Long.valueOf(id)));
}
MapXNodeImpl construction = new MapXNodeImpl();
assignment.put(AssignmentType.F_CONSTRUCTION, construction);
MapXNodeImpl resourceRef = new MapXNodeImpl();
construction.put(ConstructionType.F_RESOURCE_REF, resourceRef);
resourceRef.put(ObjectReferenceType.F_OID, attribute(uuid));
resourceRef.put(ObjectReferenceType.F_TYPE, attribute(ResourceType.COMPLEX_TYPE));
return assignment;
}
use of com.evolveum.midpoint.prism.impl.xnode.MapXNodeImpl in project midpoint by Evolveum.
the class PerfTestPrismObjectSize method generateTestObject.
private static final RootXNode generateTestObject(int count, int conflicts, boolean withIds) throws SchemaException, IOException {
@NotNull PrismObject<UserType> baseObject = getJack();
@NotNull RootXNode rootNode = getPrismContext().xnodeSerializer().serialize(baseObject);
MapXNodeImpl user = (MapXNodeImpl) rootNode.getSubnode();
ListXNodeImpl assignments = new ListXNodeImpl();
int unique = count - conflicts;
List<String> uuids = generateUUIDs(unique);
for (int i = 0; i < unique; i++) {
assignments.add(createXNodeAssignment(uuids.get(i), withIds ? i : -1));
}
for (int i = 0; i < conflicts; i++) {
int id = unique - 1 - i;
assignments.add(createXNodeAssignment(uuids.get(id), withIds ? id : -1));
}
user.put(UserType.F_ASSIGNMENT, assignments);
return rootNode;
}
Aggregations