private static JndiObjectResourceDto getUniqueJndiResource(DbConn cnx, String query_key, Object key) { List<JndiObjectResourceDto> res = getJndiObjectResources(cnx, query_key, key); if (res.isEmpty()) { throw new NoResultException("The query returned zero rows when one was expected."); } if (res.size() > 1) { throw new NonUniqueResultException("The query returned more than one row when one was expected"); } return res.get(0); }
public static PKI select_key(DbConn cnx, String key) { List<PKI> pp = select(cnx, "pki_select_by_key", key); if (pp.size() == 0) { throw new NoResultException("No PKI with key " + key); } if (pp.size() > 1) { throw new NonUniqueResultException("Configuration is not valid"); } return pp.get(0); }
public static JndiObjectResource select_alias(DbConn cnx, String alias) { List<JndiObjectResource> res = select(cnx, "jndi_select_by_key", alias); if (res.isEmpty()) { throw new NoResultException("no result for query by key for key " + alias); } if (res.size() > 1) { throw new NonUniqueResultException("Inconsistent database! Multiple results for query by key for key " + alias); } return res.get(0); } }
public static PKI select_key(DbConn cnx, String key) { List<PKI> pp = select(cnx, "pki_select_by_key", key); if (pp.size() == 0) { throw new NoResultException("No PKI with key " + key); } if (pp.size() > 1) { throw new NonUniqueResultException("Configuration is not valid"); } return pp.get(0); }
private static JndiObjectResourceDto getUniqueJndiResource(DbConn cnx, String query_key, Object key) { List<JndiObjectResourceDto> res = getJndiObjectResources(cnx, query_key, key); if (res.isEmpty()) { throw new NoResultException("The query returned zero rows when one was expected."); } if (res.size() > 1) { throw new NonUniqueResultException("The query returned more than one row when one was expected"); } return res.get(0); }
public static RUser selectlogin(DbConn cnx, String id) { List<RUser> res = select(cnx, "user_select_by_key", id); if (res.isEmpty()) { throw new NoResultException("no result for query by key for key " + id); } if (res.size() > 1) { throw new NonUniqueResultException("Inconsistent database! Multiple results for query by key for key " + id); } return res.get(0); } }
public static Node select_single(DbConn cnx, String query_key, Object... args) { List<Node> nn = select(cnx, query_key, args); if (nn.size() == 0) { throw new NoResultException("No node with this ID"); } if (nn.size() > 1) { throw new NonUniqueResultException("COnfiguration is broken: multiple nodes with the same ID"); } return nn.get(0); } }
public static JndiObjectResource select_alias(DbConn cnx, String alias) { List<JndiObjectResource> res = select(cnx, "jndi_select_by_key", alias); if (res.isEmpty()) { throw new NoResultException("no result for query by key for key " + alias); } if (res.size() > 1) { throw new NonUniqueResultException("Inconsistent database! Multiple results for query by key for key " + alias); } return res.get(0); } }
public static RUser selectlogin(DbConn cnx, String id) { List<RUser> res = select(cnx, "user_select_by_key", id); if (res.isEmpty()) { throw new NoResultException("no result for query by key for key " + id); } if (res.size() > 1) { throw new NonUniqueResultException("Inconsistent database! Multiple results for query by key for key " + id); } return res.get(0); } }
public static Node select_single(DbConn cnx, String query_key, Object... args) { List<Node> nn = select(cnx, query_key, args); if (nn.size() == 0) { throw new NoResultException("No node with this ID"); } if (nn.size() > 1) { throw new NonUniqueResultException("COnfiguration is broken: multiple nodes with the same ID"); } return nn.get(0); } }
throw new NonUniqueResultException("The query returned more than one row when one was expected");
private static GlobalParameterDto getGlobalParameter(DbConn cnx, String query_key, Object key) { ResultSet rs = cnx.runSelect(query_key, key); try { if (!rs.next()) { throw new NoResultException("The query returned zero rows when one was expected."); } GlobalParameterDto res = mapGlobalParameter(rs); if (rs.next()) { throw new NonUniqueResultException("The query returned more than one row when one was expected"); } rs.close(); return res; } catch (SQLException e) { throw new JqmAdminApiInternalException("An error occurred while querying the database", e); } }
throw new NonUniqueResultException("The query returned more than one row when one was expected");
private static GlobalParameterDto getGlobalParameter(DbConn cnx, String query_key, Object key) { ResultSet rs = cnx.runSelect(query_key, key); try { if (!rs.next()) { throw new NoResultException("The query returned zero rows when one was expected."); } GlobalParameterDto res = mapGlobalParameter(rs); if (rs.next()) { throw new NonUniqueResultException("The query returned more than one row when one was expected"); } rs.close(); return res; } catch (SQLException e) { throw new JqmAdminApiInternalException("An error occurred while querying the database", e); } }
throw new NonUniqueResultException("query was supposed to return a single row - multiple returned");
throw new NonUniqueResultException("query was supposed to return a single row - multiple returned");
throw new NonUniqueResultException("configuration issue: multiple nodes named " + nodeName);