Package org.olat.core.commons.persistence

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


   * @param action
   *
   * @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


   * @param regkey the encrypted registrationkey
   *
   * @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

   * recursively delete the structure starting from the catalog entry.
   *
   * @param ce
   */
  private void deleteCatalogSubtree(CatalogEntry ce, List secGroupsToBeDeleted) {
    DB db = DBFactory.getInstance();

    List children = getChildrenOf(ce);
    Iterator iter = children.iterator();
    while (iter.hasNext()) {
      CatalogEntry nextCe = (CatalogEntry) iter.next();
      deleteCatalogSubtree(nextCe,secGroupsToBeDeleted);
    }
    ce = (CatalogEntry) db.loadObject(ce);
    //mark owner group for deletion.
    SecurityGroup owner = ce.getOwnerGroup();
    if (owner != null) secGroupsToBeDeleted.add(owner);
    // delete user bookmarks
    OLATResourceable ores = createOLATResouceableFor(ce);
    BookmarkManager.getInstance().deleteAllBookmarksFor(ores);
    // delete catalog entry itself
    db.deleteObject(ce);
  }
View Full Code Here

    if (!uhd.getBooleanDataValue(TASK_MIGRATE_WIKICODE_REPOENTRY)) {
      log.audit("+---------------------------------------------------------------+");
      log.audit("+...     " + TASK_MIGRATE_WIKICODE_REPOENTRY + "     ...+");
      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) {
View Full Code Here

    if (!uhd.getBooleanDataValue(TASK_MIGRATE_WIKICODE_BGCONTEXT)) {
      log.audit("+---------------------------------------------------------------+");
      log.audit("+...     " + TASK_MIGRATE_WIKICODE_BGCONTEXT + "     ...+");
      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;
View Full Code Here

    if (!uhd.getBooleanDataValue(TASK_MIGRATE_WIKICODE_BGAREA)) {
      log.audit("+---------------------------------------------------------------+");
      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;
View Full Code Here

   * @param identity
   * @return List of Subscriber Objects which belong to the identity
   */
  @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

   *         publishers are valid
   */
  @SuppressWarnings("unchecked")
  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

  /**
   * @see org.olat.core.util.notifications.NotificationsManager#getValidSubscribersOf(org.olat.core.util.notifications.Publisher)
   */
  @SuppressWarnings("unchecked")
  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

   * @return a list of subscribers ordered by the name of the identity of the
   *         subscription
   */
  @SuppressWarnings("unchecked")
  private List<Subscriber> getAllValidSubscribers() {
    DB db = DBFactory.getInstance();
    String q = "select sub from org.olat.notifications.SubscriberImpl sub" + " inner join fetch sub.publisher as pub"
        + " where pub.state = :aState" + " order by sub.identity.name";
    DBQuery query = db.createQuery(q);
    query.setLong("aState", PUB_STATE_OK);
    List<Subscriber> res = query.list();
    return res;
  }
View Full Code Here

TOP

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

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.