Search in sources :

Example 6 with ObjectDeltaOperationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectDeltaOperationType in project midpoint by Evolveum.

the class TestExchangeConnectorLow method test150CreateHuygensConflicting.

@Test
public void test150CreateHuygensConflicting() throws Exception {
    String mail = "pascal@clermont-ferrand.fr";
    System.out.println("Creating account for Huygens...");
    ObjectDeltaOperationType odo = createAccountOdo(HUYGENS_GIVEN_NAME, HUYGENS_SN, dn(HUYGENS_GIVEN_NAME, HUYGENS_SN), "UserMailbox", mail);
    OperationResultType result = odo.getExecutionResult();
    System.out.println("Done; status = " + result.getStatus() + ":" + result.getMessage());
//        ShadowType huygens = checkAccount(HUYGENS_GIVEN_NAME, HUYGENS_SN, dn(HUYGENS_GIVEN_NAME, HUYGENS_SN), getContainer());
//        Map<String,Object> attrs = getAttributesAsMap(pascal);
//        assertAttributeEquals(attrs, "RecipientType", "UserMailbox");
//        assertAttributeExists(attrs, "homeMDB");
//        assertAttributeEquals(attrs, "PrimarySmtpAddress", mail);
//        assertAttributeEquals(attrs, "mail", mail);
//        assertAttributeEquals(attrs, "Alias", PASCAL_SN.toLowerCase());
//        assertAttributeContains(attrs, "EmailAddresses", "SMTP:" + mail);               // FIXME
//        assertAttributeEquals(attrs, "EmailAddressPolicyEnabled", "true");
//        assertAttributeEquals(attrs, "msExchRecipientDisplayType", "1073741824");
//        assertAttributeEquals(attrs, "msExchRecipientTypeDetails", "1");
//        assertAttributeEquals(attrs, "displayName", PASCAL_GIVEN_NAME + " " + PASCAL_SN);
}
Also used : ObjectDeltaOperationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectDeltaOperationType) OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType) Test(org.testng.annotations.Test)

Example 7 with ObjectDeltaOperationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectDeltaOperationType in project midpoint by Evolveum.

the class TestSanityLegacy method addObjectViaModelWS.

private void addObjectViaModelWS(ObjectType objectType, ModelExecuteOptionsType options, Holder<String> oidHolder, Holder<OperationResultType> resultHolder) throws FaultMessage {
    ObjectDeltaListType deltaList = new ObjectDeltaListType();
    ObjectDeltaType objectDelta = new ObjectDeltaType();
    objectDelta.setObjectToAdd(objectType);
    QName type = objectType.asPrismObject().getDefinition().getTypeName();
    objectDelta.setObjectType(type);
    objectDelta.setChangeType(ChangeTypeType.ADD);
    deltaList.getDelta().add(objectDelta);
    ObjectDeltaOperationListType objectDeltaOperationListType = modelWeb.executeChanges(deltaList, options);
    ObjectDeltaOperationType objectDeltaOperationType = getOdoFromDeltaOperationList(objectDeltaOperationListType, objectDelta);
    resultHolder.value = objectDeltaOperationType.getExecutionResult();
    oidHolder.value = ((ObjectType) objectDeltaOperationType.getObjectDelta().getObjectToAdd()).getOid();
}
Also used : ObjectDeltaOperationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectDeltaOperationType) ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType) QName(javax.xml.namespace.QName) 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 8 with ObjectDeltaOperationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectDeltaOperationType in project midpoint by Evolveum.

the class TestSanity method getOdoFromDeltaOperationList.

