Package org.olat.core.commons.persistence

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


        + " where (gr.lastUsage = null or gr.lastUsage < :lastUsage)"
        + " and gr.type = :type ";
    DBQuery dbq = DBFactory.getInstance().createQuery(query);
    dbq.setDate("lastUsage", lastUsageLimit.getTime());
    dbq.setString("type", BusinessGroup.TYPE_BUDDYGROUP);
    List groups = dbq.list();
    // 2. get all businness-groups in deletion-process (email send)
    query = "select gr from org.olat.group.BusinessGroupImpl as gr"
      + " , org.olat.commons.lifecycle.LifeCycleEntry as le"
      + " where gr.key = le.persistentRef "
      + " and le.persistentTypeName ='org.olat.group.BusinessGroupImpl'"
View Full Code Here


      + " , org.olat.commons.lifecycle.LifeCycleEntry as le"
      + " where gr.key = le.persistentRef "
      + " and le.persistentTypeName ='org.olat.group.BusinessGroupImpl'"
      + " and le.action ='" + SEND_DELETE_EMAIL_ACTION + "' ";
    dbq = DBFactory.getInstance().createQuery(query);
    List groupsInProcess = dbq.list();
    // 3. Remove all groups in deletion-process from all unused-groups
    groups.removeAll(groupsInProcess);
    return groups;
  }
View Full Code Here

        + " and le.action ='" + SEND_DELETE_EMAIL_ACTION + "' and le.lcTimestamp >= :deleteEmailDate "
        + " and gr.type = :type ";
    DBQuery dbq = DBFactory.getInstance().createQuery(queryStr);
    dbq.setDate("deleteEmailDate", deleteEmailLimit.getTime());
    dbq.setString("type", BusinessGroup.TYPE_BUDDYGROUP);
    return dbq.list();
  }

  public List getGroupsReadyToDelete(int deleteEmailDuration) {
    Calendar deleteEmailLimit = Calendar.getInstance();
    deleteEmailLimit.add(Calendar.DAY_OF_MONTH, - (deleteEmailDuration - 1));
View Full Code Here

      + " and le.action ='" + SEND_DELETE_EMAIL_ACTION + "' and le.lcTimestamp < :deleteEmailDate "
      + " and gr.type = :type ";
    DBQuery dbq = DBFactory.getInstance().createQuery(queryStr);
    dbq.setDate("deleteEmailDate", deleteEmailLimit.getTime());
    dbq.setString("type", BusinessGroup.TYPE_BUDDYGROUP);
    return dbq.list();
  }

  public void deleteGroups(List objects) {
    for (Iterator iter = objects.iterator(); iter.hasNext();) {
      BusinessGroup businessGroup = (BusinessGroup) iter.next();
View Full Code Here

    String query = "select re from org.olat.repository.RepositoryEntry as re "
        + " where (re.lastUsage = null or re.lastUsage < :lastUsage)"
        + " and re.olatResource != null ";
    DBQuery dbq = DBFactory.getInstance().createQuery(query);
    dbq.setDate("lastUsage", lastUsageLimit.getTime());
    List reprositoryEntries = dbq.list();
    // 2. get all ReprositoryEntries in deletion-process (email send)
    query = "select re from org.olat.repository.RepositoryEntry as re"
      + " , org.olat.commons.lifecycle.LifeCycleEntry as le"
      + " where re.key = le.persistentRef "
      + " and re.olatResource != null "
View Full Code Here

      + " where re.key = le.persistentRef "
      + " and re.olatResource != null "
      + " and le.persistentTypeName ='" + RepositoryEntry.class.getName() + "'"
      + " and le.action ='" + SEND_DELETE_EMAIL_ACTION + "' ";
    dbq = DBFactory.getInstance().createQuery(query);
    List groupsInProcess = dbq.list();
    // 3. Remove all ReprositoryEntries in deletion-process from all unused-ReprositoryEntries
    reprositoryEntries.removeAll(groupsInProcess);
    return filterRepositoryWithReferences(reprositoryEntries);
  }
View Full Code Here

      + " and re.olatResource != null "
      + " and le.persistentTypeName ='" + RepositoryEntry.class.getName() + "'"
      + " and le.action ='" + SEND_DELETE_EMAIL_ACTION + "' and le.lcTimestamp >= :deleteEmailDate ";
    DBQuery dbq = DBFactory.getInstance().createQuery(queryStr);
    dbq.setDate("deleteEmailDate", deleteEmailLimit.getTime());
    return filterRepositoryWithReferences(dbq.list());
  }

  public List getReprositoryEntriesReadyToDelete(int deleteEmailDuration) {
    Calendar deleteEmailLimit = Calendar.getInstance();
    deleteEmailLimit.add(Calendar.DAY_OF_MONTH, - (deleteEmailDuration - 1));
View Full Code Here

      + " and re.olatResource != null "
      + " and le.persistentTypeName ='" + RepositoryEntry.class.getName() + "'"
      + " and le.action ='" + SEND_DELETE_EMAIL_ACTION + "' and le.lcTimestamp < :deleteEmailDate ";
    DBQuery dbq = DBFactory.getInstance().createQuery(queryStr);
    dbq.setDate("deleteEmailDate", deleteEmailLimit.getTime());
    return filterRepositoryWithReferences(dbq.list());
  }

  public void deleteRepositoryEntries(UserRequest ureq, WindowControl wControl, List repositoryEntryList) {
    for (Iterator iter = repositoryEntryList.iterator(); iter.hasNext();) {
      RepositoryEntry repositoryEntry = (RepositoryEntry) iter.next();
View Full Code Here

    query.setLong("identitykey", iimpl.getKey());
    query.setString("permission", permission);   
    query.setLong("resid", oresid);
    query.setString("resname", oresName);
    query.setCacheable(true);
    List res = query.list();
    Long cntL = (Long) res.get(0);
    return (cntL.longValue() > 0); // can be > 1 if identity is in more the one group having
    // the permission on the olatresourceable
  }
View Full Code Here

    String queryString = "select count(sgmsi) from  org.olat.basesecurity.SecurityGroupMembershipImpl as sgmsi where sgmsi.identity = :identitykey and sgmsi.securityGroup = :securityGroup";
    DBQuery query = DBFactory.getInstance().createQuery(queryString);
    query.setLong("identitykey", identity.getKey());
    query.setLong("securityGroup", secGroup.getKey());
    query.setCacheable(true);
    List res = query.list();
    Long cntL = (Long) res.get(0);
    if (cntL.longValue() != 0 && cntL.longValue() != 1) throw new AssertException("unique n-to-n must always yield 0 or 1");
    return (cntL.longValue() == 1);
  }
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.