use of com.evolveum.midpoint.studio.action.transfer.ProcessObjectResult in project midpoint-studio by Evolveum.
the class TaskUpgradeTask method processObject.
@Override
public ProcessObjectResult processObject(MidPointObject object) throws Exception {
String oldContent = object.getContent();
String newContent = MidPointUtils.upgradeTaskToUseActivities(oldContent);
MidPointObject newObject = MidPointObject.copy(object);
newObject.setContent(newContent);
return new ProcessObjectResult(null).object(newObject);
}
use of com.evolveum.midpoint.studio.action.transfer.ProcessObjectResult in project midpoint-studio by Evolveum.
the class ObjectsBackgroundableTask method processObjects.
protected ProcessFileObjectsResult processObjects(ProgressIndicator indicator, List<MidPointObject> objects, VirtualFile file) {
if (objects.isEmpty()) {
state.incrementSkippedFile();
midPointService.printToConsole(null, RefreshAction.class, "Skipped file " + (file != null ? file.getPath() : "<unknown>") + " no objects found (parsed).");
return new ProcessFileObjectsResult();
}
List<String> newObjects = new ArrayList<>();
boolean stop = false;
int current = 0;
for (MidPointObject object : objects) {
ProgressManager.checkCanceled();
current++;
if (indicator != null) {
indicator.setFraction((double) current / objects.size());
}
if (shouldSkipObjectProcessing(object)) {
newObjects.add(object.getContent());
state.incrementSkipped();
continue;
}
ProcessObjectResult result = processObject(object, new ExtendedCallable<>() {
@Override
public String describe() {
return object.getName() + "(" + object.getOid() + ")";
}
@Override
public ProcessObjectResult call() throws Exception {
return processObject(object);
}
});
if (!result.shouldContinue()) {
state.setStopOnError();
stop = true;
break;
}
MidPointObject newObject = result.object();
if (newObject != null) {
newObjects.add(newObject.getContent());
}
}
return new ProcessFileObjectsResult(newObjects, stop);
}
use of com.evolveum.midpoint.studio.action.transfer.ProcessObjectResult in project midpoint-studio by Evolveum.
the class ObjectsBackgroundableTask method processObject.
private ProcessObjectResult processObject(MidPointObject object, ExtendedCallable<ProcessObjectResult> callable) {
try {
ProcessObjectResult processResult = callable.call();
if (processResult.problem()) {
state.incrementFailed();
} else {
state.incrementProcessed();
}
return processResult;
} catch (Exception ex) {
state.incrementFailed();
publishException(midPointService, "Exception occurred during '" + getTitle() + "' of '" + callable.describe() + "'", ex);
}
ProcessObjectResult result = new ProcessObjectResult(null);
result.object(object);
result.shouldContinue(!isShouldStopOnError());
return result;
}
use of com.evolveum.midpoint.studio.action.transfer.ProcessObjectResult in project midpoint-studio by Evolveum.
the class ObjectsBackgroundableTask method processOidsList.
private boolean processOidsList(ProgressIndicator indicator) {
if (!confirmedOperation(oids.size(), ConfirmationUnit.OBJECT)) {
return false;
}
int i = 0;
for (Pair<String, ObjectTypes> pair : oids) {
ProgressManager.checkCanceled();
i++;
indicator.setFraction((double) i / oids.size());
ProcessObjectResult result = processObject(null, new ExtendedCallable<>() {
@Override
public String describe() {
return pair.getFirst() + "(" + pair.getSecond() + ")";
}
@Override
public ProcessObjectResult call() throws Exception {
return processObjectOid(pair.getSecond(), pair.getFirst());
}
});
if (!result.shouldContinue()) {
state.setStopOnError();
break;
}
}
return true;
}
Aggregations