Package org.olat.core.commons.persistence

Examples of org.olat.core.commons.persistence.DB.createQuery()


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

  /**
 
View Full Code Here


    if (groupContext != null) {
      q.append(" grp.groupContext = :context and");
    }
    q.append(" grp.name = :name").append(" and ((grp.partipiciantGroup = secgmemb.securityGroup").append(" and secgmemb.identity = :id) ")
        .append(" or (grp.ownerGroup = secgmemb.securityGroup").append(" and secgmemb.identity = :id)) ");
    DBQuery query = db.createQuery(q.toString());
    query.setEntity("id", identity);
    if (groupContext != null) {
      query.setEntity("context", groupContext);
    }
    query.setString("name", groupName);
View Full Code Here

  public int countBGParticipantsOfBGContext(BGContext bgContext) {
    DB db = DBFactory.getInstance();
    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
View Full Code Here

      q.append(ownRestr);
    } else {
      throw new AssertException("illegal arguments: at leas one of asOwner or asParticipant must be true");
    }

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

    boolean checkDefault = defaultContexts != nonDefaultContexts;
    if (checkDefault){
      q.append(" and context.defaultContext = :isDefault");
    }
    DBQuery query = db.createQuery(q.toString());
    query.setEntity("resource", resource);
    if (groupType != null) query.setString("gtype", groupType);
    if (checkDefault){
      query.setBoolean("isDefault", defaultContexts ? true : false);
    }
View Full Code Here

    boolean checkDefault = defaultContexts != nonDefaultContexts;
    if (checkDefault){
      q.append(" and context.defaultContext = :isDefault");
    }
    DBQuery query = db.createQuery(q.toString());
    query.setEntity("identity", identity);
    if (checkDefault){
      query.setBoolean("isDefault", defaultContexts ? true : false);
    }
   
View Full Code Here

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

  /**
 
View Full Code Here

      log.audit("+---------------------------------------------------------------+");

      DB db = DBFactory.getInstance();
      StringBuilder q = new StringBuilder();
      q.append(" select repoEntry from org.olat.repository.RepositoryEntry as repoEntry");
      DBQuery query = db.createQuery(q.toString());
      List<RepositoryEntry> entries = (List<RepositoryEntry>) query.list();
      RepositoryManager repoManager = RepositoryManager.getInstance();
      if (log.isDebug()) log.info("Migrating " + entries.size() + " Repository Entires.");
      int counter = 0;
      for (RepositoryEntry entry : entries) {
View Full Code Here

      log.audit("+---------------------------------------------------------------+");

      DB db = DBFactory.getInstance();
      StringBuilder q = new StringBuilder();
      q.append(" select context from org.olat.group.context.BGContextImpl as context");
      DBQuery query = db.createQuery(q.toString());

      List<BGContext> contexts = (List<BGContext>) query.list();
      if (log.isDebug()) log.info("Migrating " + contexts.size() + " BG Contexts.");
      BGContextManager contextManager = BGContextManagerImpl.getInstance();
      int bgcounter = 0;
View Full Code Here

      log.audit("+...     " + TASK_MIGRATE_WIKICODE_BGAREA + "     ...+");
      log.audit("+---------------------------------------------------------------+");

      DB db = DBFactory.getInstance();
      String q = "select area from org.olat.group.area.BGAreaImpl area ";
      DBQuery query = db.createQuery(q);
      List<BGArea> areas = query.list();
      if (log.isDebug()) log.info("Migrating " + areas.size() + " BG areas.");
      BGAreaManager bgM = BGAreaManagerImpl.getInstance();
      int bgcounter = 0;
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.