use of org.apache.inlong.manager.workflow.processor.ElementProcessor in project incubator-inlong by apache.
the class ProcessorExecutorImpl method executeStart.
@Override
public void executeStart(Element element, WorkflowContext context) {
ElementProcessor processor = this.getProcessor(element.getClass());
context.setCurrentElement(element);
// If the current component needs to be skipped, proceed directly to the next one
if (isSkipCurrentElement(element, context)) {
executeSkipAndNext(element, context);
return;
}
processor.create(element, context);
if (processor.pendingForAction(context)) {
return;
}
// If it is a continuous task execution transaction isolation
if (element instanceof WorkflowTask) {
transactionHelper.execute(executeCompleteInTransaction(element, context), TransactionDefinition.PROPAGATION_NESTED);
return;
}
executeComplete(element, context);
}
use of org.apache.inlong.manager.workflow.processor.ElementProcessor in project incubator-inlong by apache.
the class ProcessorExecutorImpl method initProcessors.
private List<ElementProcessor<?>> initProcessors(WorkflowProcessEntityMapper processEntityMapper, WorkflowTaskEntityMapper taskEntityMapper, WorkflowEventNotifier eventNotifier) {
List<ElementProcessor<?>> processors = Lists.newArrayList();
processors.add(new StartEventProcessor(processEntityMapper, eventNotifier));
processors.add(new EndEventProcessor(processEntityMapper, taskEntityMapper, eventNotifier));
processors.add(new UserTaskProcessor(taskEntityMapper, eventNotifier));
processors.add(new ServiceTaskProcessor(taskEntityMapper, eventNotifier));
return processors;
}
use of org.apache.inlong.manager.workflow.processor.ElementProcessor in project incubator-inlong by apache.
the class ProcessorExecutorImpl method executeSkipAndNext.
private void executeSkipAndNext(Element element, WorkflowContext context) {
if (!(element instanceof SkippableElement)) {
throw new WorkflowException("element not instance of skip element " + element.getDisplayName());
}
if (!(element instanceof NextableElement)) {
throw new WorkflowException("element not instance of nextable element " + element.getDisplayName());
}
ElementProcessor processor = this.getProcessor(element.getClass());
if (!(processor instanceof SkipableElementProcessor)) {
throw new WorkflowException("element processor not instance of skip processor " + element.getDisplayName());
}
// Execute skip logic
SkipableElementProcessor skipableProcessor = (SkipableElementProcessor) processor;
skipableProcessor.skip(element, context);
// Execute next
context.getActionContext().setAction(((NextableElement) element).defaultNextAction());
List<Element> nextElements = processor.next(element, context);
nextElements.forEach(next -> executeStart(next, context));
}
use of org.apache.inlong.manager.workflow.processor.ElementProcessor in project incubator-inlong by apache.
the class ProcessorExecutorImpl method executeComplete.
@Override
public void executeComplete(Element element, WorkflowContext context) {
ElementProcessor processor = this.getProcessor(element.getClass());
context.setCurrentElement(element);
boolean completed = processor.complete(context);
if (!completed) {
return;
}
List<Element> nextElements = processor.next(element, context);
nextElements.forEach(next -> executeStart(next, context));
}
Aggregations