public static void updateFeedNames() { List<User> validatedUsers = getAllValidatedUsers(); validatedUsers.add(0, User.getUser("demo")); validatedUsers.add(0, User.getUser("subbu")); for (User u : validatedUsers) { System.out.println("Got uid: " + u.getUid()); for (Source s : u.getSources()) { Feed f = s.getFeed(); try { SQL_StmtExecutor.update( "UPDATE feeds SET feed_name = ? WHERE id = ? AND feed_name=''", new SQL_ValType[] {SQL_ValType.STRING, SQL_ValType.LONG}, new Object[] {s.getName(), f.getKey()}); } catch (Exception e) { _log.error("Error setting feed name", e); } } } }
public static void migrateUser(String uid) { System.out.println("--- Migrating user .. " + uid); try { User u = User.getUser(uid); u.validateAllIssues(true); for (Source s : u.getSources()) { Feed f = s.getFeed(); try { SQL_StmtExecutor.update( "UPDATE feeds SET feed_name = ? WHERE id = ? AND feed_name=''", new SQL_ValType[] {SQL_ValType.STRING, SQL_ValType.LONG}, new Object[] {s.getName(), f.getKey()}); } catch (Exception e) { _log.error("Error setting feed name", e); } } } catch (Exception e) { _log.error("ERROR VALIDATING user: " + uid, e); } }