Package org.olat.core.commons.persistence

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


    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


    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

    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();
  }

  /**
   * @see org.olat.group.context.BGContextManager#countBGOwnersOfBGContext(org.olat.group.context.BGContext)
   */
 
View Full Code Here

    String q = "select count(distinct id) from org.olat.basesecurity.IdentityImpl id"
        + ", 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);
    List resultList = query.list();

    int result = 0;
    // if no join/group by matches, result list size is 0 and count undefined ->
    // result is 0
    if (resultList.size() > 0) {
View Full Code Here

    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.partipiciantGroup = sgm.securityGroup" + " and sgm.identity = id";
    DBQuery query = db.createQuery(q);
    query.setEntity("context", bgContext);
    return query.list();
  }

  /**
   * @see org.olat.group.context.BGContextManager#countBGParticipantsOfBGContext(org.olat.group.context.BGContext)
   */
 
View Full Code Here

    String q = "select count(distinct id) from org.olat.basesecurity.IdentityImpl id"
        + ", org.olat.basesecurity.SecurityGroupMembershipImpl sgm" + ", org.olat.group.BusinessGroupImpl bg"
        + " where bg.groupContext = :context" + " and bg.partipiciantGroup = sgm.securityGroup" + " and sgm.identity = id";
    DBQuery query = db.createQuery(q);
    query.setEntity("context", bgContext);
    List resultList = query.list();
    int result = 0;
    // if no join/group by matches, result list size is 0 and count undefined ->
    // result is 0
    if (resultList.size() > 0) {
      Object obj = resultList.get(0);
View Full Code Here

    DBQuery query = db.createQuery(q.toString());
    query.setEntity("id", identity);
    query.setEntity("context", bgContext);
    query.setCacheable(true);
    List result = query.list();

    if (result.size() == 0) return false;
    return (((Long) result.get(0)).intValue() > 0);
  }
View Full Code Here

    query.setEntity("resource", resource);
    if (groupType != null) query.setString("gtype", groupType);
    if (checkDefault){
      query.setBoolean("isDefault", defaultContexts ? true : false);
    }
    return query.list();
  }

  /**
   * @see org.olat.group.context.BGContextManager#findBGContextsForIdentity(org.olat.core.id.Identity,
   *      boolean, boolean)
View Full Code Here

    query.setEntity("identity", identity);
    if (checkDefault){
      query.setBoolean("isDefault", defaultContexts ? true : false);
    }
   
    return query.list();
  }

  /**
   * @see org.olat.group.context.BGContextManager#findOLATResourcesForBGContext(org.olat.group.context.BGContext)
   */
 
View Full Code Here

  public List findOLATResourcesForBGContext(BGContext bgContext) {
    DB db = DBFactory.getInstance();
    String q = " select bgcr.resource from org.olat.group.context.BGContext2Resource as bgcr where bgcr.groupContext = :context";
    DBQuery query = db.createQuery(q);
    query.setEntity("context", bgContext);
    return query.list();
  }

  /**
   * @see org.olat.group.context.BGContextManager#findRepositoryEntriesForBGContext(org.olat.group.context.BGContext)
   */
 
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.