Package org.olat.core.commons.persistence

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


      " where ores.key = :oreskey";
    DBQuery dbQuery = DBFactory.getInstance().createQuery(query);
    dbQuery.setLong("oreskey", ores.getKey().longValue());
    dbQuery.setCacheable(true);
   
    List result = dbQuery.list();
    int size = result.size();
    if (strict) {
      if (size != 1)
        throw new AssertException("Repository resourceable lookup returned zero or more than one result: " + size);
    }
View Full Code Here


      " where v.softkey = :softkey";
   
    DBQuery dbQuery = DBFactory.getInstance().createQuery(query);
    dbQuery.setString("softkey", softkey);
    dbQuery.setCacheable(true);
    List result = dbQuery.list();
   
    int size = result.size();
    if (strict) {
      if (size != 1)
        throw new AssertException("Repository softkey lookup returned zero or more than one result: " + size+", softKey = "+softkey);
View Full Code Here

      " where ores.resId = :resid";
    DBQuery dbQuery = DBFactory.getInstance().createQuery(query);
    dbQuery.setLong("resid", resId.longValue());
    dbQuery.setCacheable(true);
   
    List<RepositoryEntry> result = dbQuery.list();
    int size = result.size();
    if (size > 1) throw new AssertException("Repository lookup returned zero or more than one result: " + size);
    else if (size == 0) return null;
    RepositoryEntry entry = result.get(0);
    return entry.getDisplayname();
View Full Code Here

      " where v.olatResource = res and res.resName= :restrictedType and v.access >= :restrictedAccess ");
    DBQuery dbquery = DBFactory.getInstance().createQuery(query.toString());
    dbquery.setString("restrictedType", restrictedType);
    dbquery.setInteger("restrictedAccess", restrictedAccess);
    dbquery.setCacheable(true);
    return ((Long)dbquery.list().get(0)).intValue();
  }

 
  /**
   * Query by type without any other limitations
View Full Code Here

      " inner join fetch v.olatResource as res"+
      " where res.resName= :restrictedType";
    DBQuery dbquery = DBFactory.getInstance().createQuery(query);
    dbquery.setString("restrictedType", restrictedType);
    dbquery.setCacheable(true);
    return dbquery.list();
  }

  /**
   * Query by type, limit by ownership or role accessability.
   * @param restrictedType
View Full Code Here

      else query.append(RepositoryEntry.ACC_USERS);
    }
    DBQuery dbquery = DBFactory.getInstance().createQuery(query.toString());
    dbquery.setString("restrictedType", restrictedType);
    dbquery.setCacheable(true);
    return dbquery.list();
  }
 
  /**
   * Query by type, limit by ownership or role accessability.
   * @param restrictedType
View Full Code Here

      DBQuery dbquery = DBFactory.getInstance().createQuery(query.toString());
      dbquery.setString("restrictedType", restrictedType);
      dbquery.setString("institutionCourseManager", institution);
      dbquery.setCacheable(true);
     
      List result = dbquery.list();
      result.addAll(queryByTypeLimitAccess(restrictedType, roles));
      return result;
     
    } else {
      return queryByTypeLimitAccess(restrictedType, roles);
View Full Code Here

      }
      query.append(" )");
    }
    DBQuery dbquery = DBFactory.getInstance().createQuery(query.toString());
    dbquery.setEntity("identity", identity);
    return dbquery.list();
  }

  /**
   * Query by initial-author
   * @param restrictedType
View Full Code Here

      " org.olat.repository.RepositoryEntry v" +
      " where v.initialAuthor= :initialAuthor";
    DBQuery dbquery = DBFactory.getInstance().createQuery(query);
    dbquery.setString("initialAuthor", initialAuthor);
    dbquery.setCacheable(true);
    return dbquery.list();
  }

  /**
   * Search for resources that can be referenced by an author. This is the case:
   * 1) the user is the owner of the resource
View Full Code Here

      dbquery.setString("desc", desc);
    }
    if (resourceTypes != null) {
      dbquery.setParameterList("resourcetypes", resourceTypes, Hibernate.STRING);
    }
    return dbquery.list();   
   
  }

 
  /**
 
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.