Package org.eclipse.bpmn2

Examples of org.eclipse.bpmn2.Definitions


    Bpmn2ResourceFactoryImpl ddd = new Bpmn2ResourceFactoryImpl();
 
    Resource ddddResource = ddd.createResource(URI.createFileURI("/Users/jiangnan/Documents/MyCode/irondino/fixlogic/app/modules/lhl002/bpmn/testflow.bpmn"));

    ddddResource.load( null);
    Definitions myWeb = (Definitions) ddddResource.getContents().get(0).eContents().get(0);
    Object dddObject = myWeb;

    List<BPMNDiagram> BPMNDiagramList = myWeb.getDiagrams();
    float maxX=0;
    float maxY=0;
    for (BPMNDiagram bpmnDiagram : BPMNDiagramList) {
      for (DiagramElement diagramElement : bpmnDiagram.getPlane().getPlaneElement()) {
View Full Code Here


  private void updateComposite(EObject be, BPMN2Editor diagramEditor, BPMNShape shape) {
    if (be instanceof BPMNDiagramImpl) {
      try {
        Resource eResource = be.eResource();
        if (eResource != null) {
          Definitions definitions = ModelHandlerLocator.getModelHandler(eResource).getDefinitions();
          composite.setShape(shape);
          composite.setEObject(diagramEditor, definitions);
        } else {
          composite.setShape(shape);
          composite.setEObject(diagramEditor, null);
View Full Code Here

    if (contents.isEmpty() || !(contents.get(0) instanceof DocumentRoot)) {
      TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(resource);

      if (domain != null) {
        final DocumentRoot docRoot = FACTORY.createDocumentRoot();
        final Definitions definitions = FACTORY.createDefinitions();
//        definitions.setId(EcoreUtil.generateUUID());
        ModelUtil.setID(definitions,resource);
        Collaboration collaboration = FACTORY.createCollaboration();
//        collaboration.setId(EcoreUtil.generateUUID());
        ModelUtil.setID(collaboration,resource);
        Participant participant = FACTORY.createParticipant();
//        participant.setId(EcoreUtil.generateUUID());
        ModelUtil.setID(participant,resource);
        participant.setName("Internal");
        collaboration.getParticipants().add(participant);
        definitions.getRootElements().add(collaboration);

        domain.getCommandStack().execute(new RecordingCommand(domain) {
          @Override
          protected void doExecute() {
            docRoot.setDefinitions(definitions);
View Full Code Here

    invisibleRoot.removeChildren();
    if (mh == null) {
      return;
    }

    Definitions definitions = mh.getDefinitions();

    List<RootElement> rootElements = definitions.getRootElements();
    for (RootElement element : rootElements) {

      if (element instanceof Process) {
        Process process = (Process) element;
        TreeParent proc = new TreeParent("Process");
View Full Code Here

    }
   
    @Test
    public void testLaneUnmarshalling() throws Exception {
        Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
        Definitions definitions = unmarshaller.unmarshall(getTestJsonFile("pool.json"));
        assertTrue(definitions.getRootElements().size() == 1);
        assertTrue(definitions.getRootElements().get(0) instanceof Process);
        Process process = (Process) definitions.getRootElements().get(0);
        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 = unmarshaller.unmarshall(getTestJsonFile("sequenceFlow.json"));
        assertTrue(definitions.getRootElements().size() == 1);
        Process process = (Process) definitions.getRootElements().get(0);
        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 testScriptTaskUnmarshalling() throws Exception {
        Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
        Definitions definitions = unmarshaller.unmarshall(getTestJsonFile("scriptTask.json"));
        assertTrue(definitions.getRootElements().size() == 1);
        GlobalScriptTask task = (GlobalScriptTask) definitions.getRootElements().get(0);
        assertEquals("my script", task.getName());
        assertEquals("git status | grep modified | awk '{print $3}' | xargs echo | xargs git add", task.getScript());
        assertEquals("bash", task.getScriptLanguage());
        definitions.eResource().save(System.out, Collections.emptyMap());
    }
View Full Code Here

    }
   
    @Test
    public void testUserTaskUnmarshalling() throws Exception {
        Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
        Definitions definitions = unmarshaller.unmarshall(getTestJsonFile("userTask.json"));
        assertTrue(definitions.getRootElements().size() == 1);
        GlobalUserTask task = (GlobalUserTask) definitions.getRootElements().get(0);
        assertEquals("ask user", task.getName());
        definitions.eResource().save(System.out, Collections.emptyMap());
    }
View Full Code Here

    }
   
    @Test
    public void testBusinessRuleTaskUnmarshalling() throws Exception {
        Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
        Definitions definitions = unmarshaller.unmarshall(getTestJsonFile("businessRuleTask.json"));
        assertTrue(definitions.getRootElements().size() == 1);
        GlobalBusinessRuleTask task = (GlobalBusinessRuleTask) definitions.getRootElements().get(0);
        assertEquals("call business rule", task.getName());
        definitions.eResource().save(System.out, Collections.emptyMap());
    }
View Full Code Here

    }
   
    @Test
    public void testManualTaskUnmarshalling() throws Exception {
        Bpmn2JsonUnmarshaller unmarshaller = new Bpmn2JsonUnmarshaller();
        Definitions definitions = unmarshaller.unmarshall(getTestJsonFile("manualTask.json"));
        assertTrue(definitions.getRootElements().size() == 1);
        GlobalManualTask task = (GlobalManualTask) definitions.getRootElements().get(0);
        assertEquals("pull a lever", task.getName());
        definitions.eResource().save(System.out, Collections.emptyMap());
    }
View Full Code Here

TOP

Related Classes of org.eclipse.bpmn2.Definitions

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.