Package org.olat.core.commons.persistence

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


   * @param name
   * @return List of catalog entries
   */
  public List getCatalogEntriesByName(String name) {
    String sqlQuery = "select cei from org.olat.catalog.CatalogEntryImpl as cei where cei.name = :name";
    DBQuery dbQuery = DBFactory.getInstance().createQuery(sqlQuery);
    dbQuery.setString("name",name);
    dbQuery.setCacheable(true);
    return dbQuery.list();
   
  }
View Full Code Here


    String sqlQuery = "select cei from org.olat.catalog.CatalogEntryImpl as cei inner join fetch cei.ownerGroup, " +
      " org.olat.basesecurity.SecurityGroupMembershipImpl as sgmsi" +
      " where " +
      " cei.ownerGroup = sgmsi.securityGroup and" +
      " sgmsi.identity = :identity";
    DBQuery dbQuery = DBFactory.getInstance().createQuery(sqlQuery);
    dbQuery.setEntity("identity", identity);
    dbQuery.setCacheable(true);
    return dbQuery.list();
   
  }
View Full Code Here

   *
   * @return List of catalog entries
   */
  public List getRootCatalogEntries() {
    String sqlQuery = "select cei from org.olat.catalog.CatalogEntryImpl as cei where cei.parent is null";
    DBQuery dbQuery = DBFactory.getInstance().createQuery(sqlQuery);
    dbQuery.setCacheable(true);
    return dbQuery.list();
  }
View Full Code Here

      log.audit("**** Migrated " + counter + " publishers. ****");
     
      log.audit("+-----------------------------------------------------------------------------+");
      log.audit("+... Update the latest emailed date for all subscribers                       +");
      log.audit("+-----------------------------------------------------------------------------+");
      DBQuery query = DBFactory.getInstance().createQuery("update " + Subscriber.class.getName() + " subscriber set subscriber.latestEmailed=:latestDate");
      Calendar cal = Calendar.getInstance();
      //
      // use the day of installing the release,
      // and set the time back to midnight instead of
      // going back one day, e.g. cal.add(Calendar.DAY_OF_MONTH, -1);
      //
      // 1) before release day, sending notifications the old way at 02:00:00 a.m.
      // 2) at release day, sending notifications the old way at 02:00:00 a.m.
      // .. Install the Release -> Upgrader sets latestEmail sent on subscribers to release day at 00:00:00
      // 3) day after release, sending notifications the new way at 02:00:00 a.m.
      //
      // with this procedure only the news are sent twice which were created between 00:00:00 and 02:00:00 of release day.
      //
      cal.set(Calendar.HOUR_OF_DAY, 0);
      cal.set(Calendar.MINUTE, 0);
      cal.set(Calendar.SECOND, 0);
      cal.set(Calendar.MILLISECOND, 0);
      query.setTimestamp("latestDate", cal.getTime());
      int subCounter = query.executeUpdate(FlushMode.AUTO);
     
      DBFactory.getInstance().intermediateCommit();
      log.audit("**** Migrated " + subCounter + " subscribers. ****");

      uhd.setBooleanDataValue(TASK_MIGRATE_NOTIFICATIONS, true);
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) {
        try{
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;
      for (BGContext context : contexts) {
        try{
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;

      for (BGArea area : areas) {
View Full Code Here

  @SuppressWarnings("unchecked")
  public List<Subscriber> getSubscribers(Identity identity) {
    DB db = DBFactory.getInstance();
    String q = "select sub from org.olat.notifications.SubscriberImpl sub"
        + " inner join fetch sub.publisher where sub.identity = :anIdentity";
    DBQuery query = db.createQuery(q);
    query.setEntity("anIdentity", identity);
    List<Subscriber> res = query.list();
    return res;
  }
View Full Code Here

  public List<Subscriber> getValidSubscribers(Identity identity) {
    //pub.getState() == PUB_STATE_OK;
    DB db = DBFactory.getInstance();
    String q = "select sub from org.olat.notifications.SubscriberImpl sub" + " inner join fetch sub.publisher as pub"
        + " where sub.identity = :anIdentity" + " and pub.state = :aState";
    DBQuery query = db.createQuery(q);
    query.setEntity("anIdentity", identity);
    query.setLong("aState", PUB_STATE_OK);
    List<Subscriber> res = query.list();
    return res;
  }
View Full Code Here

  public List<Subscriber> getValidSubscribersOf(Publisher publisher) {
    DB db = DBFactory.getInstance();
    String q = "select sub from org.olat.notifications.SubscriberImpl sub inner join fetch sub.identity"
        + " where sub.publisher = :publisher"
        + " and sub.publisher.state = "+PUB_STATE_OK;
    DBQuery query = db.createQuery(q);
    query.setEntity("publisher", publisher);
    List<Subscriber> res = query.list();
    return res;
  }
View Full Code Here

TOP

Related Classes of org.olat.core.commons.persistence.DBQuery

Copyright © 2018 www.massapicom. 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.