use of org.apache.inlong.manager.workflow.definition.NextableElement 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.definition.NextableElement in project incubator-inlong by apache.
the class WorkflowQueryServiceImpl method addNext.
private void addNext(NextableElement nextableElement, ElementDTO elementDTO, WorkflowContext context, Map<String, TaskStatus> nameToStatusMap) {
for (Element element : nextableElement.getNextList(context)) {
ElementDTO nextElement = new ElementDTO();
nextElement.setName(element.getName());
nextElement.setDisplayName(element.getDisplayName());
if (element instanceof UserTask) {
nextElement.setApprovers(((UserTask) element).getApproverAssign().assign(context));
nextElement.setStatus(nameToStatusMap.get(element.getName()));
}
elementDTO.getNext().add(nextElement);
if (!(element instanceof NextableElement)) {
continue;
}
addNext((NextableElement) element, nextElement, context, nameToStatusMap);
}
}
Aggregations