Search in sources :

Example 21 with ObjectDeltaListType

use of com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType in project midpoint by Evolveum.

the class Main method createRole.

private static String createRole(ModelPortType modelPort, RoleType roleType) throws FaultMessage {
    ObjectDeltaType deltaType = new ObjectDeltaType();
    deltaType.setObjectType(ModelClientUtil.getTypeQName(RoleType.class));
    deltaType.setChangeType(ChangeTypeType.ADD);
    deltaType.setObjectToAdd(roleType);
    ObjectDeltaListType deltaListType = new ObjectDeltaListType();
    deltaListType.getDelta().add(deltaType);
    ObjectDeltaOperationListType operationListType = modelPort.executeChanges(deltaListType, null);
    return ModelClientUtil.getOidFromDeltaOperationList(operationListType, deltaType);
}
Also used : ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType) RoleType(com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType) ObjectDeltaOperationListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType) ObjectDeltaListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType)

Example 22 with ObjectDeltaListType

use of com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType in project midpoint by Evolveum.

the class Main method deleteTask.

private static void deleteTask(ModelPortType modelPort, String oid) throws FaultMessage {
    ObjectDeltaType deltaType = new ObjectDeltaType();
    deltaType.setObjectType(ModelClientUtil.getTypeQName(TaskType.class));
    deltaType.setChangeType(ChangeTypeType.DELETE);
    deltaType.setOid(oid);
    ObjectDeltaListType deltaListType = new ObjectDeltaListType();
    deltaListType.getDelta().add(deltaType);
    ModelExecuteOptionsType executeOptionsType = new ModelExecuteOptionsType();
    executeOptionsType.setRaw(true);
    modelPort.executeChanges(deltaListType, executeOptionsType);
}
Also used : ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType) TaskType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType) ModelExecuteOptionsType(com.evolveum.midpoint.xml.ns._public.common.common_3.ModelExecuteOptionsType) ObjectDeltaListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType)

Example 23 with ObjectDeltaListType

use of com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType in project midpoint by Evolveum.

the class Main method reconcileUser.

private static void reconcileUser(ModelPortType modelPort, String oid) throws FaultMessage {
    Document doc = ModelClientUtil.getDocumnent();
    ObjectDeltaType userDelta = new ObjectDeltaType();
    userDelta.setOid(oid);
    userDelta.setObjectType(ModelClientUtil.getTypeQName(UserType.class));
    userDelta.setChangeType(ChangeTypeType.MODIFY);
    ObjectDeltaListType deltaList = new ObjectDeltaListType();
    deltaList.getDelta().add(userDelta);
    ModelExecuteOptionsType optionsType = new ModelExecuteOptionsType();
    optionsType.setReconcile(true);
    modelPort.executeChanges(deltaList, optionsType);
}
Also used : ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType) ModelExecuteOptionsType(com.evolveum.midpoint.xml.ns._public.common.common_3.ModelExecuteOptionsType) Document(org.w3c.dom.Document) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) ObjectDeltaListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType)

Example 24 with ObjectDeltaListType

use of com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType in project midpoint by Evolveum.

the class Main method changeUserGivenName.

private static void changeUserGivenName(ModelPortType modelPort, String oid, String newValue) throws FaultMessage {
    Document doc = ModelClientUtil.getDocumnent();
    ObjectDeltaType userDelta = new ObjectDeltaType();
    userDelta.setOid(oid);
    userDelta.setObjectType(ModelClientUtil.getTypeQName(UserType.class));
    userDelta.setChangeType(ChangeTypeType.MODIFY);
    ItemDeltaType itemDelta = new ItemDeltaType();
    itemDelta.setModificationType(ModificationTypeType.REPLACE);
    itemDelta.setPath(ModelClientUtil.createItemPathType("givenName"));
    itemDelta.getValue().add(ModelClientUtil.createPolyStringType(newValue, doc));
    userDelta.getItemDelta().add(itemDelta);
    ObjectDeltaListType deltaList = new ObjectDeltaListType();
    deltaList.getDelta().add(userDelta);
    modelPort.executeChanges(deltaList, null);
}
Also used : ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType) Document(org.w3c.dom.Document) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) ObjectDeltaListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType) ItemDeltaType(com.evolveum.prism.xml.ns._public.types_3.ItemDeltaType)

