public static void updatePass(String password, String username) { String s = "update neighbors set password= :password where username = :username"; SqlUpdate update = Ebean.createSqlUpdate(s); update.setParameter("password", password); update.setParameter("username", username); update.execute(); }
/** Rename a folder */ public static String renameFolder(String folder, String newName) { Ebean.createSqlUpdate("update project set folder = :newName where folder = :folder") .setParameter("folder", folder) .setParameter("newName", newName) .execute(); return newName; }
/** Rename a project */ public static String rename(Integer projectId, String newName) { Ebean.createSqlUpdate("update project set name = :newName where id = :id") .setParameter("id", projectId) .setParameter("newName", newName) .execute(); return newName; }
/** Rename a folder */ public static String renameFolder(Integer project, String folder, String newName) { Ebean.createSqlUpdate( "update task set folder = :newName where folder = :folder and project_id = :project") .setParameter("folder", folder) .setParameter("newName", newName) .setParameter("project", project) .execute(); return newName; }
/** Mark a task as done or not */ public static void markAsDone(Integer taskId, Boolean done) { /* Task task = Task.find.ref(taskId); task.done = done; task.update();*/ Ebean.createSqlUpdate("update task set done = :done where id = :id") .setParameter("id", taskId) .setParameter("done", done) .execute(); }
/** * Pour utiliser les noms de commune dicté par AER : c'est-à-dire en minuscule avec des articles. */ private void metAJourNomAERCommunes() { for (Commune c : Commune.find.all()) { if (c.ville_nom.startsWith("LA ")) c.ville_nom_aer = "La " + c.ville_nom_reel; else if (c.ville_nom.startsWith("LE ")) c.ville_nom_aer = "Le " + c.ville_nom_reel; else if (c.ville_nom.startsWith("LES ")) c.ville_nom_aer = "Les " + c.ville_nom_reel; else if (c.ville_nom.startsWith("L'")) c.ville_nom_aer = "L'" + c.ville_nom_reel; else c.ville_nom_aer = c.ville_nom_reel; SqlUpdate update = Ebean.createSqlUpdate("UPDATE commune SET ville_nom_aer=:aer WHERE ville_id=:id") .setParameter("aer", c.ville_nom_aer) .setParameter("id", c.ville_id); update.execute(); } }
/** Delete all project in a folder */ public static void deleteInFolder(String folder) { Ebean.createSqlUpdate("delete from project where folder = :folder") .setParameter("folder", folder) .execute(); }