Package org.jbpm

Examples of org.jbpm.JbpmContext


  public String signal() {

    selectToken();

    JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
    GraphSession graphSession = jbpmContext.getGraphSession();

    Token token = graphSession.loadToken(this.tokenInstanceId);

    if (token.getNode().getLeavingTransitions().size() > 1) {
      initializeAvailableTransitions(token);
View Full Code Here


    String transitionName;

    transitionName = JsfHelper.getParameter("transitionName");
    ProcessInstance processInstance = null;

    JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
    if (this.taskInstanceId > 0) {
      TaskMgmtSession taskMgmtSession = jbpmContext.getTaskMgmtSession();
      TaskInstance taskInstance = taskMgmtSession.loadTaskInstance(this.taskInstanceId);
      if (transitionName.equals("")) {
        taskInstance.end();
      } else {
        taskInstance.end(transitionName);
      }
      processInstance = taskInstance.getToken().getProcessInstance();
    } else if (this.tokenInstanceId > 0) {
      GraphSession graphSession = jbpmContext.getGraphSession();
      Token token = graphSession.loadToken(this.tokenInstanceId);
      if (transitionName.equals("")) {
        token.signal();
      } else {
        token.signal(transitionName);
      }
      processInstance = token.getProcessInstance();
    }

    jbpmContext.save(processInstance);

    this.initializeTasksList(processInstance);
    this.initializeTokensList(processInstance);

    return "inspectInstance";
View Full Code Here

  public String endTask() {

    selectTask();

    JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
    TaskMgmtSession taskMgmtSession = jbpmContext.getTaskMgmtSession();

    TaskInstance taskInstance = taskMgmtSession.loadTaskInstance(this.taskInstanceId);

    if (taskInstance.getAvailableTransitions().size() > 1) {
      initializeAvailableTransitions(taskInstance);
      return "showTransitions";
    }

    taskInstance.end();

    ProcessInstance processInstance = taskInstance.getToken().getProcessInstance();
    jbpmContext.save(processInstance);

    this.initializeTasksList(processInstance);
    this.initializeTokensList(processInstance);

    return "";
View Full Code Here

    return EqualsUtil.equals(this, o);
  }
 
  protected Service getService(String serviceName) {
    Service service = null;
    JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
    if (jbpmContext!=null) {
      service = jbpmContext.getServices().getService(serviceName);
    }
    return service;
  }
View Full Code Here

    jbpmConfiguration.createSchema();
    connection.commit();
    connection.close();
   
    connection = DriverManager.getConnection("jdbc:hsqldb:.");
    JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
    jbpmContext.setConnection(connection);
    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
      "<process-definition name='hello' />"
    );
    jbpmContext.deployProcessDefinition(processDefinition);
    jbpmContext.close();
    connection.commit();
    connection.close();

    connection = DriverManager.getConnection("jdbc:hsqldb:.");
    jbpmContext = jbpmConfiguration.createJbpmContext();
    jbpmContext.setConnection(connection);
    jbpmContext.newProcessInstanceForUpdate("hello");
    jbpmContext.close();
    connection.commit();
    connection.close();
  }
View Full Code Here

   
    processInstance = saveAndReload(processInstance);
    processInstance.signal();
    jbpmContext.save(processInstance);
   
    JbpmContext concurrentContext = jbpmConfiguration.createJbpmContext();
    ProcessInstance sameProcessInstanceInDifferentSession = concurrentContext.loadProcessInstance(processInstance.getId());
    sameProcessInstanceInDifferentSession.end();
    concurrentContext.save(sameProcessInstanceInDifferentSession);
    log.debug("closing concurrent context");
    concurrentContext.close();
   
    try {
      log.debug("closing default test method context");
      commitAndCloseSession();
      fail("expected exception");
View Full Code Here

      "</jbpm-configuration>"
    );
   
    DbPersistenceServiceFactory dbPersistenceServiceFactory = (DbPersistenceServiceFactory) jbpmConfiguration.getServiceFactory("persistence");
    assertFalse(dbPersistenceServiceFactory.isTransactionEnabled());
    JbpmContext jbpmContext = (JbpmContext) jbpmConfiguration.createJbpmContext();
    try {
      DbPersistenceService dbPersistenceService = (DbPersistenceService) jbpmContext.getServices().getPersistenceService();
      assertFalse(dbPersistenceService.isTransactionEnabled());
      assertNull(dbPersistenceService.getTransaction());
    } finally {
      jbpmContext.close();
    }
  }
View Full Code Here

      "  <string name='resource.hibernate.properties' value='org/jbpm/persistence/db/custom.hibernate.properties' />" +
      "</jbpm-configuration>"
    );
   
    DbPersistenceServiceFactory dbPersistenceServiceFactory = (DbPersistenceServiceFactory) jbpmConfiguration.getServiceFactory("persistence");
    JbpmContext jbpmContext = (JbpmContext) jbpmConfiguration.createJbpmContext();
    try {
      DbPersistenceService dbPersistenceService = (DbPersistenceService) jbpmContext.getServices().getPersistenceService();
      assertEquals(0, dbPersistenceService.getSessionFactory().getAllClassMetadata().size());
      assertEquals("org.hibernate.dialect.PostgreSQLDialect", dbPersistenceServiceFactory.configuration.getProperty("hibernate.dialect"));
    } finally {
      jbpmContext.close();
    }
  }
View Full Code Here

    this.version = version;
    this.instancesCount = instancesCount;
  }

  private void initialize() {
    JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
    GraphSession graphSession = jbpmContext.getGraphSession();
    ProcessDefinition processDefinition = graphSession.loadProcessDefinition(id);
    this.name = processDefinition.getName();
    this.version = processDefinition.getVersion();
    this.instancesCount = graphSession.findProcessInstances(this.id).size();
  }
View Full Code Here

    this.instancesCount = graphSession.findProcessInstances(this.id).size();
  }

  public List getProcessInstances() {

    JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
    GraphSession graphSession = jbpmContext.getGraphSession();

    ArrayList processInstancesList = new ArrayList();

    List listProcessInstance = graphSession.findProcessInstances(this.id);
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.