Exemplo n.º 1
0
 public HashMap<String, String> retrieveUserPreferenceList(
     Account account, List<SearchBoostField> fields) throws ControllerException {
   try {
     HashSet<String> values = new HashSet<>();
     for (SearchBoostField field : fields) {
       values.add("BOOST_" + field.name());
     }
     return dao.retrievePreferenceValues(account, values);
   } catch (DAOException de) {
     throw new ControllerException(de);
   }
 }
Exemplo n.º 2
0
  // really an update
  public boolean saveSetting(Account account, String key, String value) throws ControllerException {
    // check if a search boost setting. hack: expecting that search boosts will only use numeric
    // values TODO
    if (NumberUtils.isNumber(value)) {
      try {
        SearchBoostField boostField = SearchBoostField.valueOf(key.toUpperCase());
        if (boostField != null) {
          key = "BOOST_" + boostField.name();
        }
      } catch (Exception e) {
        Logger.debug(e.getMessage());
      }
    }

    try {
      return dao.saveOrUpdatePreference(account, key, value) != null;
    } catch (DAOException e) {
      throw new ControllerException(e);
    }
  }