@Test public void testConvertAdhocSubprocess() { AdHocSubprocess definition = new AdHocSubprocess(); String adHocOrdering = "Parallel"; boolean adHocAutostart = true; String processVariables = "processVar1:Object:myTag,processVar2:Integer"; definition.getGeneral().getName().setValue(NAME); definition.getGeneral().getDocumentation().setValue(DOCUMENTATION); definition.getProcessData().getProcessVariables().setValue(processVariables); definition.getExecutionSet().getAdHocOrdering().setValue(adHocOrdering); definition.getExecutionSet().getAdHocAutostart().setValue(adHocAutostart); definition.getExecutionSet().getAdHocActivationCondition().setValue(ACTIVATION_CONDITION); definition.getExecutionSet().getAdHocCompletionCondition().setValue(COMPLETION_CONDITION); definition.getExecutionSet().getOnEntryAction().getValue().addValue(ON_ENTRY_ACTION); definition.getExecutionSet().getOnExitAction().getValue().addValue(ON_EXIT_ACTION); setBaseSubprocessExecutionSetValues(definition.getExecutionSet()); double nodeX1 = 10; double nodeY1 = 20; double nodeX2 = 40; double nodeY2 = 60; View<BaseAdHocSubprocess> view = new ViewImpl<>(definition, Bounds.create(nodeX1, nodeY1, nodeX2, nodeY2)); Node<View<? extends BPMNViewDefinition>, Edge> node = new NodeImpl<>(ELEMENT_ID); node.setContent(view); double parentX1 = 30; double parentY1 = 40; double parentX2 = 60; double parentY2 = 100; Node<View<? extends BPMNViewDefinition>, ?> parent = new NodeImpl<>("parentId"); View<? extends BPMNViewDefinition> parentView = new ViewImpl<>(null, Bounds.create(parentX1, parentY1, parentX2, parentY2)); parent.setContent(parentView); Edge<Child, Node> edge = new EdgeImpl("edgeId"); edge.setContent(mock(Child.class)); node.getInEdges().add(edge); edge.setSourceNode(parent); edge.setTargetNode(node); Result<SubProcessPropertyWriter> result = tested.convertSubProcess(node); assertTrue(result.isSuccess()); AdHocSubProcess adHocSubProcess = (AdHocSubProcess) result.value().getElement(); assertEquals(ELEMENT_ID, adHocSubProcess.getId()); assertEquals(NAME, adHocSubProcess.getName()); assertEquals(asCData(NAME), CustomElement.name.of(adHocSubProcess).get()); assertEquals(asCData(DOCUMENTATION), DocumentationTextHandler.of(adHocSubProcess.getDocumentation().get(0)).getText()); assertEquals(adHocOrdering, adHocSubProcess.getOrdering().getName()); assertEquals(adHocAutostart, CustomElement.autoStart.of(adHocSubProcess).get()); assertEquals(Scripts.LANGUAGE.valueOf(COMPLETION_CONDITION.getLanguage().toUpperCase()).format(), ((FormalExpression) adHocSubProcess.getCompletionCondition()).getLanguage()); assertEquals(asCData(COMPLETION_CONDITION.getScript()), FormalExpressionBodyHandler.of((FormalExpression) adHocSubProcess.getCompletionCondition()).getBody()); assertEquals(ON_ENTRY_ACTION.getLanguage(), Scripts.onEntry(adHocSubProcess.getExtensionValues()).getValues().get(0).getLanguage()); assertEquals(asCData(ON_ENTRY_ACTION.getScript()), Scripts.onEntry(adHocSubProcess.getExtensionValues()).getValues().get(0).getScript()); assertEquals(ON_EXIT_ACTION.getLanguage(), Scripts.onExit(adHocSubProcess.getExtensionValues()).getValues().get(0).getLanguage()); assertEquals(asCData(ON_EXIT_ACTION.getScript()), Scripts.onExit(adHocSubProcess.getExtensionValues()).getValues().get(0).getScript()); assertVariables(Arrays.asList(new Pair<>("processVar1", "Object"), new Pair<>("processVar2", "Integer")), adHocSubProcess.getProperties()); BPMNShape shape = result.value().getShape(); assertEquals(parentX1 + nodeX1, shape.getBounds().getX(), 0); assertEquals(parentY1 + nodeY1, shape.getBounds().getY(), 0); assertEquals(nodeX2 - nodeX1, shape.getBounds().getWidth(), 0); assertEquals(nodeY2 - nodeY1, shape.getBounds().getHeight(), 0); assertBaseSubprocessExecutionSet(result.value()); }
public Result<SubProcessPropertyWriter> convertSubProcess(Node<View<? extends BPMNViewDefinition>, ?> node) { final Result<SubProcessPropertyWriter> processRootResult; final BPMNViewDefinition def = node.getContent().getDefinition(); if (def instanceof EmbeddedSubprocess) { processRootResult = Result.success(convertEmbeddedSubprocessNode(cast(node))); } else if (def instanceof EventSubprocess) { processRootResult = Result.success(convertEventSubprocessNode(cast(node))); } else if (def instanceof BaseAdHocSubprocess) { processRootResult = Result.success(convertAdHocSubprocessNode(cast(node))); } else if (def instanceof MultipleInstanceSubprocess) { processRootResult = Result.success(convertMultipleInstanceSubprocessNode(cast(node))); } else { return Result.ignored("unknown type"); } DefinitionsBuildingContext subContext = context.withRootNode(node); SubProcessPropertyWriter processRoot = processRootResult.value(); super.convertChildNodes(processRoot, subContext); super.convertEdges(processRoot, subContext); return processRootResult; }
SubProcessConverter extends ProcessConverterDelegate { public Result<SubProcessPropertyWriter> convertSubProcess(Node<View<? extends BPMNViewDefinition>, ?> node) { final Result<SubProcessPropertyWriter> processRootResult; final BPMNViewDefinition def = node.getContent().getDefinition(); if (def instanceof EmbeddedSubprocess) { processRootResult = Result.success(convertEmbeddedSubprocessNode(cast(node))); } else if (def instanceof EventSubprocess) { processRootResult = Result.success(convertEventSubprocessNode(cast(node))); } else if (def instanceof BaseAdHocSubprocess) { processRootResult = Result.success(convertAdHocSubprocessNode(cast(node))); } else if (def instanceof MultipleInstanceSubprocess) { processRootResult = Result.success(convertMultipleInstanceSubprocessNode(cast(node))); } else { return Result.ignored("unknown type"); } DefinitionsBuildingContext subContext = context.withRootNode(node); SubProcessPropertyWriter processRoot = processRootResult.value(); super.convertChildNodes(processRoot, subContext); super.convertEdges(processRoot, subContext); return processRootResult; } }
SubProcessConverter extends ProcessConverterDelegate { public Result<SubProcessPropertyWriter> convertSubProcess(Node<View<? extends BPMNViewDefinition>, ?> node) { final Result<SubProcessPropertyWriter> processRootResult; final BPMNViewDefinition def = node.getContent().getDefinition(); if (def instanceof EmbeddedSubprocess) { processRootResult = Result.success(convertEmbeddedSubprocessNode(cast(node))); } else if (def instanceof EventSubprocess) { processRootResult = Result.success(convertEventSubprocessNode(cast(node))); } else if (def instanceof BaseAdHocSubprocess) { processRootResult = Result.success(convertAdHocSubprocessNode(cast(node))); } else if (def instanceof MultipleInstanceSubprocess) { processRootResult = Result.success(convertMultipleInstanceSubprocessNode(cast(node))); } else { return Result.ignored("unknown type"); } DefinitionsBuildingContext subContext = context.withRootNode(node); SubProcessPropertyWriter processRoot = processRootResult.value(); super.convertChildNodes(processRoot, subContext); super.convertEdges(processRoot, subContext); return processRootResult; } SubProcessConverter(DefinitionsBuildingContext context,
                               PropertyWriterFactory propertyWriterFactory,
                               ConverterFactory converterFactory); }
