Examples of DBQuery


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

   * @see org.olat.group.context.BGContextManager#countGroupsOfType(java.lang.String)
   */
  public int countGroupsOfType(String groupType) {
    DB db = DBFactory.getInstance();
    String q = "select count(bg) from org.olat.group.BusinessGroupImpl bg where bg.type = :type";
    DBQuery query = db.createQuery(q);
    query.setString("type", groupType);
    return ((Long) query.list().get(0)).intValue();
  }
View Full Code Here

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

   *      org.olat.group.context.BGContext)
   */
  public BusinessGroup findGroupOfBGContext(String groupName, BGContext bgContext) {
    DB db = DBFactory.getInstance();
    String q = "select bg from org.olat.group.BusinessGroupImpl bg where bg.groupContext = :context and bg.name = :name";
    DBQuery query = db.createQuery(q);
    query.setEntity("context", bgContext);
    query.setString("name", groupName);
    List results = query.list();
    if (results.size() == 0) return null;
    return (BusinessGroup) results.get(0);
  }
View Full Code Here

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

  public BusinessGroup findGroupAttendedBy(Identity identity, String groupName, BGContext bgContext) {
    String query = "select bgi from " + "  org.olat.group.BusinessGroupImpl as bgi "
        + ", org.olat.basesecurity.SecurityGroupMembershipImpl as sgmi" + " where bgi.name = :name "
        + " and bgi.partipiciantGroup =  sgmi.securityGroup" + " and sgmi.identity = :identId" + " and bgi.groupContext = :context";
    DB db = DBFactory.getInstance();
    DBQuery dbq = db.createQuery(query);
    dbq.setEntity("identId", identity);
    dbq.setString("name", groupName);
    dbq.setEntity("context", bgContext);
    List res = dbq.list();
    if (res.size() == 0) return null;
    else if (res.size() > 1) throw new AssertException("more than one result row found for (identity, groupname, context) ("
        + identity.getName() + ", " + groupName + ", " + bgContext.getName());
    return (BusinessGroup) res.get(0);
  }
View Full Code Here

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

  public List getBGOwnersOfBGContext(BGContext bgContext) {
    DB db = DBFactory.getInstance();
    String q = "select distinct id from org.olat.basesecurity.IdentityImpl as id inner join fetch id.user as iuser"
        + ", org.olat.basesecurity.SecurityGroupMembershipImpl sgm" + ", org.olat.group.BusinessGroupImpl bg"
        + " where bg.groupContext = :context" + " and bg.ownerGroup = sgm.securityGroup" + " and sgm.identity = id";
    DBQuery query = db.createQuery(q);
    query.setEntity("context", bgContext);
    return query.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.