/**
   * @return
   * @throws SQLException
   */
  public HashMap<TestType, QoSTestTypeDesc> getAllToMap() throws SQLException {
    HashMap<TestType, QoSTestTypeDesc> resultMap = new HashMap<>();
    try (PreparedStatement psGetAll =
        conn.prepareStatement(
            "SELECT nnttd.uid AS uid, test, nntd.\"value\", nntd.lang, nntd2.\"value\" AS value_name, nntd2.lang AS name_lang "
                + " FROM qos_test_type_desc AS nnttd "
                + " JOIN qos_test_desc nntd ON nnttd.test_desc = nntd.desc_key "
                + " JOIN qos_test_desc nntd2 ON nnttd.test_name = nntd2.desc_key"
                + " WHERE nntd.lang = ("
                + "	CASE WHEN EXISTS(SELECT 1 FROM qos_test_desc WHERE desc_key = nntd.desc_key AND lang = ?) "
                + " 	THEN ? ELSE 'en' END)"
                + " AND nntd2.lang = ("
                + "	CASE WHEN EXISTS(SELECT 1 FROM qos_test_desc WHERE desc_key = nntd2.desc_key AND lang = ?) "
                + " 	THEN ? ELSE 'en' END)")) {
      psGetAll.setString(1, locale.getLanguage());
      psGetAll.setString(2, locale.getLanguage());
      psGetAll.setString(3, locale.getLanguage());
      psGetAll.setString(4, locale.getLanguage());

      if (psGetAll.execute()) {
        try (ResultSet rs = psGetAll.getResultSet()) {
          while (rs.next()) {
            QoSTestTypeDesc item = instantiateItem(rs);
            resultMap.put(item.getTestType(), item);
          }
          return resultMap;
        }
      } else {
        throw new SQLException("no result set");
      }
    }
  }
  /**
   * @param rs
   * @return
   * @throws SQLException
   */
  private static QoSTestTypeDesc instantiateItem(ResultSet rs) throws SQLException {
    QoSTestTypeDesc result = new QoSTestTypeDesc();

    result.setUid(rs.getLong("uid"));
    result.setDescription(rs.getString("value"));
    result.setName(rs.getString("value_name"));
    try {
      result.setTestType(TestType.valueOf(rs.getString("test").toUpperCase(Locale.US)));
    } catch (Exception e) {
      result.setTestType(null);
    }

    return result;
  }