Package org.eclipse.bpmn2

Examples of org.eclipse.bpmn2.DocumentRoot


    }
   
    @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

    public Definitions createAndInitResource(URI uri) {
        Resource resource = createResource(uri);
        Bpmn2Factory factory = Bpmn2Factory.eINSTANCE;
        Definitions definitions = factory.createDefinitions();
        DocumentRoot docummentRoot = factory.createDocumentRoot();
        docummentRoot.setDefinitions(definitions);
        resource.getContents().add(docummentRoot);

        return definitions;
    }
View Full Code Here

        DroolsFactoryImpl.init();
        BpsimFactoryImpl.init();
        Resource resource = createResource(uri);
        Bpmn2Factory factory = Bpmn2Factory.eINSTANCE;
        Definitions definitions = factory.createDefinitions();
        DocumentRoot docummentRoot = factory.createDocumentRoot();
        docummentRoot.setDefinitions(definitions);
        resource.getContents().add(docummentRoot);

        return definitions;
    }
View Full Code Here

     * @generated
     */
    protected T doSwitch(int classifierID, EObject theEObject) {
        switch (classifierID) {
        case Bpmn2Package.DOCUMENT_ROOT: {
            DocumentRoot documentRoot = (DocumentRoot) theEObject;
            T result = caseDocumentRoot(documentRoot);
            if (result == null)
                result = defaultCase(theEObject);
            return result;
        }
View Full Code Here

    public Definitions createAndInitResource(URI uri) {
        Resource resource = createResource(uri);
        Bpmn2Factory factory = Bpmn2Factory.eINSTANCE;
        Definitions definitions = factory.createDefinitions();
        DocumentRoot docummentRoot = factory.createDocumentRoot();
        docummentRoot.setDefinitions(definitions);
        resource.getContents().add(docummentRoot);

        return definitions;
    }
View Full Code Here

   * @param defintion
   */
  public void save(Definitions defintion){
    ResourceSet resourceSet = getResourceSet();
    Bpmn2Resource resource = (Bpmn2Resource) resourceSet.getResource(URI.createFileURI("d:\\node_template.bpmn"), true);
    DocumentRoot documentRoot = (DocumentRoot) resource.getContents().get(0);
    documentRoot.setDefinitions(defintion);
    try {
      resource.save(null);
    } catch (IOException e) {
      e.printStackTrace();
    }
View Full Code Here

   * @param uri
   */
  public void save(Definitions definitions,URI uri){
    ResourceSet resourceSet = getResourceSet();
    Bpmn2Resource resource = (Bpmn2Resource) resourceSet.getResource(uri, true);
    DocumentRoot documentRoot = (DocumentRoot) resource.getContents().get(0);
    documentRoot.setDefinitions(definitions);
    try {
      resource.save(null);
    } catch (IOException e) {
      e.printStackTrace();
      throw new FixFlowException(ExceptionCode.EXCEPTION_DEFAULT,e);
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);
            resource.getContents().add(docRoot);
          }
        });
        return;
      }
View Full Code Here

TOP

Related Classes of org.eclipse.bpmn2.DocumentRoot

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.