Package org.eclipse.bpmn2.impl

Examples of org.eclipse.bpmn2.impl.BaseElementImpl


    public void testPoolUnmarshalling() throws Exception {
        Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
        Definitions definitions = ((Definitions) unmarshaller.unmarshall(getTestJsonFile("pool.json"), "").getContents().get(0));
        assertTrue(definitions.getRootElements().size() == 1);
        assertTrue(definitions.getRootElements().get(0) instanceof Process);
        Process process = getRootProcess(definitions);
        assertEquals("pool", process.getName());
        assertEquals(ProcessType.PRIVATE, process.getProcessType());
        assertTrue(process.isIsClosed());
        definitions.eResource().save(System.out, Collections.emptyMap());
    }
View Full Code Here


    public void testLaneUnmarshalling() throws Exception {
        Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
        Definitions definitions = ((Definitions) unmarshaller.unmarshall(getTestJsonFile("pool.json"), "").getContents().get(0));
        assertTrue(definitions.getRootElements().size() == 1);
        assertTrue(definitions.getRootElements().get(0) instanceof Process);
        Process process = getRootProcess(definitions);
        assertTrue(process.getLaneSets().size() == 1);
        assertTrue(process.getLaneSets().get(0).getLanes().size() == 1);
        Lane l = process.getLaneSets().get(0).getLanes().get(0);
        assertEquals("my first lane", l.getName());
        definitions.eResource().save(System.out, Collections.emptyMap());
    }
View Full Code Here

    @Test
    public void testSequenceFlowUnmarshalling() throws Exception {
        Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
        Definitions definitions = ((Definitions) unmarshaller.unmarshall(getTestJsonFile("sequenceFlow.json"), "").getContents().get(0));
        assertTrue(definitions.getRootElements().size() == 1);
        Process process = getRootProcess(definitions);
        assertTrue(process.getFlowElements().get(0) instanceof Task);
        Task task = (Task) process.getFlowElements().get(0);
        assertEquals("task1", task.getName());
        Task task2 = (Task) process.getFlowElements().get(1);
        assertEquals("task2", task2.getName());
        SequenceFlow flow = (SequenceFlow) process.getFlowElements().get(2);
        assertEquals("seqFlow", flow.getName());
        assertEquals(task, flow.getSourceRef());
        assertEquals(task2, flow.getTargetRef());
        definitions.eResource().save(System.out, Collections.emptyMap());
    }
View Full Code Here

    @Test
    public void testGatewayUnmarshalling() throws Exception {
        Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
        Definitions definitions = ((Definitions) unmarshaller.unmarshall(getTestJsonFile("gateway.json"), "").getContents().get(0));
        assertTrue(definitions.getRootElements().size() == 1);
        Process process = getRootProcess(definitions);
        ExclusiveGateway g = (ExclusiveGateway) process.getFlowElements().get(0);
        assertEquals("xor gateway", g.getName());
        definitions.eResource().save(System.out, Collections.emptyMap());
    }
View Full Code Here

    @Test
    public void testParallelGatewayUnmarshalling() throws Exception {
        Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
        Definitions definitions = ((Definitions) unmarshaller.unmarshall(getTestJsonFile("parallelGateway.json"), "").getContents().get(0));
        assertTrue(definitions.getRootElements().size() == 1);
        Process process = getRootProcess(definitions);
        ParallelGateway g = (ParallelGateway) process.getFlowElements().get(0);
        assertEquals("parallel gateway", g.getName());
        definitions.eResource().save(System.out, Collections.emptyMap());
    }
View Full Code Here

    @Test
    public void testEventBasedGatewayUnmarshalling() throws Exception {
        Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
        Definitions definitions = ((Definitions) unmarshaller.unmarshall(getTestJsonFile("eventBasedGateway.json"), "").getContents().get(0));
        assertTrue(definitions.getRootElements().size() == 1);
        Process process = getRootProcess(definitions);
        EventBasedGateway g = (EventBasedGateway) process.getFlowElements().get(0);
        assertEquals("event-based gateway", g.getName());
        definitions.eResource().save(System.out, Collections.emptyMap());
    }
View Full Code Here

    @Test
    public void testInclusiveGatewayUnmarshalling() throws Exception {
        Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
        Definitions definitions = ((Definitions) unmarshaller.unmarshall(getTestJsonFile("inclusiveGateway.json"), "").getContents().get(0));
        assertTrue(definitions.getRootElements().size() == 1);
        Process process = getRootProcess(definitions);
        InclusiveGateway g = (InclusiveGateway) process.getFlowElements().get(0);
        assertEquals("inclusive gateway", g.getName());
        definitions.eResource().save(System.out, Collections.emptyMap());
    }