SubProcessConverter extends ProcessConverterDelegate { public Result<SubProcessPropertyWriter> convertSubProcess(Node<View<? extends BPMNViewDefinition>, ?> node) { final Result<SubProcessPropertyWriter> processRootResult; final BPMNViewDefinition def = node.getContent().getDefinition(); if (def instanceof EmbeddedSubprocess) { processRootResult = Result.success(convertEmbeddedSubprocessNode(cast(node))); } else if (def instanceof EventSubprocess) { processRootResult = Result.success(convertEventSubprocessNode(cast(node))); } else if (def instanceof BaseAdHocSubprocess) { processRootResult = Result.success(convertAdHocSubprocessNode(cast(node))); } else if (def instanceof MultipleInstanceSubprocess) { processRootResult = Result.success(convertMultipleInstanceSubprocessNode(cast(node))); } else { return Result.ignored("unknown type"); } DefinitionsBuildingContext subContext = context.withRootNode(node); SubProcessPropertyWriter processRoot = processRootResult.value(); super.convertChildNodes(processRoot, subContext); super.convertEdges(processRoot, subContext); return processRootResult; } SubProcessConverter(DefinitionsBuildingContext context,
                               PropertyWriterFactory propertyWriterFactory,
                               ConverterFactory converterFactory); Result<SubProcessPropertyWriter> convertSubProcess(Node<View<? extends BPMNViewDefinition>, ?> node); }
SubProcessConverter extends ProcessConverterDelegate { public Result<SubProcessPropertyWriter> convertSubProcess(Node<View<? extends BPMNViewDefinition>, ?> node) { final Result<SubProcessPropertyWriter> processRootResult; final BPMNViewDefinition def = node.getContent().getDefinition(); if (def instanceof EmbeddedSubprocess) { processRootResult = Result.success(convertEmbeddedSubprocessNode(cast(node))); } else if (def instanceof EventSubprocess) { processRootResult = Result.success(convertEventSubprocessNode(cast(node))); } else if (def instanceof BaseAdHocSubprocess) { processRootResult = Result.success(convertAdHocSubprocessNode(cast(node))); } else if (def instanceof MultipleInstanceSubprocess) { processRootResult = Result.success(convertMultipleInstanceSubprocessNode(cast(node))); } else { return Result.ignored("unknown type"); } DefinitionsBuildingContext subContext = context.withRootNode(node); SubProcessPropertyWriter processRoot = processRootResult.value(); super.convertChildNodes(processRoot, subContext); super.convertEdges(processRoot, subContext); return processRootResult; } SubProcessConverter(DefinitionsBuildingContext context,
                               PropertyWriterFactory propertyWriterFactory,
                               ConverterFactory converterFactory); Result<SubProcessPropertyWriter> convertSubProcess(Node<View<? extends BPMNViewDefinition>, ?> node);  }