Package org.jbpm.pvm.internal.session

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


  public VariableCreate(Variable variable) {
    this.variable = variable;
  }

  public void process() {
    DbSession dbSession = Environment.getFromCurrent(DbSession.class);
   
    dbSession.save(variable);

    HistoryProcessInstanceImpl historyProcessInstance = null;
    ExecutionImpl processInstance = variable.getProcessInstance();
    if (processInstance!=null) {
      long processInstanceDbid = processInstance.getDbid();
      historyProcessInstance = (HistoryProcessInstanceImpl)
          dbSession.get(HistoryProcessInstanceImpl.class, processInstanceDbid);
    }
   
    HistoryTaskImpl historyTask = null;
    TaskImpl task = variable.getTask();
    if (task!=null) {
      long taskDbid = task.getDbid();
      historyTask = (HistoryTaskImpl)
          dbSession.get(HistoryTaskImpl.class, taskDbid);
    }
   
    HistoryVariableImpl historyVariable = new HistoryVariableImpl(historyProcessInstance, historyTask, variable);
    dbSession.save(historyVariable);
  }
View Full Code Here


    this.variable = variable;
  }

  @Override
  public void process() {
    DbSession dbSession = Environment.getFromCurrent(DbSession.class);
    HistoryVariableImpl historyVariable = dbSession.get(HistoryVariableImpl.class, variable.getDbid());
    historyVariable.updated(variable);
  }
View Full Code Here

  public Collection<Long> execute(Environment environment) throws Exception {
    Collection<Long> acquiredJobDbids = new ArrayList<Long>();

    Collection<JobImpl<?>> acquiredJobs = new ArrayList<JobImpl<?>>();
   
    DbSession dbSession = environment.get(DbSession.class);
    log.debug("start querying first acquirable job...");

    JobImpl<?> job = dbSession.findFirstAcquirableJob();

    if (job!=null) {
      if (job.isExclusive()) {
        log.trace("exclusive acquirable job found ("+job+"). querying for other exclusive jobs to lock them all in one tx...");
        List<JobImpl<?>> otherExclusiveJobs = dbSession.findExclusiveJobs(job.getProcessInstance());
        acquiredJobs.addAll(otherExclusiveJobs);
      } else {
        acquiredJobs.add(job);
      }
View Full Code Here

  public Object execute(Environment environment) throws Exception {
    log.debug("handling job "+jobDbid+" exception: "+exception.getMessage());
   
    // load the job from the db
    DbSession dbSession = environment.get(DbSession.class);
    if (dbSession==null) {
      throw new JbpmException("no job-session configured to handle job");
    }
    JobImpl<?> job = (JobImpl<?>) dbSession.get(JobImpl.class, jobDbid);
    // serialize the stack trace
    StringWriter sw = new StringWriter();
    exception.printStackTrace(new PrintWriter(sw));
    if (job != null) {
      // decrement the number of retries
View Full Code Here

  }

  public Date execute(Environment environment) throws Exception {
    Date nextDueDate = null;
    log.debug("getting next due date...");
    DbSession dbSession = environment.get(DbSession.class);
    JobImpl<?> job = dbSession.findFirstDueJob();
    if (job!=null) {
      nextDueDate = job.getDueDate();
    }
    log.debug("next due date is "+nextDueDate);
    return nextDueDate;
View Full Code Here

    this.userId = userId;
    this.take = take;
  }

  public Void execute(Environment environment) {
    DbSession dbSession = environment.get(DbSession.class);
    TaskImpl task = dbSession.get(TaskImpl.class, Long.parseLong(taskId));
    if (task==null) {
      throw new JbpmException("task "+taskId+" does not exist");
    }
    if (take) {
      task.take(userId);
View Full Code Here

    this.processInstanceId = processInstanceId;
    this.state = state;
  }

  public Object execute(Environment environment) throws Exception {
    DbSession dbSession = Environment.getFromCurrent(DbSession.class);
    ExecutionImpl processInstance = (ExecutionImpl) dbSession.findProcessInstanceById(processInstanceId);
    processInstance.end(state);
    return null;
  }
View Full Code Here

public class ActivityStart extends HistoryEvent {

  private static final long serialVersionUID = 1L;

  public void process() {
    DbSession dbSession = Environment.getFromCurrent(DbSession.class);

    long processInstanceDbid = execution.getProcessInstance().getDbid();

    HistoryProcessInstance historyProcessInstanceImpl = (HistoryProcessInstance)
        dbSession.get(HistoryProcessInstanceImpl.class, processInstanceDbid);
   
    HistoryActivityInstanceImpl historyActivityInstance =
        createHistoryActivityInstance(historyProcessInstanceImpl);
   
    String activityType = execution.getActivity().getType();
    historyActivityInstance.setType(activityType);
   
    dbSession.save(historyActivityInstance);
   
    execution.setHistoryActivityInstanceDbid(historyActivityInstance.getDbid());
  }
View Full Code Here

  public TaskActivityStart(TaskImpl task) {
    this.task = task;
  }
 
  public void process() {
    DbSession dbSession = Environment.getFromCurrent(DbSession.class);

    ExecutionImpl processInstance = execution.getProcessInstance();
    long processInstanceDbid = processInstance.getDbid();

    HistoryProcessInstance historyProcessInstance =
        dbSession.get(HistoryProcessInstanceImpl.class, processInstanceDbid);
   
    HistoryTaskImpl historyTask = new HistoryTaskImpl(task);
    historyTask.setExecutionId(execution.getId());
   
    HistoryActivityInstanceImpl historyActivityInstance =
        new HistoryTaskInstanceImpl(historyProcessInstance, execution, historyTask);
   
    String activityType = execution.getActivity().getType();
    historyActivityInstance.setType(activityType);
   
    dbSession.save(historyActivityInstance);
   
    execution.setHistoryActivityInstanceDbid(historyActivityInstance.getDbid());
  }
View Full Code Here

      this.parentTaskDbid = Long.parseLong(parentTaskId);
    }
  }

  public Task execute(Environment environment) throws Exception {
    DbSession dbSession = environment.get(DbSession.class);
    TaskImpl task = (TaskImpl) dbSession.createTask();
    task.setSuperTaskDbid(parentTaskDbid);
    return task;
  }
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.