Package org.jbpm.pvm.internal.session

Examples of org.jbpm.pvm.internal.session.DbSession


    RepositorySession repositorySession = environment.get(RepositorySession.class);
    List<ProcessDefinition> processDefinitions = repositorySession.createProcessDefinitionQuery()
      .deploymentId(deploymentId)
      .list();
   
    DbSession dbSession = environment.get(DbSession.class);

    for (ProcessDefinition processDefinition: processDefinitions) {
      String processDefinitionId = processDefinition.getId();
      List<String> processInstanceIds = dbSession.findProcessInstanceIds(processDefinitionId);
     
      if (cascade) {
        for (String processInstanceId: processInstanceIds) {
          dbSession.deleteProcessInstance(processInstanceId, true);
        }

        dbSession.deleteProcessDefinitionHistory(processDefinitionId);
       
      } else {
        if (!processInstanceIds.isEmpty()) {
          throw new JbpmException("cannot delete deployment "+deploymentId+": still executions for "+processDefinition+": "+processInstanceIds);
        }
View Full Code Here


  }

  public Map<String, Object> execute(Environment environment) throws Exception {
    Map<String, Object> variables = new HashMap<String, Object>();

    DbSession dbSession = environment.get(DbSession.class);
    ClientExecution execution = dbSession.findExecutionById(executionId);
    for (String variableName : variableNames) {
      Object value = execution.getVariable(variableName);
      variables.put(variableName, value);
    }
View Full Code Here

    }
    this.executionId = executionId;
  }

  public Set<String> execute(Environment environment) throws Exception {
    DbSession dbSession = environment.get(DbSession.class);
    ClientExecution execution = dbSession.findExecutionById(executionId);
    return execution.getVariableKeys();
  }
View Full Code Here

      if (superProcessExecution!=null) {
        log.trace(toString()+" signals super process execution");
        superProcessExecution.signal();
      }
     
      DbSession dbSession = Environment.getFromCurrent(DbSession.class, false);
      if (dbSession!=null) {
        dbSession.deleteProcessInstance(id, false);
      }
    }
  }
View Full Code Here

  /** @see Execution#suspend() */
  public void suspend() {
    super.suspend();
    this.propagation = Propagation.EXPLICIT;
    DbSession dbSession = Environment.getFromCurrent(DbSession.class, false);
    if (dbSession!=null) {
      dbSession.cascadeExecutionSuspend(this);
    }
  }
View Full Code Here

  }

  /** @see Execution#resume() */
  public void resume() {
    super.resume();
    DbSession hibernatePvmDbSession = Environment.getFromCurrent(DbSession.class, false);
    if (hibernatePvmDbSession!=null) {
      hibernatePvmDbSession.cascadeExecutionResume(this);
    }
  }
View Full Code Here

  public void execute(ActivityExecution execution) {
    execute((ExecutionImpl)execution);
  }

  public void execute(ExecutionImpl execution) {
    DbSession dbSession = Environment.getFromCurrent(DbSession.class);
    TaskImpl task = (TaskImpl) dbSession.createTask();
    task.setTaskDefinition(taskDefinition);
    task.setExecution(execution);
    task.setProcessInstance(execution.getProcessInstance());
    task.setSignalling(true);
   
    // initialize the name
    if (taskDefinition.getName()!=null) {
      task.setName(taskDefinition.getName());
    } else {
      task.setName(execution.getActivityName());
    }

    task.setDescription(taskDefinition.getDescription());
    task.setPriority(taskDefinition.getPriority());
    task.setFormResourceName(taskDefinition.getFormResourceName());
   
    // save task so that TaskDbSession.findTaskByExecution works for assign event listeners
    dbSession.save(task);

    SwimlaneDefinitionImpl swimlaneDefinition = taskDefinition.getSwimlaneDefinition();
    if (swimlaneDefinition!=null) {
      SwimlaneImpl swimlane = execution.getInitializedSwimlane(swimlaneDefinition);
      task.setSwimlane(swimlane);
View Full Code Here

      execution.setVariables(parameters);
    }
   
    execution.fire(signalName, activity);

    DbSession taskDbSession = Environment
        .getFromCurrent(DbSession.class);
    TaskImpl task = (TaskImpl) taskDbSession.findTaskByExecution(execution);
    task.setSignalling(false);
   
    Transition transition = null;
    List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
    if ( (outgoingTransitions!=null)
View Full Code Here

  private static final long serialVersionUID = 1L;

  public void notify(EventListenerExecution execution) throws Exception {
    // find current task
    Environment environment = Environment.getCurrent();
    DbSession dbSession = environment.get(DbSession.class);
    TaskImpl task = dbSession.findTaskByExecution(execution);

    // make task available to mail templates through task context
    TaskContext taskContext = new TaskContext(task);
    environment.setContext(taskContext);
    try {
View Full Code Here

  public ExecuteTimerCmd(long timerDbid) {
    this.timerDbid = timerDbid;
  }

  public Date execute(Environment environment) throws Exception {
    DbSession dbSession = environment.get(DbSession.class);
    TimerImpl timerImpl = dbSession.get(TimerImpl.class, timerDbid);
    if (timerImpl == null) {
      log.debug("timer not found: " + timerDbid);
      return null; // i.e. delete this timer
    }
    return timerImpl.execute(environment) ? null : timerImpl.getDueDate();
View Full Code Here

TOP

Related Classes of org.jbpm.pvm.internal.session.DbSession

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.