if (!uhd.getBooleanDataValue(TASK_MIGRATE_WIKICODE_NOTES)) {
log.audit("+---------------------------------------------------------------+");
log.audit("+... " + TASK_MIGRATE_WIKICODE_NOTES + " ...+");
log.audit("+---------------------------------------------------------------+");
Manager secMgr = ManagerFactory.getManager();
NoteManager noteMgr = NoteManager.getInstance();
List<Identity> identitiesList = secMgr.getIdentitiesByPowerSearch(null, null, true, null, null, null,
null, null, null);
DBFactory.getInstance().intermediateCommit();
int counter = 0;
int usercounter = 0;
if (log.isDebug()) log.info("Migrating notes for " + identitiesList.size() + " Identities.");
for (Iterator<Identity> iterator = identitiesList.iterator(); iterator.hasNext();) {
Identity identity = iterator.next();
try{
List<Note> allIdentityNotes = noteMgr.listUserNotes(identity);
if (log.isDebug()) log.info("Migrate " + allIdentityNotes.size() + " Notes for Identity: " + identity.getName());
if (!allIdentityNotes.isEmpty()){
usercounter++;
for (Iterator<Note> iterator2 = allIdentityNotes.iterator(); iterator2.hasNext();) {
try{
Note note = iterator2.next();
String parsedText = note.getNoteText();
parsedText = migrateStringSavely(parsedText);
note.setNoteText(parsedText);
noteMgr.saveNote(note);
counter ++;
DBFactory.getInstance().intermediateCommit();
} catch (Exception e) {
log.error("Error during Migration: "+e, e);
DBFactory.getInstance().rollback();