UpgradeHistoryData uhd = upgradeManager.getUpgradesHistory(VERSION);
if (!uhd.getBooleanDataValue(TASK_CREATE_DISCLAIMER_CONFIRMATION)) {
// Get all system users
Manager secMgr = ManagerFactory.getManager();
RegistrationManager regMgr = RegistrationManager.getInstance();
DB db = DBFactory.getInstance();
// Get all users
List<Identity> identities = secMgr.getVisibleIdentitiesByPowerSearch(null, null, false, null, null, null, null, null);
// Remove the users that did already confirm the disclaimer
List<Identity> confirmedIdentities = regMgr.getIdentitiesWithConfirmedDisclaimer();
PersistenceHelper.removeObjectsFromList(identities, confirmedIdentities);
// Set the disclaimer property for the remaining users
for (int i = 0; i < identities.size(); i++) {
Identity identity = identities.get(i);
regMgr.setHasConfirmedDislaimer(identity);
// write something to the console after each 100 user, this can take a
// while with many users and it is handy to know that the system is
// doing something
if (i % 250 == 0) {
log.audit("Busy creating disclaimer confirmation. Done with " + i + " of a total of " + identities.size() + " users. Please wait ...");
db.intermediateCommit();
}
}
log.audit("Done with creating disclaimer confirmation for " + identities.size() + " users");
uhd.setBooleanDataValue(TASK_CREATE_DISCLAIMER_CONFIRMATION, true);