Package org.jbpm.db

Examples of org.jbpm.db.GraphSession


    log.info("multipleJbpmInvocation");
   
    //     Get Sessions
    JbpmSession jbpmSession = JbpmSessionFactoryUtils.getSession(this.jbpmSessionFactory);
    GraphSession graphSession = jbpmSession.getGraphSession();

    graphSession.saveProcessDefinition(processDefinition);
    //     Get All Process Definitions
    List l = graphSession.findLatestProcessDefinitions();

    //     Get the arbitrarily first Process Definition
    ProcessDefinition pd = (ProcessDefinition) l.get(0);

    //     Load it again, individually
    ProcessDefinition pd2 = graphSession.loadProcessDefinition(pd.getId());

    //     Create an instance of the Process Def with Task
    ProcessInstance processInstance = new ProcessInstance(pd2);
    TaskInstance jbpmTaskInstance = processInstance.getTaskMgmtInstance().createStartTaskInstance();

    //     Persist these changes
    graphSession.saveProcessInstance(processInstance);

    //     Be polite, like the template is.
    JbpmSessionFactoryUtils.releaseSession(jbpmSession, this.jbpmSessionFactory);

  }
View Full Code Here


  public GraphSession getGraphSession() {
    if (graphSession == null) {
      Session session = getSession();
      if (session != null) {
        graphSession = new GraphSession(session);
      }
    }
    return graphSession;
  }
View Full Code Here

    // Lookup the pojo persistence context-builder that is configured above
    JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
    try {

      GraphSession graphSession = jbpmContext.getGraphSession();
     
      ProcessDefinition processDefinition =
          graphSession.findLatestProcessDefinition("hello world");
   
      // With the processDefinition that we retrieved from the database, we
      // can create an execution of the process definition just like in the
      // hello world example (which was without persistence).
      ProcessInstance processInstance =
View Full Code Here

   
    // Lookup the pojo persistence context-builder that is configured above
    JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
    try {

      GraphSession graphSession = jbpmContext.getGraphSession();
      // First, we need to get the process instance back out of the database.
      // There are several options to know what process instance we are dealing
      // with here.  The easiest in this simple test case is just to look for
      // the full list of process instances.  That should give us only one
      // result.  So let's look up the process definition.
     
      ProcessDefinition processDefinition =
          graphSession.findLatestProcessDefinition("hello world");

      // Now, we search for all process instances of this process definition.
      List processInstances =
          graphSession.findProcessInstances(processDefinition.getId());
     
      // Because we know that in the context of this unit test, there is
      // only one execution.  In real life, the processInstanceId can be
      // extracted from the content of the message that arrived or from
      // the user making a choice.
View Full Code Here

    return ("inspectInstance");
  }

  public String deleteProcessInstance() {
    JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
    GraphSession graphSession = jbpmContext.getGraphSession();
    graphSession.deleteProcessInstance(this.id);
    return ("deleteInstance");
  }
View Full Code Here

    return ("deleteInstance");
  }

  private void initialize() {
    JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
    GraphSession graphSession = jbpmContext.getGraphSession();
    ProcessInstance processInstance = graphSession.loadProcessInstance(this.id);
    this.start = processInstance.getStart();
    this.end = processInstance.getEnd();
    this.processDefinitionId = processInstance.getProcessDefinition().getId();
    this.processDefinitionLabel = processInstance.getProcessDefinition().getName() + " (version " + processInstance.getProcessDefinition().getVersion() + ")";
View Full Code Here

  public String updateVariable() {

    if (this.variableName != null) {
      JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
      GraphSession graphSession = jbpmContext.getGraphSession();
      ProcessInstance processInstance = graphSession.loadProcessInstance(this.id);
      if (this.variableValue != null) {
        processInstance.getContextInstance().setVariable(this.variableName, this.variableValue);
      } else {
        processInstance.getContextInstance().deleteVariable(this.variableName);
      }
View Full Code Here

  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);
      return "showTransitions";
    }
View Full Code Here

      } 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);
      }
View Full Code Here

    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

TOP

Related Classes of org.jbpm.db.GraphSession

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.