Search in sources :

Example 41 with ItemDeltaType

use of com.evolveum.prism.xml.ns._public.types_3.ItemDeltaType in project midpoint by Evolveum.

the class ModelClientUtil method createModificationDeltaList.

public static <O extends ObjectType> ObjectDeltaListType createModificationDeltaList(Class<O> type, String oid, String path, ModificationTypeType modType, Object... values) {
    ObjectDeltaListType deltaList = new ObjectDeltaListType();
    ObjectDeltaType delta = new ObjectDeltaType();
    delta.setObjectType(getTypeQName(type));
    delta.setChangeType(ChangeTypeType.MODIFY);
    delta.setOid(oid);
    ItemDeltaType itemDelta = new ItemDeltaType();
    itemDelta.setPath(ModelClientUtil.createItemPathType(path));
    itemDelta.setModificationType(modType);
    itemDelta.getValue().addAll(Arrays.asList(values));
    delta.getItemDelta().add(itemDelta);
    deltaList.getDelta().add(delta);
    return deltaList;
}
Also used : ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType) ObjectDeltaListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType) ItemDeltaType(com.evolveum.prism.xml.ns._public.types_3.ItemDeltaType)

Example 42 with ItemDeltaType

use of com.evolveum.prism.xml.ns._public.types_3.ItemDeltaType in project midpoint by Evolveum.

the class ModelClientUtil method createRoleAssignmentDelta.

public static <O extends ObjectType> ObjectDeltaType createRoleAssignmentDelta(Class<O> focusType, String focusOid, ModificationTypeType modType, String... roleOids) {
    ItemDeltaType assignmentDelta = new ItemDeltaType();
    assignmentDelta.setModificationType(modType);
    assignmentDelta.setPath(ModelClientUtil.createItemPathType("assignment"));
    for (String roleOid : roleOids) {
        assignmentDelta.getValue().add(createRoleAssignment(roleOid));
    }
    ObjectDeltaType deltaType = new ObjectDeltaType();
    deltaType.setObjectType(ModelClientUtil.getTypeQName(focusType));
    deltaType.setChangeType(ChangeTypeType.MODIFY);
    deltaType.setOid(focusOid);
    deltaType.getItemDelta().add(assignmentDelta);
    return deltaType;
}
Also used : ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType) ItemDeltaType(com.evolveum.prism.xml.ns._public.types_3.ItemDeltaType)

Example 43 with ItemDeltaType

use of com.evolveum.prism.xml.ns._public.types_3.ItemDeltaType in project midpoint by Evolveum.

the class ModelClientUtil method createConstructionAssignmentDelta.

public static <O extends ObjectType> ObjectDeltaType createConstructionAssignmentDelta(Class<O> focusType, String focusOid, ModificationTypeType modType, String resourceOid, ShadowKindType kind, String intent) {
    ItemDeltaType assignmentDelta = new ItemDeltaType();
    assignmentDelta.setModificationType(modType);
    assignmentDelta.setPath(ModelClientUtil.createItemPathType("assignment"));
    assignmentDelta.getValue().add(createConstructionAssignment(resourceOid, kind, intent));
    ObjectDeltaType deltaType = new ObjectDeltaType();
    deltaType.setObjectType(ModelClientUtil.getTypeQName(focusType));
    deltaType.setChangeType(ChangeTypeType.MODIFY);
    deltaType.setOid(focusOid);
    deltaType.getItemDelta().add(assignmentDelta);
    return deltaType;
}
Also used : ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType) ItemDeltaType(com.evolveum.prism.xml.ns._public.types_3.ItemDeltaType)

Example 44 with ItemDeltaType

use of com.evolveum.prism.xml.ns._public.types_3.ItemDeltaType in project midpoint by Evolveum.

the class ModifyAssignmentAspect method requestToDelta.

private ObjectDelta<? extends ObjectType> requestToDelta(ModelContext<?> modelContext, ApprovalRequest<AssignmentModification> approvalRequest, String objectOid) throws SchemaException {
    List<ItemDelta> modifications = new ArrayList<>();
    Class<? extends ObjectType> focusClass = primaryChangeAspectHelper.getFocusClass(modelContext);
    for (ItemDeltaType itemDeltaType : approvalRequest.getItemToApprove().getModifications()) {
        modifications.add(DeltaConvertor.createItemDelta(itemDeltaType, focusClass, prismContext));
    }
    return ObjectDelta.createModifyDelta(objectOid, modifications, focusClass, ((LensContext) modelContext).getPrismContext());
}
Also used : ItemDelta(com.evolveum.midpoint.prism.delta.ItemDelta) ItemDeltaType(com.evolveum.prism.xml.ns._public.types_3.ItemDeltaType)

Example 45 with ItemDeltaType

use of com.evolveum.prism.xml.ns._public.types_3.ItemDeltaType in project midpoint by Evolveum.

the class AbstractManualResourceTest method findPendingOperation.

private PendingOperationType findPendingOperation(PrismObject<ShadowType> shadow, OperationResultStatusType expectedResult, ItemPath itemPath) {
    List<PendingOperationType> pendingOperations = shadow.asObjectable().getPendingOperation();
    for (PendingOperationType pendingOperation : pendingOperations) {
        OperationResultStatusType result = pendingOperation.getResultStatus();
        if (result == null) {
            result = OperationResultStatusType.IN_PROGRESS;
        }
        if (pendingOperation.getResultStatus() != expectedResult) {
            continue;
        }
        if (itemPath == null) {
            return pendingOperation;
        }
        ObjectDeltaType delta = pendingOperation.getDelta();
        assertNotNull("No delta in pending operation in " + shadow, delta);
        for (ItemDeltaType itemDelta : delta.getItemDelta()) {
            ItemPath deltaPath = itemDelta.getPath().getItemPath();
            if (itemPath.equivalent(deltaPath)) {
                return pendingOperation;
            }
        }
    }
    return null;
}
Also used : ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType) PendingOperationType(com.evolveum.midpoint.xml.ns._public.common.common_3.PendingOperationType) OperationResultStatusType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultStatusType) ItemDeltaType(com.evolveum.prism.xml.ns._public.types_3.ItemDeltaType) ItemPath(com.evolveum.midpoint.prism.path.ItemPath)

Aggregations

ItemDeltaType (com.evolveum.prism.xml.ns._public.types_3.ItemDeltaType)39 ObjectDeltaType (com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType)28 RawType (com.evolveum.prism.xml.ns._public.types_3.RawType)14 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)11 ObjectDeltaListType (com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType)11 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)11 ItemPathType (com.evolveum.prism.xml.ns._public.types_3.ItemPathType)11 Test (org.testng.annotations.Test)11 ItemDelta (com.evolveum.midpoint.prism.delta.ItemDelta)8 QName (javax.xml.namespace.QName)8 Document (org.w3c.dom.Document)8 AbstractModelIntegrationTest (com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)7 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)7 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)7 PrismAsserts.assertEqualsPolyString (com.evolveum.midpoint.prism.util.PrismAsserts.assertEqualsPolyString)6 ObjectDeltaOperationListType (com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType)6 XNode (com.evolveum.midpoint.prism.xnode.XNode)4 ObjectModificationType (com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectModificationType)4 ObjectDeltaOperationType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectDeltaOperationType)4 ResourceObjectShadowChangeDescriptionType (com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceObjectShadowChangeDescriptionType)4