Package org.olat.core.commons.persistence

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


  }

 
  public List<SecurityGroup> getSecurityGroupsForIdentity(Identity identity) {
    DB db = DBFactory.getInstance();
    List<SecurityGroup> secGroups = db.find(
        "select sgi from"
        + " org.olat.basesecurity.SecurityGroupImpl as sgi,"
        + " org.olat.basesecurity.SecurityGroupMembershipImpl as sgmsi "
        + " where sgmsi.securityGroup = sgi and sgmsi.identity = ?",
        new Object[] { identity.getKey() },
View Full Code Here


  public TemporaryKeyImpl createTemporaryKeyByEmail(String email, String ip, String action) {
    TemporaryKeyImpl tk = null;
    DB db = DBFactory.getInstance();
    // check if the user is already registered
    // we also try to find it in the temporarykey list
    List tks = db.find("from org.olat.registration.TemporaryKeyImpl as r where r.emailAddress = ?", email,
        Hibernate.STRING);
    if ((tks == null) || (tks.size() != 1)) { // no user found, create a new one
      tk = register(email, ip, action);
    } else {
      tk = (TemporaryKeyImpl) tks.get(0);
View Full Code Here

   *
   * @return the found temporary key or null if none is found
   */
  public TemporaryKeyImpl loadTemporaryKeyByEmail(String email) {
    DB db = DBFactory.getInstance();
    List tks = db.find("from r in class org.olat.registration.TemporaryKeyImpl where r.emailAddress = ?", email,
        Hibernate.STRING);
    if (tks.size() == 1) {
      return (TemporaryKeyImpl) tks.get(0);
    } else {
      return null;
View Full Code Here

   *
   * @return the found temporary key or null if none is found
   */
  public List<TemporaryKey> loadTemporaryKeyByAction(String action) {
    DB db = DBFactory.getInstance();
    List<TemporaryKey> tks = db.find("from r in class org.olat.registration.TemporaryKeyImpl where r.regAction = ?", action, Hibernate.STRING);
    if (tks.size() > 0) {
      return tks;
    } else {
      return null;
    }
View Full Code Here

   *
   * @return the found TemporaryKey or null if none is found
   */
  public TemporaryKeyImpl loadTemporaryKeyByRegistrationKey(String regkey) {
    DB db = DBFactory.getInstance();
    List tks = db.find("from r in class org.olat.registration.TemporaryKeyImpl where r.registrationKey = ?", regkey,
        Hibernate.STRING);
    if (tks.size() == 1) {
      return (TemporaryKeyImpl) tks.get(0);
    } else {
      return null;
View Full Code Here

    slct.append("org.olat.core.id.Identity identity, ");
    slct.append("org.olat.user.UserImpl usr ");
    slct.append("where ");
    slct.append("identity.user = usr.key ");
    slct.append("order by usr.properties['firstName'] desc");
    List results = db.find(slct.toString());
    assertTrue(results.size() == 3);
    Identity found = (Identity) results.get(0);
    assertTrue(found.getKey().equals(i3.getKey()));
  }
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.