Package org.olat.core.commons.persistence

Examples of org.olat.core.commons.persistence.DBQuery.list()


   
    DB db = DBFactory.getInstance();
    DBQuery dbq = db.createQuery(query);
    dbq.setLong("identId", identity.getKey().longValue());
    dbq.setLong("secGroup", secGroup.getKey());
    List result = dbq.list();
    if (result.size()==0){
      return null;
    }
    else {
      return (Date)result.get(0);
View Full Code Here


  public int countIdentitiesOfSecurityGroup(SecurityGroup secGroup) {
    DB db = DBFactory.getInstance();
    String q = "select count(sgm) from org.olat.basesecurity.SecurityGroupMembershipImpl sgm where sgm.securityGroup = :group";
    DBQuery query = db.createQuery(q);
    query.setEntity("group", secGroup);
    int result = ((Long) query.list().get(0)).intValue();
    return result;
  }

  /**
   * @see org.olat.basesecurity.Manager#createAndPersistNamedSecurityGroup(java.lang.String)
View Full Code Here

  public Long countUniqueUserLoginsSince (Date lastLoginLimit){
    String queryStr ="Select count(ident) from org.olat.core.id.Identity as ident where "
      + "ident.lastLogin > :lastLoginLimit and ident.lastLogin != ident.creationDate"
    DBQuery dbq = DBFactory.getInstance().createQuery(queryStr);
    dbq.setDate("lastLoginLimit", lastLoginLimit);
    List res = dbq.list();
    Long cntL = (Long) res.get(0);
    return cntL;
 
 
  /**
 
View Full Code Here

    if (status != null) {
      dbq.setInteger("status", status);
    }

    // execute query
    return dbq.list();
  }

  /**
   * @see org.olat.basesecurity.Manager#isIdentityVisible(java.lang.String)
   */
 
View Full Code Here

    if (identityName == null) throw new AssertException("findIdentitybyName: name was null");
    String queryString = "select count(ident) from org.olat.basesecurity.IdentityImpl as ident where ident.name = :identityName and ident.status < :status";
    DBQuery dbq = DBFactory.getInstance().createQuery(queryString);
    dbq.setString("identityName", identityName);
    dbq.setInteger("status", Identity.STATUS_VISIBLE_LIMIT);
    List res = dbq.list();
    Long cntL = (Long) res.get(0);
    return (cntL.longValue() > 0);
  }

  private boolean checkAnd(StringBuilder sb, boolean needsAnd) {
View Full Code Here

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

    StatisticResult result = new StatisticResult(course, dbQuery.list());
   
    // now sort by user's preferred firstDayOfWeek
    Calendar c = Calendar.getInstance(ureq.getLocale());
    int firstDayOfWeek = c.getFirstDayOfWeek();
   
View Full Code Here

    DBQuery query = db.createQuery(q);
    query.setEntity("anIdentity", identity);
    query.setString("resName", subscriptionContext.getResName());
    query.setLong("resId", subscriptionContext.getResId().longValue());
    query.setString("subidentifier", subscriptionContext.getSubidentifier());
    List res = query.list();
    // must return one result or null
    if (res.isEmpty()) return false;
    long cnt = ( (Long)res.get(0) ).longValue();
    if (cnt == 0) return false;
    else if (cnt == 1) return true;
View Full Code Here

    DBQuery query = DBFactory.getInstance().createQuery(s);
    query.setString("resname", type);
    query.setLong("resid", resourceableId.longValue());
    query.setCacheable(true);
   
    List resources = query.list();
    // if not found, it is an empty list
    if (resources.size() == 0) return null;
    return (OLATResource)resources.get(0);
  }
 
View Full Code Here

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

    return new StatisticResult(course, dbQuery.list());
  }
 
  @Override
  public ColumnDescriptor createColumnDescriptor(UserRequest ureq, int column, String headerId) {
    if (column==0) {
View Full Code Here

      + " where cei.parent = :parent order by cei.name ";
      DBQuery dbQuery = DBFactory.getInstance().createQuery(sqlQuery);
      dbQuery.setEntity("parent", ce);
      // cache this query
      dbQuery.setCacheable(true);
      return dbQuery.list();
  }


  /**
   * Returns a list catalog categories
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.