use of com.evolveum.midpoint.xml.ns._public.common.common_3.ModelExecuteOptionsType in project midpoint by Evolveum.
the class AbstractWebserviceTest method cleanObjects.
private <O extends ObjectType> void cleanObjects(Class<O> type, boolean raw, String... protectedOids) throws FaultMessage {
Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();
Holder<ObjectListType> objectListHolder = new Holder<ObjectListType>();
SelectorQualifiedGetOptionsType rootOpts = null;
ModelExecuteOptionsType execOpts = null;
if (raw) {
rootOpts = ModelClientUtil.createRootGetOptions(ModelClientUtil.createRawGetOption());
execOpts = ModelClientUtil.createRawExecuteOption();
}
modelPort.searchObjects(getTypeQName(type), null, rootOpts, objectListHolder, resultHolder);
List<String> protectedOidList = Arrays.asList(protectedOids);
ObjectListType objectList = objectListHolder.value;
for (ObjectType object : objectList.getObject()) {
if (!protectedOidList.contains(object.getOid())) {
display("Deleting " + type.getSimpleName() + " " + ModelClientUtil.toString(object));
deleteObject(type, object.getOid(), execOpts);
}
}
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ModelExecuteOptionsType in project midpoint by Evolveum.
the class Main method deleteRole.
private static void deleteRole(ModelPortType modelPort, String oid) throws FaultMessage {
ObjectDeltaType deltaType = new ObjectDeltaType();
deltaType.setObjectType(ModelClientUtil.getTypeQName(RoleType.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);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ModelExecuteOptionsType in project midpoint by Evolveum.
the class TestSanity 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.ModelExecuteOptionsType in project midpoint by Evolveum.
the class TestSanity method test005resolveConnectorRef.
@Test
public void test005resolveConnectorRef() throws Exception {
TestUtil.displayTestTile("test005resolveConnectorRef");
PrismObject<ResourceType> resource = PrismTestUtil.parseObject(new File(RESOURCE_DUMMY_FILENAME));
ModelExecuteOptionsType options = new ModelExecuteOptionsType();
options.setIsImport(Boolean.TRUE);
addObjectViaModelWS(resource.asObjectable(), options, new Holder<String>(), new Holder<OperationResultType>());
OperationResult repoResult = new OperationResult("getObject");
PrismObject<ResourceType> uObject = repositoryService.getObject(ResourceType.class, RESOURCE_DUMMY_OID, null, repoResult);
assertNotNull(uObject);
ResourceType resourceType = uObject.asObjectable();
assertNotNull("Reference on the connector must not be null in resource.", resourceType.getConnectorRef());
assertNotNull("Missing oid reference on the connector", resourceType.getConnectorRef().getOid());
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ModelExecuteOptionsType in project midpoint by Evolveum.
the class DeleteAction method executeAction.
@Override
protected void executeAction() throws Exception {
ModelPortType port = createModelPort();
ModelExecuteOptionsType options = new ModelExecuteOptionsType();
options.setForce(getParams().isForce());
options.setRaw(getParams().isRaw());
QName type = getParams().getType();
ObjectDeltaType delta = createDeleteDelta(getParams().getOid(), type);
ObjectDeltaListType deltas = createDeltaList(delta);
try {
ObjectDeltaOperationListType result = port.executeChanges(deltas, options);
List<ObjectDeltaOperationType> operations = result.getDeltaOperation();
ObjectDeltaOperationType operation = operations.get(0);
OperationResultType resultType = operation.getExecutionResult();
STD_OUT.info("Status: {}", resultType.getStatus());
} catch (FaultMessage ex) {
handleError("Couldn't delete object '" + type.getLocalPart() + "' with oid '" + getParams().getOid() + "'", ex);
}
}
Aggregations