View Full Code Here

    @Test
    public void testStartEventUnmarshalling() throws Exception {
        Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
        Definitions definitions = ((Definitions) unmarshaller.unmarshall(getTestJsonFile("startEvent.json"), "").getContents().get(0));
        assertTrue(definitions.getRootElements().size() == 1);
        Process process = getRootProcess(definitions);
        StartEvent g = (StartEvent) process.getFlowElements().get(0);
        assertEquals("start event", g.getName());
        definitions.eResource().save(System.out, Collections.emptyMap());
    }
View Full Code Here

    @Test
    public void testStartMessageEventUnmarshalling() throws Exception {
        Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
        Definitions definitions = ((Definitions) unmarshaller.unmarshall(getTestJsonFile("startMessageEvent.json"), "").getContents().get(0));
        assertTrue(definitions.getRootElements().size() == 3);
        Process process = getRootProcess(definitions);
        StartEvent g = (StartEvent) process.getFlowElements().get(0);
        assertEquals("start message event", g.getName());
        assertTrue(g.getEventDefinitions().size() == 1);
        assertTrue(g.getEventDefinitions().iterator().next() instanceof MessageEventDefinition);
        definitions.eResource().save(System.out, Collections.emptyMap());
    }
View Full Code Here

    loadEventObj(processDefinitionBehavior);
    return processDefinitionBehavior;
  }

  private void loadEventObj(BaseElement baseElement) {
    BaseElementImpl baseElementImpl = (BaseElementImpl) baseElement;
    if (baseElement instanceof SubProcess) {
      SubProcess subProcess = (SubProcess) baseElement;
      List<FlowElement> flowElements = subProcess.getFlowElements();
      for (FlowElement flowElement : flowElements) {
        if (flowElement instanceof Activity) {
          loadEventObj(flowElement);
        }
      }
    }
    List<ConnectorInstance> connectorInstances = baseElementImpl.getConnectorInstances();
    if (connectorInstances != null) {
      for (ConnectorInstance connectorInstance : connectorInstances) {
        String packageNamesString = connectorInstance.getPackageName();
        String classNameString = connectorInstance.getClassName();
        String eventTypeString = connectorInstance.getEventType();
        String connectorIdString = connectorInstance.getConnectorId();
        String connectorInstanceIdString = connectorInstance.getConnectorInstanceId();
        String connectorInstanceNameString = connectorInstance.getConnectorInstanceName();
        String errorHandlingString = connectorInstance.getErrorHandling();
        String errorCodeString = connectorInstance.getErrorCode();
        boolean isTimeExecute = connectorInstance.isIsTimeExecute();
        String documentationString = connectorInstance.getDocumentation().getValue();
        String skipExpression = null;
        if (connectorInstance.getSkipComment() != null) {
          skipExpression = connectorInstance.getSkipComment().getExpression().getValue();
        }
        String timeExpression = null;
        if (connectorInstance.getTimeExpression() != null) {
          timeExpression = connectorInstance.getTimeExpression().getExpression().getValue();
        }
        ConnectorInstanceBehavior connectorInstanceBehavior = new ConnectorInstanceBehavior();
        connectorInstanceBehavior.setConnectorId(connectorIdString);
        connectorInstanceBehavior.setConnectorInstanceId(connectorInstanceIdString);
        connectorInstanceBehavior.setClassName(classNameString);
        connectorInstanceBehavior.setConnectorInstanceName(connectorInstanceNameString);
        connectorInstanceBehavior.setDocumentation(documentationString);
        connectorInstanceBehavior.setErrorCode(errorCodeString);
        connectorInstanceBehavior.setErrorHandling(errorHandlingString);
        connectorInstanceBehavior.setEventType(eventTypeString);
        connectorInstanceBehavior.setPackageName(packageNamesString);
        connectorInstanceBehavior.setSkipExpression(skipExpression);
        if (isTimeExecute) {
          connectorInstanceBehavior.setTimeExecute(true);
          connectorInstanceBehavior.setTimeExpression(timeExpression);
        } else {
          connectorInstanceBehavior.setTimeExecute(false);
        }
        if (baseElementImpl.getEvents().get(eventTypeString) == null) {
          BaseElementEventImpl flowNodeEventImpl = new BaseElementEventImpl(eventTypeString);
          flowNodeEventImpl.addConnector(connectorInstanceBehavior);
          baseElementImpl.addEvent(flowNodeEventImpl);
        } else {
          baseElementImpl.getEvents().get(eventTypeString).addConnector(connectorInstanceBehavior);
        }
        List<ConnectorParameterInputs> connectorParameterInputs = connectorInstance.getConnectorParameterInputs();
        connectorInstanceBehavior.getConnectorParameterInputs().clear();
        connectorInstanceBehavior.getConnectorParameterInputs().addAll(connectorParameterInputs);
        List<ConnectorParameterOutputs> connectorParameterOutputs = connectorInstance.getConnectorParameterOutputs();
View Full Code Here

TOP

Related Classes of org.eclipse.bpmn2.impl.BaseElementImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.