use of com.evolveum.midpoint.xml.ns._public.common.common_3.PartialProcessingTypeType in project midpoint by Evolveum.
the class ClockworkMedic method partialExecute.
public void partialExecute(String baseComponentName, ProjectorComponentRunnable runnable, Supplier<PartialProcessingTypeType> optionSupplier, Class<?> executingClass, LensContext<?> context, LensProjectionContext projectionContext, OperationResult initialParentResult) throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException, SecurityViolationException, PolicyViolationException, ExpressionEvaluationException, ObjectAlreadyExistsException, ConflictDetectedException {
context.checkAbortRequested();
OperationResult parentResult;
if (initialParentResult == null) {
LOGGER.warn("No parentResult in ClockworkMedic.partialExecute! Creating dummy one");
parentResult = new OperationResult(ClockworkMedic.class.getName() + ".partialExecute");
} else {
parentResult = initialParentResult;
}
String componentName;
if (projectionContext != null) {
componentName = baseComponentName + " " + projectionContext.getHumanReadableName();
} else {
componentName = baseComponentName;
}
ClockworkInspector clockworkInspector = getClockworkInspector();
PartialProcessingTypeType option = optionSupplier.get();
if (option == PartialProcessingTypeType.SKIP) {
LOGGER.debug("Skipping projector component {} because partial execution option is set to {}", componentName, option);
if (clockworkInspector != null) {
clockworkInspector.projectorComponentSkip(componentName);
}
} else {
String operationName = executingClass.getName() + "." + baseComponentName;
String qualifier = context.getOperationQualifier();
if (projectionContext != null) {
qualifier += "." + projectionContext.getResourceOid() + "." + projectionContext.getResourceShadowDiscriminator().getKind() + "." + projectionContext.getResourceShadowDiscriminator().getIntent();
}
OperationResult result = parentResult.subresult(operationName).addQualifier(qualifier).build();
ProjectorComponentTraceType trace;
if (result.isTracingAny(ProjectorComponentTraceType.class)) {
trace = new ProjectorComponentTraceType();
if (result.isTracingNormal(ProjectorComponentTraceType.class)) {
trace.setInputLensContextText(context.debugDump());
}
trace.setInputLensContext(context.toLensContextType(getExportType(trace, result)));
if (projectionContext != null) {
trace.setResourceShadowDiscriminator(LensUtil.createDiscriminatorBean(projectionContext.getResourceShadowDiscriminator(), context));
}
result.addTrace(trace);
} else {
trace = null;
}
try {
LOGGER.trace("Projector component started: {}", componentName);
if (clockworkInspector != null) {
clockworkInspector.projectorComponentStart(componentName);
}
runnable.run(result);
LOGGER.trace("Projector component finished: {}", componentName);
} catch (SchemaException | ObjectNotFoundException | CommunicationException | ConfigurationException | SecurityViolationException | PolicyViolationException | ExpressionEvaluationException | ObjectAlreadyExistsException | ConflictDetectedException | RuntimeException | Error e) {
LOGGER.trace("Projector component error: {}: {}: {}", componentName, e.getClass().getSimpleName(), e.getMessage());
result.recordFatalError(e);
throw e;
} finally {
result.computeStatusIfUnknown();
if (trace != null) {
if (result.isTracingNormal(ProjectorComponentTraceType.class)) {
trace.setOutputLensContextText(context.debugDump());
}
trace.setOutputLensContext(context.toLensContextType(getExportType(trace, result)));
}
if (clockworkInspector != null) {
clockworkInspector.projectorComponentFinish(componentName);
}
}
}
}
Aggregations