Examples of DbSession


Examples of jodd.db.DbSession

   * Creates new database session using DB session provider.
   * Usually, this method does not belong in AppCore, but in some
   * DbCore, as it is used for low level database access.
   */
  public DbSession createDbSession() {
    return new DbSession(connectionProvider);
  }
View Full Code Here

Examples of jodd.db.DbSession

   * Returns <code>true</code> if database exist. This method does not use
   * thread provided db session, but common db session.
   */
  public boolean checkDb() {
    log.debug("Check database.");
    DbSession dbSession = AppCore.ref.createDbSession();
    DbQuery query = new DbQuery(dbSession, "select count(1) from up_user_level");
    try {
      query.execute();
      log.debug("Database OK.");
        return true;
    } catch (Exception ignored) {
      return false;
    } finally {
      query.close();
      dbSession.closeSession();
    }
  }
View Full Code Here

Examples of jodd.db.DbSession

      StreamUtil.close(in);
    }

    String[] queries = StringUtil.splitc(sql, ";");

    DbSession dbSession = AppCore.ref.createDbSession();
    for (int i = 0; i < queries.length; i++) {
      String q = queries[i];
      q = cleanSql(q);
      if (q.isEmpty()) {
        continue;
      }
      DbQuery query = new DbQuery(dbSession, q);
      query.executeUpdate();
      log.debug("executed query #" + (i + 1));
    }
    dbSession.closeSession();
  }
View Full Code Here

Examples of org.jbpm.env.session.DbSession

      }
      commandService.execute(this);
    }
    public Object execute(Environment environment) {
      // reload the execution
      DbSession dbSession = environment.get(DbSession.class);
      if (dbSession==null) {
        throw new PvmException("no "+DbSession.class.getName()+" available in the environment for reloading the execution");
      }
      execution = dbSession.get(ExecutionImpl.class, execution.getDbid());
      executeHandler(execution, exception);
      return null;
    }
View Full Code Here

Examples of org.jbpm.env.session.DbSession

* @author Tom Baeyens
*/
public abstract class AbstractCommand implements Command {
 
  protected Execution getExecution(Environment environment, long executionId) {
    DbSession dbSession = environment.get(DbSession.class);
    Execution execution = dbSession.get(ExecutionImpl.class, executionId);
    if (execution==null) {
      throw new CommandException("execution "+executionId+" doesn't exist");
    }
    return execution;
  }
View Full Code Here

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

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

  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

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

  }

  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

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

    }
    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

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

    }
    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
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.