Examples of DBQuery


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

    Tracing.logDebug("lastLoginLimit=" + lastLoginLimit, this.getClass());
    // 1. get all 'active' identities with lastlogin > x
    String queryStr ="from org.olat.core.id.Identity as ident where ident.status = '"
      + Identity.STATUS_ACTIV
      + "' and (ident.lastLogin = null or ident.lastLogin < :lastLogin)"
    DBQuery dbq = DBFactory.getInstance().createQuery(queryStr);
    dbq.setDate("lastLogin", lastLoginLimit.getTime());
    List identities = dbq.list();
    // 2. get all 'active' identities in deletion process
    queryStr = "select ident from org.olat.core.id.Identity as ident"
      + " , org.olat.commons.lifecycle.LifeCycleEntry as le"
      + " where ident.key = le.persistentRef "
      + " and le.persistentTypeName ='" + IdentityImpl.class.getName() + "'"
      + " and le.action ='" + SEND_DELETE_EMAIL_ACTION + "' ";
    dbq = DBFactory.getInstance().createQuery(queryStr);
    List identitiesInProcess = dbq.list();
    // 3. Remove all identities in deletion-process from all inactive-identities
    identities.removeAll(identitiesInProcess);
    return identities;    
  }
View Full Code Here

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

      + " , org.olat.commons.lifecycle.LifeCycleEntry as le"
      + " where ident.key = le.persistentRef "
      + " and ident.status = '"  + Identity.STATUS_ACTIV + "'"
      + " and le.persistentTypeName ='" + IdentityImpl.class.getName() + "'"
      + " and le.action ='" + SEND_DELETE_EMAIL_ACTION + "' and le.lcTimestamp >= :deleteEmailDate ";
    DBQuery dbq = DBFactory.getInstance().createQuery(queryStr);
    dbq.setDate("deleteEmailDate", deleteEmailLimit.getTime());
    return dbq.list();
  }
View Full Code Here

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

      + " , org.olat.commons.lifecycle.LifeCycleEntry as le"
      + " where ident.key = le.persistentRef "
      + " and ident.status = '"  + Identity.STATUS_ACTIV + "'"
      + " and le.persistentTypeName ='" + IdentityImpl.class.getName() + "'"
      + " and le.action ='" + SEND_DELETE_EMAIL_ACTION + "' and le.lcTimestamp < :deleteEmailDate ";
    DBQuery dbq = DBFactory.getInstance().createQuery(queryStr);
    dbq.setDate("deleteEmailDate", deleteEmailLimit.getTime());
    return dbq.list();
  }
View Full Code Here

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

        + " org.olat.group.BusinessGroupImpl as bgi" + " where bgi.ownerGroup = sgmi.securityGroup and sgmi.identity = :identId";
    if (bgContext != null) query = query + " and bgi.groupContext = :context";
    if (type != null) query = query + " and bgi.type = :type";

    DB db = DBFactory.getInstance();
    DBQuery dbq = db.createQuery(query);
    /*
     * query.append("select distinct v from" + "
     * org.olat.basesecurity.SecurityGroupMembershipImpl as sgmsi," + "
     * org.olat.repository.RepositoryEntry v" + " inner join fetch v.ownerGroup
     * as secGroup" + " inner join fetch v.olatResource as res where" + "
     * sgmsi.securityGroup = secGroup and sgmsi.identity.key=");
     */

    dbq.setLong("identId", identityP.getKey().longValue());
    if (bgContext != null) dbq.setEntity("context", bgContext);
    if (type != null) dbq.setString("type", type);

    List res = dbq.list();
    return res;
  }
View Full Code Here

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

    query = query + " and sgmi.identity = :identId";
    if (bgContext != null) query = query + " and bgi.groupContext = :context";
    if (type != null) query = query + " and bgi.type = :type";

    DB db = DBFactory.getInstance();
    DBQuery dbq = db.createQuery(query);
    dbq.setLong("identId", identityP.getKey().longValue());
    if (bgContext != null) dbq.setEntity("context", bgContext);
    if (type != null) dbq.setString("type", type);

    List res = dbq.list();
    return res;
  }
View Full Code Here

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

  /**
   *
   * @see org.olat.group.BusinessGroupManager#getAllBusinessGroups()
   */
  public List getAllBusinessGroups() {
    DBQuery dbq = DBFactory.getInstance().createQuery("select bgi from " + "  org.olat.group.BusinessGroupImpl as bgi ");
    return dbq.list();
  }
View Full Code Here

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

  /**
   * @see org.olat.group.context.BGContextManager#getGroupsOfBGContext(org.olat.group.context.BGContext)
   */
  public List<BusinessGroup> getGroupsOfBGContext(BGContext bgContext) {
    DB db = DBFactory.getInstance();
    DBQuery query;
    if (bgContext == null) {
      String q = "select bg from org.olat.group.BusinessGroupImpl bg where bg.groupContext is null";
      query = db.createQuery(q);
    } else {
      String q = "select bg from org.olat.group.BusinessGroupImpl bg where bg.groupContext = :context";
      query = db.createQuery(q);
      query.setEntity("context", bgContext);
    }
    return (List<BusinessGroup>) query.list();
  }
View Full Code Here

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

        + " where bgi.waitingGroup = sgmi.securityGroup and sgmi.identity = :identId";
    if (bgContext != null) query = query + " and bgi.groupContext = :context";
    if (type != null) query = query + " and bgi.type = :type";

    DB db = DBFactory.getInstance();
    DBQuery dbq = db.createQuery(query);
    dbq.setLong("identId", identityP.getKey().longValue());
    if (bgContext != null) dbq.setEntity("context", bgContext);
    if (type != null) dbq.setString("type", type);

    List res = dbq.list();
    return res;
  }
View Full Code Here

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

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

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

    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);
    query.setCacheable(true);
    List result = query.list();
    if (result.size() == 0) return false;
    return ( ((Long) result.get(0)).intValue() > 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.