use of org.contextmapper.dsl.contextMappingDSL.InclusiveAlternativeOperationInvokation in project context-mapper-dsl by ContextMapper.
the class Flow2SketchMinerConverter method convert.
private SimplifiedFlowStep convert(FlowStep step) {
Set<Task> froms = Sets.newLinkedHashSet();
Set<Task> tos = Sets.newLinkedHashSet();
ToType toType = ToType.XOR;
if (step instanceof CommandInvokationStep) {
froms.addAll(((CommandInvokationStep) step).getEvents().stream().map(e -> getOrCreateTask(e.getName(), TaskType.EVENT)).collect(Collectors.toList()));
if (((CommandInvokationStep) step).getAction() instanceof CommandInvokation) {
CommandInvokation commandInvokation = (CommandInvokation) ((CommandInvokationStep) step).getAction();
tos.addAll(commandInvokation.getCommands().stream().map(c -> getOrCreateTask(c.getName(), TaskType.COMMAND)).collect(Collectors.toList()));
if (commandInvokation instanceof ConcurrentCommandInvokation)
toType = ToType.AND;
if (commandInvokation instanceof InclusiveAlternativeCommandInvokation)
toType = ToType.OR;
} else if (((CommandInvokationStep) step).getAction() instanceof OperationInvokation) {
OperationInvokation operationInvokation = (OperationInvokation) ((CommandInvokationStep) step).getAction();
tos.addAll(operationInvokation.getOperations().stream().map(o -> getOrCreateTask(o.getName(), TaskType.COMMAND)).collect(Collectors.toList()));
if (operationInvokation instanceof ConcurrentOperationInvokation)
toType = ToType.AND;
if (operationInvokation instanceof InclusiveAlternativeOperationInvokation)
toType = ToType.OR;
}
} else if (step instanceof DomainEventProductionStep) {
DomainEventProductionStep eventStep = (DomainEventProductionStep) step;
froms.add(createTask4EventProduction(eventStep));
tos.addAll(eventStep.getEventProduction().getEvents().stream().map(e -> getOrCreateTask(e.getName(), TaskType.EVENT)).collect(Collectors.toList()));
if (eventStep.getEventProduction() instanceof MultipleEventProduction)
toType = ToType.AND;
if (eventStep.getEventProduction() instanceof InclusiveAlternativeEventProduction)
toType = ToType.OR;
}
return new SimplifiedFlowStep(froms, tos, toType);
}
Aggregations