use of com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType in project midpoint by Evolveum.
the class TestSanity method deleteObjectViaModelWS.
private OperationResultType deleteObjectViaModelWS(QName typeQName, String oid) throws FaultMessage {
ObjectDeltaListType deltaList = new ObjectDeltaListType();
ObjectDeltaType objectDelta = new ObjectDeltaType();
objectDelta.setOid(oid);
objectDelta.setObjectType(typeQName);
objectDelta.setChangeType(ChangeTypeType.DELETE);
deltaList.getDelta().add(objectDelta);
ObjectDeltaOperationListType list = modelWeb.executeChanges(deltaList, null);
return getOdoFromDeltaOperationList(list, objectDelta).getExecutionResult();
}
use of com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType 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.api_types_3.ObjectDeltaOperationListType in project midpoint by Evolveum.
the class AbstractTestForExchangeConnector method assertExecuteChangesSuccess.
protected ObjectDeltaOperationType assertExecuteChangesSuccess(ObjectDeltaOperationListType odolist, ObjectDeltaType deltaType, boolean assertSuccess) {
ObjectDeltaOperationType found = null;
for (ObjectDeltaOperationType odo : odolist.getDeltaOperation()) {
if (deltaType == null || deltaType.getOid().equals(odo.getObjectDelta().getOid())) {
AssertJUnit.assertNotNull("Operation result is null", odo.getExecutionResult());
found = odo;
if (odo.getExecutionResult().getStatus() != OperationResultStatusType.SUCCESS) {
System.out.println("!!! Operation result is " + odo.getExecutionResult().getStatus());
System.out.println("!!! Message: " + odo.getExecutionResult().getMessage());
System.out.println("!!! Details:\n" + odo.getExecutionResult());
if (assertSuccess) {
AssertJUnit.assertEquals("Unexpected operation result status", OperationResultStatusType.SUCCESS, odo.getExecutionResult().getStatus());
}
}
}
}
AssertJUnit.assertNotNull("ObjectDelta was not found in ObjectDeltaOperationList", found);
return found;
}
use of com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType in project midpoint by Evolveum.
the class AbstractTestForExchangeConnector method createAccountOdo.
protected ObjectDeltaOperationType createAccountOdo(String givenName, String sn, String name, String recipientType, String overrideMail) throws FaultMessage {
ShadowType shadowType = prepareShadowType(givenName, sn, name, recipientType, overrideMail, null, null, null);
ObjectDeltaType deltaType = new ObjectDeltaType();
deltaType.setObjectType(ModelClientUtil.getTypeQName(ShadowType.class));
deltaType.setChangeType(ChangeTypeType.ADD);
deltaType.setObjectToAdd(shadowType);
ObjectDeltaListType deltaListType = new ObjectDeltaListType();
deltaListType.getDelta().add(deltaType);
ObjectDeltaOperationListType operationListType = modelPort.executeChanges(deltaListType, null);
return ModelClientUtil.findInDeltaOperationList(operationListType, deltaType);
}
use of com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectDeltaOperationListType in project midpoint by Evolveum.
the class AbstractTestForExchangeConnector method getOidFromDeltaOperationList.
/**
* Retrieves OID and OperationResult 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.
* @param operationResultHolder where the result will be put
* @return OID if found
*
* PRELIMINARY IMPLEMENTATION. Currently the first returned ADD delta with the same object type as original delta is returned.
*
* TODO move to ModelClientUtil
*/
public static String getOidFromDeltaOperationList(ObjectDeltaOperationListType operationListType, ObjectDeltaType originalDelta, Holder<OperationResultType> operationResultTypeHolder) {
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())) {
operationResultTypeHolder.value = operationType.getExecutionResult();
return objectAdded.getOid();
}
}
}
return null;
}
Aggregations