Examples of DbSession


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

    }
    this.taskId = taskId;
  }

  public Set<String> execute(Environment environment) throws Exception {
    DbSession dbSession = environment.get(DbSession.class);
    TaskImpl task = dbSession.get(TaskImpl.class, Long.parseLong(taskId));
    return task.getVariableKeys();
  }
View Full Code Here

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

    this.taskDbid = Long.parseLong(taskId);
    this.deleteHistory = deleteHistory;
  }

  public Void execute(Environment environment) throws Exception {
    DbSession dbSession = environment.get(DbSession.class);
    TaskImpl task = (TaskImpl) dbSession.get(TaskImpl.class, taskDbid);
    if (task!=null) {
      task.delete(reason);
      dbSession.delete(task);
      if (deleteHistory) {
        HistoryTaskImpl historyTask = (HistoryTaskImpl) dbSession.get(HistoryTaskImpl.class, taskDbid);
        if (historyTask!=null) {
          dbSession.delete(historyTask);
        }
      }
    } else {
      throw new JbpmException("task "+taskDbid+" doesn't exist");
    }
View Full Code Here

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

    this.processInstanceId = processInstanceId;
    this.cascade = cascade;
  }

  public Void execute(Environment environment) throws Exception {
    DbSession dbSession = Environment.getFromCurrent(DbSession.class);
    dbSession.deleteProcessInstance(processInstanceId, cascade);
    return null;
  }
View Full Code Here

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

    this.task = task;
    this.assignee = assignee;
  }

  public void process() {
    DbSession dbSession = Environment.getFromCurrent(DbSession.class);
    HistoryTaskImpl historyTaskInstance = (HistoryTaskImpl)
        dbSession.get(HistoryTaskImpl.class, task.getDbid());
    historyTaskInstance.setAssignee(assignee);
  }
View Full Code Here

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

    this.taskDbid = Long.parseLong(taskId);
    this.message = message;
  }

  public HistoryComment execute(Environment environment) throws Exception {
    DbSession dbSession = environment.get(DbSession.class);
    HistoryTaskImpl historyTask = dbSession.get(HistoryTaskImpl.class, taskDbid);
    if (historyTask==null) {
      throw new JbpmException("task "+taskDbid+" doesn't exist");
    }
    HistoryCommentImpl comment = new HistoryCommentImpl(message);
    historyTask.addDetail(comment);
    dbSession.save(comment);
    return comment;
  }
View Full Code Here

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

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

    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

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

  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

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

  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

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

  }

  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
TOP
Copyright © 2018 www.massapi.com. 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.