use of com.evolveum.midpoint.wf.impl.processors.primary.aspect.PrimaryChangeAspect in project midpoint by Evolveum.
the class WfTaskUtil method getPrimaryChangeAspect.
@NotNull
public PrimaryChangeAspect getPrimaryChangeAspect(Task task, Collection<PrimaryChangeAspect> aspects) {
WfContextType wfc = getWorkflowContextChecked(task);
WfProcessorSpecificStateType pss = wfc.getProcessorSpecificState();
if (!(pss instanceof WfPrimaryChangeProcessorStateType)) {
throw new IllegalStateException("Expected " + WfPrimaryChangeProcessorStateType.class + " but got " + pss + " in task " + task);
}
WfPrimaryChangeProcessorStateType pcps = ((WfPrimaryChangeProcessorStateType) pss);
String aspectClassName = pcps.getChangeAspect();
if (aspectClassName == null) {
throw new IllegalStateException("No wf primary change aspect defined in task " + task);
}
for (PrimaryChangeAspect a : aspects) {
if (aspectClassName.equals(a.getClass().getName())) {
return a;
}
}
throw new IllegalStateException("Primary change aspect " + aspectClassName + " is not registered.");
}
use of com.evolveum.midpoint.wf.impl.processors.primary.aspect.PrimaryChangeAspect in project midpoint by Evolveum.
the class PrimaryChangeProcessor method gatherStartInstructions.
private List<PcpChildWfTaskCreationInstruction> gatherStartInstructions(@NotNull ObjectTreeDeltas changesBeingDecomposed, ModelInvocationContext ctx, @NotNull OperationResult result) throws SchemaException, ObjectNotFoundException {
PrimaryChangeProcessorConfigurationType processorConfigurationType = ctx.wfConfiguration != null ? ctx.wfConfiguration.getPrimaryChangeProcessor() : null;
List<PcpChildWfTaskCreationInstruction> startProcessInstructions = new ArrayList<>();
for (PrimaryChangeAspect aspect : getActiveChangeAspects(processorConfigurationType)) {
if (changesBeingDecomposed.isEmpty()) {
// nothing left
break;
}
List<PcpChildWfTaskCreationInstruction> instructions = aspect.prepareTasks(changesBeingDecomposed, ctx, result);
logAspectResult(aspect, instructions, changesBeingDecomposed);
if (instructions != null) {
startProcessInstructions.addAll(instructions);
}
}
return startProcessInstructions;
}
use of com.evolveum.midpoint.wf.impl.processors.primary.aspect.PrimaryChangeAspect in project midpoint by Evolveum.
the class PrimaryChangeProcessor method onProcessEnd.
//endregion
//region Processing process finish event
@Override
public void onProcessEnd(ProcessEvent event, WfTask wfTask, OperationResult result) throws SchemaException, ObjectAlreadyExistsException, ObjectNotFoundException {
PcpWfTask pcpJob = new PcpWfTask(wfTask);
PrimaryChangeAspect aspect = pcpJob.getChangeAspect();
pcpJob.storeResultingDeltas(aspect.prepareDeltaOut(event, pcpJob, result));
}
use of com.evolveum.midpoint.wf.impl.processors.primary.aspect.PrimaryChangeAspect in project midpoint by Evolveum.
the class PrimaryChangeProcessor method gatherStartInstructions.
private <O extends ObjectType> List<PcpStartInstruction> gatherStartInstructions(@NotNull ObjectTreeDeltas<O> changesBeingDecomposed, @NotNull ModelInvocationContext<O> ctx, @NotNull OperationResult parentResult) throws SchemaException, ObjectNotFoundException {
OperationResult result = parentResult.subresult(OP_GATHER_START_INSTRUCTIONS).setMinor().build();
try {
PrimaryChangeProcessorConfigurationType processorConfigurationType = ctx.wfConfiguration != null ? ctx.wfConfiguration.getPrimaryChangeProcessor() : null;
List<PcpStartInstruction> startProcessInstructions = new ArrayList<>();
for (PrimaryChangeAspect aspect : getActiveChangeAspects(processorConfigurationType)) {
if (changesBeingDecomposed.isEmpty()) {
// nothing left
break;
}
List<PcpStartInstruction> instructions = aspect.getStartInstructions(changesBeingDecomposed, ctx, result);
logAspectResult(aspect, instructions, changesBeingDecomposed);
startProcessInstructions.addAll(instructions);
}
result.addParam("instructionsCount", startProcessInstructions.size());
return startProcessInstructions;
} catch (Throwable t) {
result.recordFatalError(t);
throw t;
} finally {
result.computeStatusIfUnknown();
}
}
Aggregations