use of com.evolveum.midpoint.xml.ns._public.common.common_3.ConstructionType in project midpoint by Evolveum.
the class SchemaDebugUtil method prettyPrint.
public static String prettyPrint(ConstructionType act) {
if (act == null) {
return "null";
}
StringBuilder sb = new StringBuilder("ConstructionType(");
if (act.getResourceRef() != null) {
sb.append(prettyPrint(act.getResourceRef()));
}
sb.append(", ");
if (act.getIntent() != null) {
sb.append("intent=");
sb.append(act.getIntent());
sb.append(", ");
}
if (act.getAttribute() != null) {
for (ResourceAttributeDefinitionType attrConstr : act.getAttribute()) {
sb.append(prettyPrint(attrConstr));
}
}
// TODO: Other properties
sb.append(")");
return sb.toString();
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ConstructionType in project midpoint by Evolveum.
the class AbstractModelIntegrationTest method createConstructionAssignment.
protected AssignmentType createConstructionAssignment(String resourceOid, ShadowKindType kind, String intent) {
AssignmentType assignmentType = new AssignmentType();
ConstructionType constructionType = new ConstructionType();
constructionType.setKind(kind);
assignmentType.setConstruction(constructionType);
ObjectReferenceType resourceRef = new ObjectReferenceType();
resourceRef.setOid(resourceOid);
resourceRef.setType(ResourceType.COMPLEX_TYPE);
constructionType.setResourceRef(resourceRef);
constructionType.setIntent(intent);
return assignmentType;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ConstructionType in project midpoint by Evolveum.
the class AbstractModelIntegrationTest method modifyRoleAddConstruction.
protected void modifyRoleAddConstruction(String roleOid, long inducementId, String resourceOid) throws SchemaException, ObjectAlreadyExistsException, ObjectNotFoundException, ExpressionEvaluationException, CommunicationException, ConfigurationException, PolicyViolationException, SecurityViolationException {
Task task = createTask("modifyRoleAddConstruction");
OperationResult result = task.getResult();
ConstructionType construction = new ConstructionType();
ObjectReferenceType resourceRedRef = new ObjectReferenceType();
resourceRedRef.setOid(resourceOid);
construction.setResourceRef(resourceRedRef);
ObjectDelta<RoleType> roleDelta = prismContext.deltaFactory().object().createModificationAddContainer(RoleType.class, roleOid, ItemPath.create(RoleType.F_INDUCEMENT, inducementId, AssignmentType.F_CONSTRUCTION), construction);
modelService.executeChanges(MiscSchemaUtil.createCollection(roleDelta), null, task, result);
result.computeStatus();
TestUtil.assertSuccess(result);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ConstructionType in project midpoint by Evolveum.
the class AbstractModelIntegrationTest method createAccountConstruction.
protected ConstructionType createAccountConstruction(String resourceOid, String intent) {
ConstructionType accountConstructionType = new ConstructionType();
ObjectReferenceType resourceRef = new ObjectReferenceType();
resourceRef.setOid(resourceOid);
accountConstructionType.setResourceRef(resourceRef);
accountConstructionType.setIntent(intent);
return accountConstructionType;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ConstructionType in project midpoint by Evolveum.
the class SqaleRepoModifyObjectTest method test302AddingMoreAssignmentsIncludingNestedContainersAndRefs.
@Test
public void test302AddingMoreAssignmentsIncludingNestedContainersAndRefs() throws ObjectAlreadyExistsException, ObjectNotFoundException, SchemaException {
OperationResult result = createOperationResult();
MUser originalRow = selectObjectByOid(QUser.class, user1Oid);
given("delta adding two more assignments for user 1");
UUID roleOid = UUID.randomUUID();
UUID resourceOid = UUID.randomUUID();
ObjectDelta<UserType> delta = prismContext.deltaFor(UserType.class).item(UserType.F_ASSIGNMENT).add(new AssignmentType(prismContext).targetRef(roleOid.toString(), RoleType.COMPLEX_TYPE).metadata(new MetadataType().createChannel("create-channel").createApproverRef(UUID.randomUUID().toString(), UserType.COMPLEX_TYPE).createApproverRef(UUID.randomUUID().toString(), UserType.COMPLEX_TYPE)).order(48), new AssignmentType(prismContext).construction(new ConstructionType().resourceRef(resourceOid.toString(), ResourceType.COMPLEX_TYPE)).order(49)).asObjectDelta(user1Oid);
when("modifyObject is called");
repositoryService.modifyObject(UserType.class, user1Oid, delta.getModifications(), result);
then("operation is successful");
assertThatOperationResult(result).isSuccess();
and("serialized form (fullObject) is updated");
UserType userObject = repositoryService.getObject(UserType.class, user1Oid, null, result).asObjectable();
assertThat(userObject.getVersion()).isEqualTo(String.valueOf(originalRow.version + 1));
List<AssignmentType> assignments = userObject.getAssignment();
assertThat(assignments).hasSize(3).allMatch(a -> a.getId() != null && a.getId() < originalRow.containerIdSeq + 2);
and("new assignment rows are created");
MUser row = selectObjectByOid(QUser.class, user1Oid);
assertThat(row.version).isEqualTo(originalRow.version + 1);
assertThat(row.containerIdSeq).isEqualTo(originalRow.containerIdSeq + 2);
QAssignment<?> a = QAssignmentMapping.getAssignmentMapping().defaultAlias();
List<MAssignment> aRows = select(a, a.ownerOid.eq(UUID.fromString(user1Oid)));
assertThat(aRows).hasSize(3).anyMatch(// previous one
aRow -> aRow.cid < originalRow.containerIdSeq).anyMatch(aRow -> aRow.cid == row.containerIdSeq - 2 && aRow.orderValue == 48 && aRow.targetRefTargetOid.equals(roleOid) && cachedUriById(aRow.createChannelId).equals("create-channel")).anyMatch(aRow -> aRow.cid == row.containerIdSeq - 1 && aRow.resourceRefTargetOid.equals(resourceOid));
QAssignmentReference ar = QAssignmentReferenceMapping.getForAssignmentCreateApprover().defaultAlias();
List<MAssignmentReference> refRows = select(ar, ar.ownerOid.eq(UUID.fromString(user1Oid)).and(ar.assignmentCid.eq(row.containerIdSeq - 2)));
assertThat(refRows).hasSize(2).allMatch(rr -> rr.targetType == MObjectType.USER);
}
Aggregations