use of com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultImportanceType in project midpoint by Evolveum.
the class OperationResult method cleanupResult.
/**
* Removes all the successful minor results. Also checks if the result is roughly consistent
* and complete. (e.g. does not have unknown operation status, etc.)
* <p>
* The argument "e" is for easier use of the cleanup in the exceptions handlers. The original exception is passed
* to the IAE that this method produces for easier debugging.
*/
public void cleanupResult(Throwable e) {
if (!canBeCleanedUp()) {
// TEMPORARY fixme
return;
}
OperationResultImportanceType preserveDuringCleanup = getPreserveDuringCleanup();
if (status == OperationResultStatus.UNKNOWN) {
IllegalStateException illegalStateException = new IllegalStateException("Attempt to cleanup result of operation " + operation + " that is still UNKNOWN");
LOGGER.error("Attempt to cleanup result of operation " + operation + " that is still UNKNOWN:\n{}", this.debugDump(), illegalStateException);
throw illegalStateException;
}
if (subresults == null) {
return;
}
Iterator<OperationResult> iterator = subresults.iterator();
while (iterator.hasNext()) {
OperationResult subresult = iterator.next();
if (subresult.getStatus() == OperationResultStatus.UNKNOWN) {
String message = "Subresult " + subresult.getOperation() + " of operation " + operation + " is still UNKNOWN during cleanup";
LOGGER.error("{}:\n{}", message, this.debugDump(), e);
if (e == null) {
throw new IllegalStateException(message);
} else {
throw new IllegalStateException(message + "; during handling of exception " + e, e);
}
}
if (subresult.canCleanup(preserveDuringCleanup)) {
iterator.remove();
}
}
}
Aggregations