Package org.jbpm

Examples of org.jbpm.JbpmContext


  }
 
  private String doDeployment(FileItem fileItem) {
    try {
       ZipInputStream zipInputStream = new ZipInputStream(fileItem.getInputStream());
       JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
       ProcessDefinition processDefinition = ProcessDefinition.parseParZipInputStream(zipInputStream)
       log.debug("Created a processdefinition : " + processDefinition.getName() );
       jbpmContext.deployProcessDefinition(processDefinition);
       zipInputStream.close();
       return "Deployed archive " + processDefinition.getName() + " successfully";
    } catch (IOException e) {
      return "IOException";
    }
View Full Code Here


    PrintWriter writer = response.getWriter();
    try {
      URL archiveUrl = new URL(archive);
      ZipInputStream zis = new ZipInputStream(archiveUrl.openStream());
      JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
      ProcessDefinition processDefinition = ProcessDefinition.parseParZipInputStream(zis);
      jbpmContext.deployProcessDefinition(processDefinition);
      zis.close();
     
      writer.write("Deployed archive "+archive+" successfully");
     
    } catch (Exception e) {
View Full Code Here

  private static final long serialVersionUID = 1L;

  protected void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    long processDefinitionId = Long.parseLong( request.getParameter( "definitionId" ) );
    JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
    ProcessDefinition processDefinition = jbpmContext.getGraphSession().loadProcessDefinition(processDefinitionId);
    byte[] bytes = processDefinition.getFileDefinition().getBytes("processimage.jpg");
    OutputStream out = response.getOutputStream();
    out.write(bytes);
    out.flush();
   
View Full Code Here

      "</process-definition>"
    );

    ProcessInstance processInstance;
    TaskMgmtInstance taskMgmtInstance;
    JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
    jbpmContext.setActorId("the other guy");
    try {
      processInstance = new ProcessInstance(processDefinition);
      taskMgmtInstance = processInstance.getTaskMgmtInstance();
      taskMgmtInstance.createStartTaskInstance();
      processInstance.signal();
    } finally {
      jbpmContext.setActorId(null);
      jbpmContext.close();
    }
    assertEquals("the other guy", taskMgmtInstance.getSwimlaneInstance("initiator").getActorId());
  }
View Full Code Here

    } catch (FileNotFoundException e) {
      throw new BuildException("identities file '"+file+"' not found");
    }
    Entity[] entities = IdentityXmlParser.parseEntitiesResource(fileInputStream);
   
    JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
    try {
      Session session = jbpmContext.getSession();
      for (int i=0; i<entities.length; i++) {
        session.save(entities[i]);
      }
    } finally {
      jbpmContext.close();
    }
  }
View Full Code Here

   * serves as a hook for customizing the way the identity session is retrieved.
   * overload this method to reuse this expression assignment handler for your
   * user data store.
   */
  protected ExpressionSession getExpressionSession() {
    JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
    if (jbpmContext==null) {
      throw new RuntimeException("no active JbpmContext for resolving assignment expression'"+expression+"'");
    }
    return new IdentitySession(jbpmContext.getSession());
  }
View Full Code Here

      "<jbpm-configuration>" +
      "  <jbpm-context name='mycontext' />" +
      "</jbpm-configuration>"
    );
   
    JbpmContext jbpmContext = (JbpmContext) objectFactory.createObject("mycontext");
    assertNotNull(jbpmContext);
    assertNotNull(jbpmContext.getServices());
    assertNotNull(jbpmContext.getServices());
  }
View Full Code Here

      "    <service name='myservice' factory='org.jbpm.configuration.JbpmContextTest$MyServiceFactory' />" +
      "  </jbpm-context>" +
      "</jbpm-configuration>"
    );
   
    JbpmContext jbpmContext = (JbpmContext) objectFactory.createObject("mycontext");
    assertNotNull(jbpmContext);
    assertEquals(1, jbpmContext.getServices().getServiceFactories().size());
    assertTrue(jbpmContext.getServices().getServiceFactories().containsKey("myservice"));
  }
View Full Code Here

      "    </service>" +
      "  </jbpm-context>" +
      "</jbpm-configuration>"
    );
   
    JbpmContext jbpmContext = (JbpmContext) objectFactory.createObject("mycontext");
    assertNotNull(jbpmContext);
    Services services = jbpmContext.getServices();
    assertEquals(2, services.getServiceFactories().size());
    assertTrue(services.getServiceFactories().containsKey("myservice"));
    assertTrue(services.getServiceFactories().containsKey("mysecondservice"));
    assertSame(services.getServiceFactory("myservice"), services.getServiceFactory("mysecondservice"));
  }
View Full Code Here

      "  <end-state name='end' />" +
      "</process-definition>"
    );

    // Lookup the pojo persistence context-builder that is configured above
    JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
    try {
      // Deploy the process definition in the database
      jbpmContext.deployProcessDefinition(processDefinition);

    } finally {
      // Tear down the pojo persistence context.
      // This includes flush the SQL for inserting the process definition 
      // to the database.
      jbpmContext.close();
    }
  }
View Full Code Here

TOP

Related Classes of org.jbpm.JbpmContext

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.