private void migrateGroupNews(UpgradeManager upgradeManager, UpgradeHistoryData uhd) {
if (!uhd.getBooleanDataValue(TASK_MIGRATE_WIKICODE_GROUPNEWS)) {
log.audit("+---------------------------------------------------------------+");
log.audit("+... " + TASK_MIGRATE_WIKICODE_GROUPNEWS + " ...+");
log.audit("+---------------------------------------------------------------+");
PropertyManager pm = PropertyManager.getInstance();
// hardcoded query since manager does not provide appropriate method
StringBuilder query = new StringBuilder();
query.append("from v in class org.olat.properties.Property where ");
query.append("v.category = '").append(CollaborationTools.PROP_CAT_BG_COLLABTOOLS).append("'");
query.append(" and ");
query.append("v.name = 'news'");
List<Property> props = DBFactory.getInstance().find(query.toString());
if (log.isDebug()) log.info("Found " + props.size() + " groupnews to migrate.");
int counter = 0;
for (Property property : props) {
try{
String oldVal = property.getTextValue();
String newVal = migrateStringSavely(oldVal);
property.setTextValue(newVal);
pm.updateProperty(property);
counter++;
DBFactory.getInstance().intermediateCommit();
} catch (Exception e) {
log.error("Error during Migration: "+e, e);
DBFactory.getInstance().rollback();