public List<DisplayField> getFieldValues() { ArrayList<DisplayField> list = new ArrayList<DisplayField>(); EmailFields emailFields = Config.getConfig().getEmailFields(); for (EmailField field : emailFields.getAvailableFields().values()) { if (field.getShowInResults() != EmailField.ShowInResults.NORESULTS) { try { EmailFieldValue efv = searchResult.getFieldValue(field.getName()); list.add(DisplayField.getDisplayField(efv, locale, false)); } catch (MessageSearchException mse) { logger.debug("failed to retrieve field value from message: " + mse.getMessage()); } } } return list; }
public static synchronized List<SearchResultBean> getSearchResultBeans( List<Search.Result> results, Locale locale) { List<SearchResultBean> searchResultBeans = new LinkedList<SearchResultBean>(); try { for (Search.Result result : results) { searchResultBeans.add(new SearchResultBean(result, locale)); } while (searchResultBeans.size() < Config.getConfig().getSearch().getMaxSearchResults()) { searchResultBeans.add(new SearchResultBean()); } } catch (java.util.ConcurrentModificationException ce) { // bit of a hack to say the least try { Thread.sleep(50); } catch (Exception e) { } return getSearchResultBeans(results, locale); } return searchResultBeans; }