use of org.olat.core.commons.persistence.DBQuery in project OpenOLAT by OpenOLAT.
the class EPNotificationManager method getArtefactNotifications.
private List<EPArtefactNotification> getArtefactNotifications(List<Long> mapKey, Date compareDate) {
if (mapKey == null || mapKey.isEmpty()) {
return Collections.emptyList();
}
StringBuilder sb = new StringBuilder();
sb.append("select notification from ").append(EPArtefactNotification.class.getName()).append(" as notification").append(" inner join fetch notification.author").append(" where notification.creationDate>=:currentDate and (notification.key in (:mapKey) or notification.rootMapKey in (:mapKey))");
DBQuery query = dbInstance.createQuery(sb.toString());
query.setDate("currentDate", compareDate);
query.setParameterList("mapKey", mapKey);
@SuppressWarnings("unchecked") List<EPArtefactNotification> notifications = query.list();
return notifications;
}
use of org.olat.core.commons.persistence.DBQuery in project OpenOLAT by OpenOLAT.
the class EPNotificationManager method getCommentNotifications.
private List<EPCommentNotification> getCommentNotifications(List<Long> mapKey, Date compareDate) {
if (mapKey == null || mapKey.isEmpty()) {
return Collections.emptyList();
}
StringBuilder sb = new StringBuilder();
sb.append("select notification from ").append(EPCommentNotification.class.getName()).append(" as notification").append(" inner join fetch notification.author").append(" where notification.creationDate>=:currentDate and notification.mapKey in (:mapKey)");
DBQuery query = dbInstance.createQuery(sb.toString());
query.setDate("currentDate", compareDate);
query.setParameterList("mapKey", mapKey);
@SuppressWarnings("unchecked") List<EPCommentNotification> notifications = query.list();
return notifications;
}
use of org.olat.core.commons.persistence.DBQuery in project OpenOLAT by OpenOLAT.
the class EPNotificationManager method getRatingNotifications.
private List<EPRatingNotification> getRatingNotifications(List<Long> mapKey, Date compareDate) {
if (mapKey == null || mapKey.isEmpty()) {
return Collections.emptyList();
}
StringBuilder sb = new StringBuilder();
sb.append("select notification from ").append(EPRatingNotification.class.getName()).append(" as notification").append(" inner join fetch notification.author").append(" where notification.creationDate>=:currentDate and notification.mapKey in (:mapKey)");
DBQuery query = dbInstance.createQuery(sb.toString());
query.setDate("currentDate", compareDate);
query.setParameterList("mapKey", mapKey);
@SuppressWarnings("unchecked") List<EPRatingNotification> notifications = query.list();
return notifications;
}
use of org.olat.core.commons.persistence.DBQuery in project OpenOLAT by OpenOLAT.
the class RepositoryManager method countByTypeLimitAccess.
/**
* Count by type, limit by role accessability.
* @param restrictedType
* @param roles
* @return Number of repo entries
*/
public int countByTypeLimitAccess(String restrictedType, int restrictedAccess) {
StringBuilder query = new StringBuilder(400);
query.append("select count(*) from" + " org.olat.repository.RepositoryEntry v, " + " org.olat.resource.OLATResourceImpl res " + " where v.olatResource = res and res.resName= :restrictedType and v.access >= :restrictedAccess ");
DBQuery dbquery = dbInstance.createQuery(query.toString());
dbquery.setString("restrictedType", restrictedType);
dbquery.setInteger("restrictedAccess", restrictedAccess);
dbquery.setCacheable(true);
return ((Long) dbquery.list().get(0)).intValue();
}
use of org.olat.core.commons.persistence.DBQuery in project OpenOLAT by OpenOLAT.
the class OLATUpgrade_7_1_1 method getStructuredMapsLinkedToTemplate.
private List<PortfolioStructure> getStructuredMapsLinkedToTemplate(PortfolioStructure template) {
StringBuilder sb = new StringBuilder();
sb.append("select map from ").append(EPStructuredMap.class.getName()).append(" map").append(" where map.structuredMapSource=:template");
DBQuery query = DBFactory.getInstance().createQuery(sb.toString());
query.setEntity("template", template);
@SuppressWarnings("unchecked") List<PortfolioStructure> maps = query.list();
return maps;
}
Aggregations