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);
}
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();
}
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");
}
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;
}
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());
}
}
}
Aggregations