Example 25 with ObjectDeltaListType

use of com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType in project midpoint by Evolveum.

the class Main method modifyRoleReplaceInducement.

// removes inducement with a given ID and replaces it with a new one
private static void modifyRoleReplaceInducement(ModelPortType modelPort, String roleOid, int oldId, String newInducementOid) throws FaultMessage, IOException, SAXException {
    ItemDeltaType inducementDeleteDelta = new ItemDeltaType();
    inducementDeleteDelta.setModificationType(ModificationTypeType.DELETE);
    inducementDeleteDelta.setPath(ModelClientUtil.createItemPathType("inducement"));
    inducementDeleteDelta.getValue().add(ModelClientUtil.parseElement("<value><id>" + oldId + "</id></value>"));
    ItemDeltaType inducementAddDelta = new ItemDeltaType();
    inducementAddDelta.setModificationType(ModificationTypeType.ADD);
    inducementAddDelta.setPath(ModelClientUtil.createItemPathType("inducement"));
    inducementAddDelta.getValue().add(ModelClientUtil.createRoleAssignment(newInducementOid));
    ObjectDeltaType deltaType = new ObjectDeltaType();
    deltaType.setObjectType(ModelClientUtil.getTypeQName(RoleType.class));
    deltaType.setChangeType(ChangeTypeType.MODIFY);
    deltaType.setOid(roleOid);
    deltaType.getItemDelta().add(inducementDeleteDelta);
    deltaType.getItemDelta().add(inducementAddDelta);
    ObjectDeltaListType deltaListType = new ObjectDeltaListType();
    deltaListType.getDelta().add(deltaType);
    ObjectDeltaOperationListType objectDeltaOperationList = modelPort.executeChanges(deltaListType, null);
    for (ObjectDeltaOperationType objectDeltaOperation : objectDeltaOperationList.getDeltaOperation()) {
        if (!OperationResultStatusType.SUCCESS.equals(objectDeltaOperation.getExecutionResult().getStatus())) {
            System.out.println("*** Operation result = " + objectDeltaOperation.getExecutionResult().getStatus() + ": " + objectDeltaOperation.getExecutionResult().getMessage());
        }
    }
}
Also used : ObjectDeltaOperationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectDeltaOperationType) ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType) RoleType(com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType) ObjectDeltaOperationListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType) ObjectDeltaListType(com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType) ItemDeltaType(com.evolveum.prism.xml.ns._public.types_3.ItemDeltaType)

Aggregations

ObjectDeltaListType (com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType)52 ObjectDeltaType (com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType)37 ObjectDeltaOperationListType (com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType)31 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)17 Test (org.testng.annotations.Test)17 LogfileTestTailer (com.evolveum.midpoint.test.util.LogfileTestTailer)13 ItemDeltaType (com.evolveum.prism.xml.ns._public.types_3.ItemDeltaType)11 ModelExecuteOptionsType (com.evolveum.midpoint.xml.ns._public.common.common_3.ModelExecuteOptionsType)10 ObjectDeltaOperationType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectDeltaOperationType)8 ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)4 RoleType (com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType)4 FaultMessage (com.evolveum.midpoint.xml.ns._public.common.fault_3.FaultMessage)4 QName (javax.xml.namespace.QName)4 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)4 AbstractInitializedModelIntegrationTest (com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest)3 Task (com.evolveum.midpoint.task.api.Task)3 OperationResultType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType)3 ProtectedStringType (com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType)3 Collection (java.util.Collection)3 Document (org.w3c.dom.Document)3