use of com.evolveum.midpoint.xml.ns._public.common.common_3.ErrorSelectorType in project midpoint by Evolveum.
the class Projector method projectProjection.
private <F extends ObjectType> void projectProjection(LensContext<F> context, LensProjectionContext projectionContext, PartialProcessingOptionsType partialProcessingOptions, XMLGregorianCalendar now, String activityDescription, Task task, OperationResult parentResult) throws ObjectNotFoundException, CommunicationException, SchemaException, ConfigurationException, SecurityViolationException, PolicyViolationException, ExpressionEvaluationException, ObjectAlreadyExistsException {
if (projectionContext.getWave() != context.getProjectionWave()) {
// Let's skip accounts that do not belong into this wave.
return;
}
String projectionDesc = getProjectionDesc(projectionContext);
OperationResult result = parentResult.createMinorSubresult(OPERATION_PROJECT_PROJECTION);
result.addParam(OperationResult.PARAM_PROJECTION, projectionDesc);
try {
context.checkAbortRequested();
if (projectionContext.getSynchronizationPolicyDecision() == SynchronizationPolicyDecision.BROKEN || projectionContext.getSynchronizationPolicyDecision() == SynchronizationPolicyDecision.IGNORE) {
result.recordStatus(OperationResultStatus.NOT_APPLICABLE, "Skipping projection because it is " + projectionContext.getSynchronizationPolicyDecision());
return;
}
if (projectionContext.isThombstone()) {
result.recordStatus(OperationResultStatus.NOT_APPLICABLE, "Skipping projection because it is a thombstone");
return;
}
LOGGER.trace("WAVE {} PROJECTION {}", context.getProjectionWave(), projectionDesc);
// Some projections may not be loaded at this point, e.g. high-order dependency projections
contextLoader.makeSureProjectionIsLoaded(context, projectionContext, task, result);
if (consistencyChecks)
context.checkConsistence();
if (!dependencyProcessor.checkDependencies(context, projectionContext, result)) {
result.recordStatus(OperationResultStatus.NOT_APPLICABLE, "Skipping projection because it has unsatisfied dependencies");
return;
}
// TODO: decide if we need to continue
LensUtil.partialExecute("projectionValues", () -> {
// This is a "composite" processor. it contains several more processor invocations inside
projectionValuesProcessor.process(context, projectionContext, activityDescription, task, result);
if (consistencyChecks)
context.checkConsistence();
projectionContext.recompute();
if (consistencyChecks)
context.checkConsistence();
}, partialProcessingOptions::getProjectionValues);
LensUtil.partialExecute("projectionCredentials", () -> {
projectionCredentialsProcessor.processProjectionCredentials(context, projectionContext, now, task, result);
if (consistencyChecks)
context.checkConsistence();
projectionContext.recompute();
LensUtil.traceContext(LOGGER, activityDescription, "projection values and credentials of " + projectionDesc, false, context, true);
if (consistencyChecks)
context.checkConsistence();
}, partialProcessingOptions::getProjectionCredentials);
LensUtil.partialExecute("projectionReconciliation", () -> {
reconciliationProcessor.processReconciliation(context, projectionContext, task, result);
projectionContext.recompute();
LensUtil.traceContext(LOGGER, activityDescription, "projection reconciliation of " + projectionDesc, false, context, false);
if (consistencyChecks)
context.checkConsistence();
}, partialProcessingOptions::getProjectionReconciliation);
LensUtil.partialExecute("projectionLifecycle", () -> {
activationProcessor.processLifecycle(context, projectionContext, now, task, result);
if (consistencyChecks)
context.checkConsistence();
projectionContext.recompute();
// LensUtil.traceContext(LOGGER, activityDescription, "projection lifecycle of "+projectionDesc, false, context, false);
if (consistencyChecks)
context.checkConsistence();
}, partialProcessingOptions::getProjectionLifecycle);
result.recordSuccess();
} catch (ObjectNotFoundException | CommunicationException | SchemaException | ConfigurationException | SecurityViolationException | PolicyViolationException | ExpressionEvaluationException | ObjectAlreadyExistsException | RuntimeException | Error e) {
result.recordFatalError(e);
ResourceType resourceType = projectionContext.getResource();
if (resourceType == null) {
throw e;
} else {
ErrorSelectorType errorSelector = null;
if (resourceType.getConsistency() != null) {
errorSelector = resourceType.getConsistency().getConnectorErrorCriticality();
}
if (errorSelector == null) {
if (e instanceof CommunicationException) {
// Just continue evaluation. The error is recorded in the result.
// The consistency mechanism has (most likely) already done the best.
// We cannot do any better.
} else {
throw e;
}
} else {
if (ExceptionUtil.isSelected(errorSelector, e)) {
throw e;
} else {
// Just continue evaluation. The error is recorded in the result.
}
}
}
}
}
Aggregations