Package org.jbpm.pvm.internal.session

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


    }
    this.taskId = taskId;
  }

  public Set<String> 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+" doesn't exist");
    }
   
    Set<String> outcomes = new HashSet<String>();
View Full Code Here


  public GetTaskCommentsCmd(String taskId) {
    this.taskId = taskId;
  }

  public List<HistoryComment> execute(Environment environment) throws Exception {
    DbSession dbSession = environment.get(DbSession.class);

    List<HistoryComment> comments = dbSession.findCommentsByTaskId(taskId);
    forceInitializationAndClean(comments);
    return comments;
  }
View Full Code Here

    this.jobDbid = jobDbid;
  }

  public Job execute(Environment environmentInterface) throws Exception {
    EnvironmentImpl environment = (EnvironmentImpl) environmentInterface;
    DbSession dbSession = environment.get(DbSession.class);
    if (dbSession==null) {
      throw new JbpmException("no db-session configured");
    }
    JobImpl<?> job = (JobImpl<?>) dbSession.get(JobImpl.class, jobDbid);

    // in case of decision jobs, the job might have been deleted
    // before we execute it (they are in a list)
    if (job != null) {
        JobContext jobContext = new JobContext(job);
View Full Code Here

  }

  public ProcessInstance execute(Environment environment) throws Exception {
    ClientExecution execution = null;
   
    DbSession dbSession = environment.get(DbSession.class);
    execution = dbSession.findExecutionById(executionId);
    if (execution==null) {
      throw new JbpmException("execution "+executionId+" does not exist");
    }
   
    execution.signal(signalName, parameters);
View Full Code Here

    this.commentId = commentId;
    this.message = message;
  }

  public HistoryComment execute(Environment environment) throws Exception {
    DbSession dbSession = environment.get(DbSession.class);
    HistoryCommentImpl parentComment = dbSession.get(HistoryCommentImpl.class, Long.parseLong(commentId));
    if (parentComment==null) {
      throw new JbpmException("parent comment doesn't exist: "+commentId);
    }
    HistoryComment replyComment = parentComment.createReply(message);
    return replyComment;
View Full Code Here

    }
    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

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

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

    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

  public SaveTaskCmd(TaskImpl task) {
    this.task = task;
  }

  public String execute(Environment environment) throws Exception {
    DbSession dbSession = environment.get(DbSession.class);

    if (task.isNew()) {
      if (task.getSuperTaskDbid()!=null) {
        TaskImpl parentTask = (TaskImpl) dbSession.get(TaskImpl.class, task.getSuperTaskDbid());
        parentTask.addSubTask(task);
        task.setSuperTaskDbid(null);
      }
     
      dbSession.save(task);
     
      HistoryEvent.fire(new TaskCreated(task));

    } else {
      dbSession.update(task);

      HistoryEvent.fire(new TaskUpdated(task));
    }

    return task.getId();
View Full Code Here

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

  public void process() {
    DbSession dbSession = EnvironmentImpl.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

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.