Package org.jbpm.pvm.internal.session

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


    boolean deleteThisJob = true;
    // if there is no repeat on this timer
    if (repeat==null) {
      // delete the job
      if (log.isDebugEnabled()) log.debug("deleting " + this);
      DbSession dbSession = environment.get(DbSession.class);
      if (dbSession==null) {
        throw new JbpmException("no "+DbSession.class.getName()+" in environment");
      }
      dbSession.delete(this);

    } else { // there is a repeat on this timer
      deleteThisJob = false;
      // suppose that it took the timer runner thread a very long time to execute the timers
      // then the repeat action duedate could already have passed
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 Map<String, Object> execute(Environment environment) throws Exception {
    Map<String, Object> variables = new HashMap<String, Object>();

    DbSession dbSession = environment.get(DbSession.class);
    TaskImpl task = dbSession.get(TaskImpl.class, Long.parseLong(taskId));
    for (String variableName : variableNames) {
      Object value = task.getVariable(variableName);
      variables.put(variableName, value);
    }
View Full Code Here

    }
    this.taskId = taskId;
  }

  public Task execute(Environment environment) throws Exception {
    DbSession dbSession = environment.get(DbSession.class);
    return dbSession.get(TaskImpl.class, Long.parseLong(taskId));
  }
View Full Code Here

    }
    this.commentId = commentId;
  }

  public Object execute(Environment environment) throws Exception {
    DbSession dbSession = environment.get(DbSession.class);
    HistoryDetailImpl comment = (HistoryDetailImpl) dbSession.get(HistoryDetailImpl.class, Long.parseLong(commentId));
    if (comment!=null) {
      dbSession.delete(comment);
     
    } else {
      throw new JbpmException("comment "+commentId+" doesn't exist");
    }
    return null;
View Full Code Here

    return lob.extractBytes();
  }

  public void setObject(Object value) {
    if (this.lob!=null) {
      DbSession dbSession = Environment.getFromCurrent(DbSession.class, false);
      if (dbSession!=null) {
        dbSession.delete(this.lob);
      }
    }
    this.lob = new Lob((byte[])value);
  }
View Full Code Here

  public void setVariables(Map<String, ?> variables) {
    this.variables = variables;
  }

  protected ClientExecution getExecution(Environment environment, String executionId) {
    DbSession dbSession = environment.get(DbSession.class);
    ClientExecution execution = dbSession.findExecutionById(executionId);
    if (execution == null) {
      throw new JbpmException("execution " + executionId + " doesn't exist");
    }
    return execution;
  }
View Full Code Here

    }
    return (Set) subTasks;
  }

  public TaskImpl createSubTask() {
    DbSession dbSession = Environment.getFromCurrent(DbSession.class);
    TaskImpl subTask = (TaskImpl) dbSession.createTask();
    if (subTasks == null) {
      subTasks = new HashSet<TaskImpl>();
    }
    addSubTask(subTask);
    return subTask;
View Full Code Here

    this.taskId = taskId;
    this.outcome = outcome;
  }

  public Void execute(Environment environment) throws Exception {
    DbSession dbSession = environment.get(DbSession.class);
    TaskImpl task = dbSession.get(TaskImpl.class, Long.parseLong(taskId));
    if (outcome==null) {
      task.complete();
    } else {
      task.complete(outcome);
    }
    dbSession.delete(task);
    return null;
  }
View Full Code Here

    this.deleteProcessInstances = deleteProcessInstances;
    this.deleteHistory = deleteHistory;
  }

  public Void execute(Environment environment) {
    DbSession dbSession = Environment.getFromCurrent(DbSession.class);
    if (dbSession==null) {
      throw new JbpmException("no "+DbSessionBinding.TAG+" configured");
    }
    dbSession.deleteProcessDefinition(processDefinitionId, deleteProcessInstances, deleteHistory);
    return null;
  }
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.