Search in sources :

Example 6 with PrismReference

use of com.evolveum.midpoint.prism.PrismReference in project midpoint by Evolveum.

the class AbstractIntegrationTest method assertNoRoleMembershipRef.

protected <F extends FocusType> void assertNoRoleMembershipRef(PrismObject<F> focus) {
    PrismReference memRef = focus.findReference(FocusType.F_ROLE_MEMBERSHIP_REF);
    assertNull("No roleMembershipRef expected in " + focus + ", but found: " + memRef, memRef);
}
Also used : PrismReference(com.evolveum.midpoint.prism.PrismReference)

Example 7 with PrismReference

use of com.evolveum.midpoint.prism.PrismReference in project midpoint by Evolveum.

the class AbstractModelIntegrationTest method createAssignmentModification.

protected ContainerDelta<AssignmentType> createAssignmentModification(String roleOid, QName refType, QName relation, Consumer<AssignmentType> modificationBlock, boolean add) throws SchemaException {
    ContainerDelta<AssignmentType> assignmentDelta = ContainerDelta.createDelta(UserType.F_ASSIGNMENT, getUserDefinition());
    PrismContainerValue<AssignmentType> cval = new PrismContainerValue<AssignmentType>(prismContext);
    if (add) {
        assignmentDelta.addValueToAdd(cval);
    } else {
        assignmentDelta.addValueToDelete(cval);
    }
    PrismReference targetRef = cval.findOrCreateReference(AssignmentType.F_TARGET_REF);
    targetRef.getValue().setOid(roleOid);
    targetRef.getValue().setTargetType(refType);
    targetRef.getValue().setRelation(relation);
    if (modificationBlock != null) {
        modificationBlock.accept(cval.asContainerable());
    }
    return assignmentDelta;
}
Also used : PrismContainerValue(com.evolveum.midpoint.prism.PrismContainerValue) AssignmentType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType) PrismReference(com.evolveum.midpoint.prism.PrismReference)

Example 8 with PrismReference

use of com.evolveum.midpoint.prism.PrismReference in project midpoint by Evolveum.

the class TestStrings method ref.

protected PrismReference ref(List<ObjectReferenceType> orts) {
    PrismReference rv = new PrismReference(new QName("dummy"));
    orts.forEach(ort -> rv.add(ort.asReferenceValue().clone()));
    return rv;
}
Also used : QName(javax.xml.namespace.QName) PrismReference(com.evolveum.midpoint.prism.PrismReference)

Example 9 with PrismReference

use of com.evolveum.midpoint.prism.PrismReference in project midpoint by Evolveum.

the class ObjectUpdater method createAddParentRefDelta.

private <T extends ObjectType> List<ReferenceDelta> createAddParentRefDelta(PrismObject<T> object) {
    PrismReference parentOrgRef = object.findReference(ObjectType.F_PARENT_ORG_REF);
    if (parentOrgRef == null || parentOrgRef.isEmpty()) {
        return new ArrayList<>();
    }
    PrismObjectDefinition def = object.getDefinition();
    ReferenceDelta delta = ReferenceDelta.createModificationAdd(new ItemPath(ObjectType.F_PARENT_ORG_REF), def, parentOrgRef.getClonedValues());
    return Arrays.asList(delta);
}
Also used : PrismObjectDefinition(com.evolveum.midpoint.prism.PrismObjectDefinition) PrismReference(com.evolveum.midpoint.prism.PrismReference) ReferenceDelta(com.evolveum.midpoint.prism.delta.ReferenceDelta) ItemPath(com.evolveum.midpoint.prism.path.ItemPath)

Example 10 with PrismReference

use of com.evolveum.midpoint.prism.PrismReference in project midpoint by Evolveum.

the class AbstractIntegrationTest method assertNotLinked.

protected void assertNotLinked(PrismObject<UserType> user, String accountOid) throws ObjectNotFoundException, SchemaException {
    PrismReference linkRef = user.findReference(UserType.F_LINK_REF);
    if (linkRef == null) {
        return;
    }
    boolean found = false;
    for (PrismReferenceValue val : linkRef.getValues()) {
        if (val.getOid().equals(accountOid)) {
            found = true;
        }
    }
    assertFalse("User " + user + " IS linked to account " + accountOid + " but not expecting it", found);
}
Also used : PrismReferenceValue(com.evolveum.midpoint.prism.PrismReferenceValue) PrismReference(com.evolveum.midpoint.prism.PrismReference)

Aggregations

PrismReference (com.evolveum.midpoint.prism.PrismReference)41 PrismReferenceValue (com.evolveum.midpoint.prism.PrismReferenceValue)15 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)12 PrismObject (com.evolveum.midpoint.prism.PrismObject)11 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)11 PrismContainerValue (com.evolveum.midpoint.prism.PrismContainerValue)8 Task (com.evolveum.midpoint.task.api.Task)8 ArrayList (java.util.ArrayList)8 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)7 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)7 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)7 QName (javax.xml.namespace.QName)7 Test (org.testng.annotations.Test)7 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)6 LensProjectionContext (com.evolveum.midpoint.model.impl.lens.LensProjectionContext)5 AssignmentType (com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType)5 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)5 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)5 ReferenceDelta (com.evolveum.midpoint.prism.delta.ReferenceDelta)4 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)4