Package org.olat.core.commons.persistence

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


    query.setString("resname", getOLATResourceable()
        .getResourceableTypeName());
    query.setLong("resId", getOLATResourceable().getResourceableId());
    query.setCacheable(true);
    //
    List results = query.list();
    Double average = (Double) query.list().get(0);
    // When no ratings are found, a null value is returned!
    if (average == null) return Float.valueOf(0);
    else return average.floatValue();     
  }
View Full Code Here


        .getResourceableTypeName());
    query.setLong("resId", getOLATResourceable().getResourceableId());
    query.setCacheable(true);
    //
    List results = query.list();
    Double average = (Double) query.list().get(0);
    // When no ratings are found, a null value is returned!
    if (average == null) return Float.valueOf(0);
    else return average.floatValue();     
  }
View Full Code Here

    query.setString("resname", getOLATResourceable()
        .getResourceableTypeName());
    query.setLong("resId", getOLATResourceable().getResourceableId());
    query.setCacheable(true);
    //
    Long count = (Long) query.list().get(0);
    return count;
  }

  /**
   * @see org.olat.core.commons.services.commentAndRating.UserRatingsManager#createRating(org.olat.core.id.Identity, int)
View Full Code Here

        .getResourceableTypeName());
    query.setLong("resId", getOLATResourceable().getResourceableId());
    query.setEntity("creator", identity);
    query.setCacheable(true);
    //
    List<UserRating> results = query.list();
    if (results.size() == 0) return null;   
    return results.get(0);
  }
 
  /**
 
View Full Code Here

    query.setString("resname", getOLATResourceable()
        .getResourceableTypeName());
    query.setLong("resId", getOLATResourceable().getResourceableId());
    query.setCacheable(true);
    //
    Long count = (Long) query.list().get(0);
    return count;
  }

  /**
   * @see org.olat.core.commons.services.commentAndRating.UserCommentsManager#createComment(org.olat.core.id.Identity,
View Full Code Here

    query.setString("resname", getOLATResourceable()
        .getResourceableTypeName());
    query.setLong("resId", getOLATResourceable().getResourceableId());
    query.setCacheable(true);
    //
    List<UserComment> results = query.list();
    return results;
  }

  /**
   * @see org.olat.core.commons.services.commentAndRating.UserCommentsManager#updateComment(org.olat.core.commons.services.commentAndRating.model.UserComment)
View Full Code Here

    }
    DB db = DBFactory.getInstance();
    // First deal with all direct replies
    DBQuery query = db.createQuery("select comment from UserCommentImpl as comment where parent=:parent");
    query.setEntity("parent", comment);
    List<UserComment> replies = query.list();
    if (deleteReplies) {
      // Since we have a many-to-one we first have to recursively delete
      // the replies to prevent foreign key constraints
      for (UserComment reply : replies) {
        counter += deleteComment(reply, true);
View Full Code Here

  LockImpl findLock(String asset) {
    Tracing.logInfo("findLock: "+asset+" START", getClass());
    DBQuery q = DBFactory.getInstance().createQuery(
        "select alock from org.olat.commons.coordinate.cluster.lock.LockImpl as alock inner join fetch alock.owner where alock.asset = :asset");
    q.setParameter("asset", asset);
    List res = q.list();
    if (res.size() == 0) {
      Tracing.logInfo("findLock: null END", getClass());
      return null;
    } else {
      Tracing.logInfo("findLock: "+res.get(0)+" END", getClass());
View Full Code Here

  @SuppressWarnings("unchecked")
  List<LockImpl> getAllLocks() {
    Tracing.logInfo("getAllLocks START", getClass());
    DBQuery q = DBFactory.getInstance().createQuery(
        "select alock from org.olat.commons.coordinate.cluster.lock.LockImpl as alock inner join fetch alock.owner");
    List<LockImpl> res = q.list();
    Tracing.logInfo("getAllLocks END. res.length:"+ (res==null ? "null" : res.size()), getClass());
    return res;
  }

  /**
 
View Full Code Here

      cal.add(Calendar.DAY_OF_MONTH, 1);
      end = cal.getTime();
      dbQuery.setDate("createdBefore", end);
    }

    List queryResult = dbQuery.list();
    result.append(logLineConverter_.getCSVHeader());
    result.append(LINE_SEPARATOR);
   
    for (Object loggingObject : queryResult) {
      result.append(logLineConverter_.getCSVRow((LoggingObject)loggingObject, anonymize, resourceableId ));
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.