Package org.jbpm.graph.exe

Examples of org.jbpm.graph.exe.ProcessInstance


            final Set<String> updates = updatesHashMap.updatesSet();
            boolean updated = false;

            final Object targetValue = targetExpression.getValue(elContext);
            if (targetValue instanceof ProcessInstance) {
                final ProcessInstance processInstance = (ProcessInstance) targetValue;
                final ContextInstance contextInstance = processInstance.getContextInstance();
                for (String name : deletes) {
                    contextInstance.deleteVariable(name);
                    updated = true;
                }
                for (String name : updates) {
                    contextInstance.setVariable(name, updatesHashMap.get(name));
                    updated = true;
                }
            } else if (targetValue instanceof Token) {
                final Token token = (Token) targetValue;
                final ProcessInstance processInstance = token.getProcessInstance();
                final ContextInstance contextInstance = processInstance.getContextInstance();
                for (String name : deletes) {
                    contextInstance.deleteVariable(name, token);
                    updated = true;
                }
                for (String name : updates) {
View Full Code Here


   * @see #getProcessInstance(long)
   * @see #getProcessInstanceForUpdate(long)
   */
  public ProcessInstance loadProcessInstanceForUpdate(long processInstanceId)
  {
    ProcessInstance processInstance = getGraphSession().loadProcessInstance(processInstanceId);
    addAutoSaveProcessInstance(processInstance);
    return processInstance;
  }
View Full Code Here

   * @see #getProcessInstance(long)
   * @see #loadProcessInstanceForUpdate(long)
   */
  public ProcessInstance getProcessInstanceForUpdate(long processInstanceId)
  {
    ProcessInstance processInstance = getGraphSession().getProcessInstance(processInstanceId);
    if (processInstance != null)
    {
      addAutoSaveProcessInstance(processInstance);
    }
    return processInstance;
View Full Code Here

   * returns the process instance with the given key or null if no such instance exists. Upon close of this jbpmContext, the fetched process instance will be
   * automatically saved.
   */
  public ProcessInstance getProcessInstanceForUpdate(ProcessDefinition processDefinition, String key)
  {
    ProcessInstance processInstance = getGraphSession().getProcessInstance(processDefinition, key);
    if (processInstance != null)
    {
      addAutoSaveProcessInstance(processInstance);
    }
    return processInstance;
View Full Code Here

   * returns the process instance with the given key or throws an exception if no such instance exists. Upon close of this jbpmContext, the fetched process instance
   * will be automatically saved.
   */
  public ProcessInstance loadProcessInstanceForUpdate(ProcessDefinition processDefinition, String key)
  {
    ProcessInstance processInstance = getGraphSession().loadProcessInstance(processDefinition, key);
    if (processInstance != null)
    {
      addAutoSaveProcessInstance(processInstance);
    }
    return processInstance;
View Full Code Here

   * @throws JbpmException when no processDefinition with the given name is deployed.
   */
  public ProcessInstance newProcessInstance(String processDefinitionName)
  {
    ProcessDefinition processDefinition = getGraphSession().findLatestProcessDefinition(processDefinitionName);
    return new ProcessInstance(processDefinition);
  }
View Full Code Here

   * @throws JbpmException when no processDefinition with the given name is deployed.
   */
  public ProcessInstance newProcessInstanceForUpdate(String processDefinitionName)
  {
    ProcessDefinition processDefinition = getGraphSession().findLatestProcessDefinition(processDefinitionName);
    ProcessInstance processInstance = new ProcessInstance(processDefinition);
    addAutoSaveProcessInstance(processInstance);
    return processInstance;
  }
View Full Code Here

    @SuppressWarnings ({"unchecked"})
    public void handleAction(JbpmJsfContext context, ActionEvent event) {
        try {
            final FacesContext facesContext = FacesContext.getCurrentInstance();
            final ELContext elContext = facesContext.getELContext();
            final ProcessInstance processInstance = (ProcessInstance) processInstanceExpression.getValue(elContext);
            final List<TaskInstance> taskList =
                Collections.unmodifiableList(new ArrayList<TaskInstance>(processInstance.getTaskMgmtInstance().getTaskInstances()));
            targetExpression.setValue(elContext, taskList);
            context.selectOutcome("success");
        } catch (Exception ex) {
            context.setError("Error loading task list", ex);
            return;
View Full Code Here

      usedSubProcessDefinition = subProcessResolver.findSubProcess(subProcessElement);
    }

    // create the subprocess
    ProcessInstance subProcessInstance = superProcessToken.createSubProcessInstance(usedSubProcessDefinition);

    // fire the subprocess created event
    fireEvent(Event.EVENTTYPE_SUBPROCESS_CREATED, executionContext);

    // feed the readable variableInstances
    if ((variableAccesses != null) && (!variableAccesses.isEmpty()))
    {

      ContextInstance superContextInstance = executionContext.getContextInstance();
      ContextInstance subContextInstance = subProcessInstance.getContextInstance();
      subContextInstance.setTransientVariables(superContextInstance.getTransientVariables());

      // loop over all the variable accesses
      for (VariableAccess variableAccess : variableAccesses)
      {
        // if this variable access is readable
        if (variableAccess.isReadable())
        {
          // the variable is copied from the super process variable name
          // to the sub process mapped name
          String variableName = variableAccess.getVariableName();
          Object value = superContextInstance.getVariable(variableName, superProcessToken);
          String mappedName = variableAccess.getMappedName();
          log.debug("copying super process var '" + variableName + "' to sub process var '" + mappedName + "': " + value);
          if (value != null)
          {
            subContextInstance.setVariable(mappedName, value);
          }
        }
      }
    }

    // send the signal to start the subprocess
    subProcessInstance.signal();
  }
View Full Code Here

    subProcessInstance.signal();
  }

  public void leave(ExecutionContext executionContext, Transition transition)
  {
    ProcessInstance subProcessInstance = executionContext.getSubProcessInstance();

    Token superProcessToken = subProcessInstance.getSuperProcessToken();

    // feed the readable variableInstances
    if ((variableAccesses != null) && (!variableAccesses.isEmpty()))
    {

      ContextInstance superContextInstance = executionContext.getContextInstance();
      ContextInstance subContextInstance = subProcessInstance.getContextInstance();

      // loop over all the variable accesses
      for (VariableAccess variableAccess : variableAccesses)
      {
        // if this variable access is writable
View Full Code Here

TOP

Related Classes of org.jbpm.graph.exe.ProcessInstance

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.