Tracing.logDebug("lastLoginLimit=" + lastLoginLimit, this.getClass());
// 1. get all 'active' identities with lastlogin > x
String queryStr ="from org.olat.core.id.Identity as ident where ident.status = '"
+ Identity.STATUS_ACTIV
+ "' and (ident.lastLogin = null or ident.lastLogin < :lastLogin)";
DBQuery dbq = DBFactory.getInstance().createQuery(queryStr);
dbq.setDate("lastLogin", lastLoginLimit.getTime());
List identities = dbq.list();
// 2. get all 'active' identities in deletion process
queryStr = "select ident from org.olat.core.id.Identity as ident"
+ " , org.olat.commons.lifecycle.LifeCycleEntry as le"
+ " where ident.key = le.persistentRef "
+ " and le.persistentTypeName ='" + IdentityImpl.class.getName() + "'"
+ " and le.action ='" + SEND_DELETE_EMAIL_ACTION + "' ";
dbq = DBFactory.getInstance().createQuery(queryStr);
List identitiesInProcess = dbq.list();
// 3. Remove all identities in deletion-process from all inactive-identities
identities.removeAll(identitiesInProcess);
return identities;
}