Package org.olat.core.commons.persistence

Examples of org.olat.core.commons.persistence.DBQuery


    query.append(" and ( p.name = '").append(AssessmentManager.SCORE);
    query.append("' or p.name = '").append(AssessmentManager.PASSED);
    query.append("' )");

    DB db = DBFactory.getInstance();
    DBQuery dbq = db.createQuery(query.toString());
    ICourse course = CourseFactory.loadCourse(ores);
    dbq.setLong("resid", course.getResourceableId().longValue());
    dbq.setString("resname", course.getResourceableTypeName());

    List res = dbq.list();
    return res;
  }
View Full Code Here


      else if (roles.isGuestOnly()) query.append(RepositoryEntry.ACC_USERS_GUESTS);
      else query.append(RepositoryEntry.ACC_USERS);
      isFirstOfWhereClause = false;
    }
   
    DBQuery dbQuery = DBFactory.getInstance().createQuery(query.toString());
    if (var_author) {
      dbQuery.setString("author", author);
    }
    if (var_displayname) {
      dbQuery.setString("displayname", displayName);
    }
    if (var_desc) {
      dbQuery.setString("desc", desc);
    }
    if (var_resourcetypes) {
      dbQuery.setParameterList("resourcetypes", resourceTypes, Hibernate.STRING);
    }
    return dbQuery.list();
  }
View Full Code Here

     
      if (!isFirstOfWhereClause) query.append(" and ");
      query.append("v.access = 1 and user.properties['institutionalName']= :institution ");
      isFirstOfWhereClause = false;
     
      DBQuery dbQuery = DBFactory.getInstance().createQuery(query.toString());
      dbQuery.setString("institution", institution);
      if (var_author) {
        dbQuery.setString("author", author);
      }
      if (var_displayname) {
        dbQuery.setString("displayname", displayName);
      }
      if (var_desc) {
        dbQuery.setString("desc", desc);
      }
      if (var_resourcetypes) {
        dbQuery.setParameterList("resourcetypes", resourceTypes, Hibernate.STRING);
      }
      List result = dbQuery.list();
      result.addAll(runGenericANDQueryWithRolesRestriction(displayName, author, desc, resourceTypes, roles));
      return result;
    } else {
      return runGenericANDQueryWithRolesRestriction(displayName, author, desc, resourceTypes, roles);
    }
View Full Code Here

*/
public class HomeOrgStatisticManager implements IStatisticManager {

  @Override
  public StatisticResult generateStatisticResult(UserRequest ureq, ICourse course, long courseRepositoryEntryKey) {
    DBQuery dbQuery = DBFactory.getInstance().createQuery("select businessPath,homeOrg,value from org.olat.course.statistic.homeorg.HomeOrgStat sv "
        + "where sv.resId=:resId");
    dbQuery.setLong("resId", courseRepositoryEntryKey);

    return new StatisticResult(course, dbQuery.list());
  }
View Full Code Here

   **/
  private final SimpleDateFormat columnHeaderFormat_ = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");

  @Override
  public StatisticResult generateStatisticResult(UserRequest ureq, ICourse course, long courseRepositoryEntryKey) {
    DBQuery dbQuery = DBFactory.getInstance().createQuery("select businessPath,day,value from org.olat.course.statistic.daily.DailyStat sv "
        + "where sv.resId=:resId");
    dbQuery.setLong("resId", courseRepositoryEntryKey);

    return new StatisticResult(course, dbQuery.list());
  }
View Full Code Here

      dateClause.append(" and (day>=:fromDate) ");
    }
    if (toDate!=null) {
      dateClause.append(" and (day<=:toDate) ");
    }
    DBQuery dbQuery = DBFactory.getInstance().createQuery("select businessPath,day,value from org.olat.course.statistic.daily.DailyStat sv "
        + "where sv.resId=:resId "
        + dateClause);
    dbQuery.setLong("resId", courseRepositoryEntryKey);
    if (fromDate!=null) {
      dbQuery.setDate("fromDate", fromDate);
    }
    if (toDate!=null) {
      dbQuery.setDate("toDate", toDate);
    }
   
    StatisticResult statisticResult = new StatisticResult(course, dbQuery.list());
    fillGapsInColumnHeaders(statisticResult);
    return statisticResult;
  }
View Full Code Here

*/
public class StudyBranch3StatisticManager implements IStatisticManager {

  @Override
  public StatisticResult generateStatisticResult(UserRequest ureq, ICourse course, long courseRepositoryEntryKey) {
    DBQuery dbQuery = DBFactory.getInstance().createQuery("select businessPath,studyBranch3,value from org.olat.course.statistic.studybranch3.StudyBranch3Stat sv "
        + "where sv.resId=:resId");
    dbQuery.setLong("resId", courseRepositoryEntryKey);

    return new StatisticResult(course, dbQuery.list());
  }
View Full Code Here

  /** the logging object used in this class **/
  private static final OLog log_ = Tracing.createLoggerFor(HourOfDayStatisticManager.class);

  @Override
  public StatisticResult generateStatisticResult(UserRequest ureq, ICourse course, long courseRepositoryEntryKey) {
    DBQuery dbQuery = DBFactory.getInstance().createQuery("select businessPath,hour,value from org.olat.course.statistic.hourofday.HourOfDayStat sv "
        + "where sv.resId=:resId");
    dbQuery.setLong("resId", courseRepositoryEntryKey);

    StatisticResult statisticResult = new StatisticResult(course, dbQuery.list());
    List<String> columnHeaders = statisticResult.getColumnHeaders();
    if (columnHeaders!=null && columnHeaders.size()>1) {
      try{
        int start = Integer.parseInt(columnHeaders.get(0));
        int end = Integer.parseInt(columnHeaders.get(columnHeaders.size()-1));
View Full Code Here

  public List<Message> getNewMessageInfo(Long forumKey, Date latestRead) {
    // FIXME:fj: lastModified has no index -> test performance with forum with
    // 200 messages
    String query = "select msg from org.olat.modules.fo.MessageImpl as msg" +
      " where msg.forum.key = :forumKey and msg.lastModified > :latestRead order by msg.lastModified desc";
    DBQuery dbquery = DBFactory.getInstance().createQuery(query);
    dbquery.setLong("forumKey", forumKey.longValue());
    dbquery.setTimestamp("latestRead", latestRead);
    dbquery.setCacheable(true);
    return dbquery.list();
  }
View Full Code Here

    boolean children = false;
    DB db = DBFactory.getInstance();
    Long message_id = m.getKey();
    String q = " select count(msg) from org.olat.modules.fo.MessageImpl msg where msg.parent = :input ";

    DBQuery query = db.createQuery(q);
    query.setLong("input", message_id.longValue());
    List result = query.list();
    int count = ((Long) result.get(0)).intValue();

    if (count > 0) {
      children = true;
    }
View Full Code Here

TOP

Related Classes of org.olat.core.commons.persistence.DBQuery

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.