public static void setExternal(DbConn cnx, Integer jdId) { cnx.runUpdate("jd_update_set_external_by_id", jdId); } }
public static int create(DbConn cnx, String login, String password_hash, String password_salt, Calendar expiration, Boolean internal, String... role_names) { QueryResult r = cnx.runUpdate("user_insert", null, expiration, null, password_salt, internal, false, login, password_hash); int newId = r.getGeneratedId(); for (String s : role_names) { cnx.runUpdate("user_add_role_by_name", newId, s); } return newId; }
public static int create(DbConn cnx, ClEvent type, String className, int classloaderId, Map<String, String> parameters) { QueryResult r = cnx.runUpdate("cleh_insert", type, className, classloaderId); int newId = r.getGeneratedId(); for (Map.Entry<String, String> prm : parameters.entrySet()) { cnx.runUpdate("clehprm_insert", prm.getKey(), prm.getValue(), newId); } return newId; } }
public static int create(DbConn cnx, String jndiAlias, String className, String factoryClass, String description, boolean singleton, Map<String, String> parameters) { QueryResult r = cnx.runUpdate("jndi_insert", description, factoryClass, jndiAlias, singleton, (String) null, className); int newId = r.getGeneratedId(); for (Map.Entry<String, String> prms : parameters.entrySet()) { cnx.runUpdate("jndiprm_insert", prms.getKey(), prms.getValue(), newId); } return newId; }
public static int create(DbConn cnx, String jndiAlias, String className, String factoryClass, String description, boolean singleton, Map<String, String> parameters) { QueryResult r = cnx.runUpdate("jndi_insert", description, factoryClass, jndiAlias, singleton, (String) null, className); int newId = r.getGeneratedId(); for (Map.Entry<String, String> prms : parameters.entrySet()) { cnx.runUpdate("jndiprm_insert", prms.getKey(), prms.getValue(), newId); } return newId; }
public static void setNodesLogLevel(String level, DbConn cnx) { cnx.runUpdate("node_update_all_log_level", level); cnx.commit(); }
public void update(DbConn cnx) { if (this.id == null) { this.id = create(cnx, name, description, defaultQueue); } else { cnx.runUpdate("q_update_all_fields_by_id", defaultQueue, description, name, id); } } }
public void update(DbConn cnx) { if (id == null) { this.id = Cl.create(cnx, name, childFirst, hiddenClasses, tracingEnabled, persistent, allowedRunners); } else { cnx.runUpdate("cl_update_all_fields_by_id", name, childFirst, hiddenClasses, tracingEnabled, persistent, allowedRunners, id); } } }
public static int create(DbConn cnx, String key, String value, int jdId) { QueryResult qr = cnx.runUpdate("jdprm_insert", key, value, jdId); return qr.getGeneratedId(); } }
public static void delete_id(DbConn cnx, int id) { QueryResult res = cnx.runUpdate("ji_delete_by_id", id); if (res.nbUpdated != 1) { throw new DatabaseException("Delete failed: row does not exist"); } }
/** * Create a new entry in the database. No commit performed. */ public static int create(DbConn cnx, String textMessage, Integer jobId) { QueryResult r = cnx.runUpdate("message_insert", jobId, textMessage); return r.getGeneratedId(); } }
public static int create(DbConn cnx, String alias, String pemPK, String pemCert) { QueryResult qr = cnx.runUpdate("pki_insert", pemCert, pemPK, alias); return qr.getGeneratedId(); } }
public static int create(DbConn cnx, String name, boolean childFirst, String hiddenClasses, boolean tracing, boolean persistent, String allowedRunners) { QueryResult r = cnx.runUpdate("cl_insert", name, childFirst, hiddenClasses, tracing, persistent, allowedRunners); int newId = r.getGeneratedId(); return newId; }
public static void deleteGlobalParameter(DbConn cnx, int id) { QueryResult qr = cnx.runUpdate("globalprm_delete_by_id", id); if (qr.nbUpdated != 1) { cnx.setRollbackOnly(); throw new JqmAdminApiUserException("no item with ID " + id); } }
/** * Create a new GP entry in the database. No commit performed. */ public static GlobalParameter create(DbConn cnx, String key, String value) { QueryResult r = cnx.runUpdate("globalprm_insert", key, value); GlobalParameter res = new GlobalParameter(); res.id = r.getGeneratedId(); res.key = key; res.value = value; return res; }
public static void deleteQueueMapping(DbConn cnx, int id) { QueryResult qr = cnx.runUpdate("dp_delete_by_id", id); if (qr.nbUpdated != 1) { cnx.setRollbackOnly(); throw new JqmAdminApiUserException("no item with ID " + id); } }
public static void deleteUser(DbConn cnx, int id) { QueryResult qr = cnx.runUpdate("user_delete_by_id", id); if (qr.nbUpdated != 1) { cnx.setRollbackOnly(); throw new JqmAdminApiUserException("no item with ID " + id); } }
public static void changeUserPassword(DbConn cnx, int userId, String newPassword) { ByteSource salt = new SecureRandomNumberGenerator().nextBytes(); String hash = new Sha512Hash(newPassword, salt, 100000).toHex(); QueryResult qr = cnx.runUpdate("user_update_password_by_id", hash, salt.toHex(), userId); if (qr.nbUpdated == 0) { throw new JqmAdminApiUserException("user with this ID does not exist"); } }
public static void upsertQueue(DbConn cnx, QueueDto dto) { if (dto.getId() != null) { cnx.runUpdate("q_update_changed_by_id", dto.isDefaultQueue(), dto.getDescription(), dto.getName(), dto.getId(), dto.isDefaultQueue(), dto.getDescription(), dto.getName()); } else { Queue.create(cnx, dto.getName(), dto.getDescription(), dto.isDefaultQueue()); } }