// ugly hack...
private static ObjectDeltaOperationType getOdoFromDeltaOperationList(ObjectDeltaOperationListType operationListType, ObjectDeltaType originalDelta) {
    Validate.notNull(operationListType);
    Validate.notNull(originalDelta);
    for (ObjectDeltaOperationType operationType : operationListType.getDeltaOperation()) {
        ObjectDeltaType objectDeltaType = operationType.getObjectDelta();
        if (originalDelta.getChangeType() == ChangeTypeType.ADD) {
            if (objectDeltaType.getChangeType() == originalDelta.getChangeType() && objectDeltaType.getObjectToAdd() != null) {
                ObjectType objectAdded = (ObjectType) objectDeltaType.getObjectToAdd();
                if (objectAdded.getClass().equals(originalDelta.getObjectToAdd().getClass())) {
                    return operationType;
                }
            }
        } else {
            if (objectDeltaType.getChangeType() == originalDelta.getChangeType() && originalDelta.getOid().equals(objectDeltaType.getOid())) {
                return operationType;
            }
        }
    }
    throw new IllegalStateException("No suitable ObjectDeltaOperationType found");
}
Also used : ObjectDeltaOperationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectDeltaOperationType) ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) GenericObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.GenericObjectType)

Example 9 with ObjectDeltaOperationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectDeltaOperationType in project midpoint by Evolveum.

the class ModelClientUtil method getOidFromDeltaOperationList.

/**
     * Retrieves OID created by model Web Service from the returned list of ObjectDeltaOperations.
     *
     * @param operationListType result of the model web service executeChanges call
     * @param originalDelta original request used to find corresponding ObjectDeltaOperationType instance. Must be of ADD type.
     * @return OID if found
     *
     * PRELIMINARY IMPLEMENTATION. Currently the first returned ADD delta with the same object type as original delta is returned.
     */
public static String getOidFromDeltaOperationList(ObjectDeltaOperationListType operationListType, ObjectDeltaType originalDelta) {
    Validate.notNull(operationListType);
    Validate.notNull(originalDelta);
    if (originalDelta.getChangeType() != ChangeTypeType.ADD) {
        throw new IllegalArgumentException("Original delta is not of ADD type");
    }
    if (originalDelta.getObjectToAdd() == null) {
        throw new IllegalArgumentException("Original delta contains no object-to-be-added");
    }
    for (ObjectDeltaOperationType operationType : operationListType.getDeltaOperation()) {
        ObjectDeltaType objectDeltaType = operationType.getObjectDelta();
        if (objectDeltaType.getChangeType() == ChangeTypeType.ADD && objectDeltaType.getObjectToAdd() != null) {
            ObjectType objectAdded = (ObjectType) objectDeltaType.getObjectToAdd();
            if (objectAdded.getClass().equals(originalDelta.getObjectToAdd().getClass())) {
                return objectAdded.getOid();
            }
        }
    }
    return null;
}
Also used : ObjectDeltaOperationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectDeltaOperationType) ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)

Example 10 with ObjectDeltaOperationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectDeltaOperationType 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

ObjectDeltaOperationType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectDeltaOperationType)28 ObjectDeltaType (com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType)23 ObjectDeltaOperationListType (com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType)12 OperationResultType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType)12 ObjectDeltaListType (com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaListType)11 ItemDeltaType (com.evolveum.prism.xml.ns._public.types_3.ItemDeltaType)9 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)6 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)6 QName (javax.xml.namespace.QName)5 Test (org.testng.annotations.Test)4 SystemException (com.evolveum.midpoint.util.exception.SystemException)3 AuditEventRecordType (com.evolveum.midpoint.xml.ns._public.common.audit_3.AuditEventRecordType)3 ModelExecuteOptionsType (com.evolveum.midpoint.xml.ns._public.common.common_3.ModelExecuteOptionsType)3 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)3 PolyStringType (com.evolveum.prism.xml.ns._public.types_3.PolyStringType)3 CanonicalItemPath (com.evolveum.midpoint.prism.path.CanonicalItemPath)2 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)2 MAuditDelta (com.evolveum.midpoint.repo.sql.audit.beans.MAuditDelta)2 DeltaConversionOptions (com.evolveum.midpoint.schema.DeltaConversionOptions)2 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)2