public static RUserDto getUser(DbConn cnx, int id) { List<RUserDto> res = getUsers(cnx, "user_select_by_id", 0, id); if (res.size() == 1) { return res.get(0); } else { throw new JqmAdminApiUserException("no result"); } }
public static RRoleDto getRole(DbConn cnx, int id) { List<RRoleDto> res = getRoles(cnx, "role_select_by_id", 0, id); if (res.size() == 1) { return res.get(0); } else { throw new JqmAdminApiUserException("no result"); } }
public static RUserDto getUser(DbConn cnx, int id) { List<RUserDto> res = getUsers(cnx, "user_select_by_id", 0, id); if (res.size() == 1) { return res.get(0); } else { throw new JqmAdminApiUserException("no result"); } }
public static RRoleDto getRole(DbConn cnx, int id) { List<RRoleDto> res = getRoles(cnx, "role_select_by_id", 0, id); if (res.size() == 1) { return res.get(0); } else { throw new JqmAdminApiUserException("no result"); } }
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 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); } }
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); } }
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, String userLogin, String newPassword) { List<RUserDto> dtos = getUsers(cnx, "user_select_by_key", 0, userLogin); if (dtos.size() == 0) { throw new JqmAdminApiUserException("Cannot update the password of a user which does not exist - given login was " + userLogin); } changeUserPassword(cnx, dtos.get(0).getId(), newPassword); }
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, String userLogin, String newPassword) { List<RUserDto> dtos = getUsers(cnx, "user_select_by_key", 0, userLogin); if (dtos.size() == 0) { throw new JqmAdminApiUserException("Cannot update the password of a user which does not exist - given login was " + userLogin); } changeUserPassword(cnx, dtos.get(0).getId(), newPassword); }
public static void deleteJobDef(DbConn cnx, int id) { int countRunning = cnx.runSelectSingle("ji_select_count_by_jd", Integer.class, id); if (countRunning > 0) { throw new JqmAdminApiUserException( "cannot delete a job definition with running instances. Disable it, wait for the end of all running instances, then retry."); } cnx.runUpdate("jdprm_delete_all_for_jd", id); QueryResult qr = cnx.runUpdate("jd_delete_by_id", id); if (qr.nbUpdated != 1) { cnx.setRollbackOnly(); throw new JqmAdminApiUserException("no item with ID " + id); } }
public static void deleteJobDef(DbConn cnx, int id) { int countRunning = cnx.runSelectSingle("ji_select_count_by_jd", Integer.class, id); if (countRunning > 0) { throw new JqmAdminApiUserException( "cannot delete a job definition with running instances. Disable it, wait for the end of all running instances, then retry."); } cnx.runUpdate("jdprm_delete_all_for_jd", id); QueryResult qr = cnx.runUpdate("jd_delete_by_id", id); if (qr.nbUpdated != 1) { cnx.setRollbackOnly(); throw new JqmAdminApiUserException("no item with ID " + id); } }
public static QueueMappingDto getQueueMapping(DbConn cnx, int id) { ResultSet rs = null; try { rs = cnx.runSelect("dp_select_with_names_by_id", id); if (!rs.next()) { throw new JqmAdminApiUserException("no result"); } rs.close(); return mapQueueMapping(rs, 0); } catch (SQLException e) { throw new DatabaseException(e); } }
public static QueueMappingDto getQueueMapping(DbConn cnx, int id) { ResultSet rs = null; try { rs = cnx.runSelect("dp_select_with_names_by_id", id); if (!rs.next()) { throw new JqmAdminApiUserException("no result"); } rs.close(); return mapQueueMapping(rs, 0); } catch (SQLException e) { throw new DatabaseException(e); } }
public static NodeDto getNode(DbConn cnx, String nodeName) { ResultSet rs = null; try { rs = cnx.runSelect("node_select_by_key", nodeName); if (!rs.next()) { throw new JqmAdminApiUserException("no result"); } return mapNode(rs, 0); } catch (SQLException e) { throw new DatabaseException(e); } }
public static QueueDto getQueue(DbConn cnx, int id) { ResultSet rs = null; try { rs = cnx.runSelect("q_select_by_id", id); if (!rs.next()) { throw new JqmAdminApiUserException("no result"); } return mapQueue(rs, 0); } catch (SQLException e) { throw new DatabaseException(e); } }
public static void deleteJndiObjectResource(DbConn cnx, int id) { cnx.runUpdate("jndiprm_delete_for_resource", id); QueryResult qr = cnx.runUpdate("jndi_delete_by_id", id); if (qr.nbUpdated != 1) { cnx.setRollbackOnly(); throw new JqmAdminApiUserException("no item with ID " + id); } }
public static NodeDto getNode(DbConn cnx, int id) { ResultSet rs = null; try { rs = cnx.runSelect("node_select_by_id", id); if (!rs.next()) { throw new JqmAdminApiUserException("no result"); } return mapNode(rs, 0); } catch (SQLException e) { throw new DatabaseException(e); } }