public static String getClosest(Locale locale, OrganisaatioDTO org) { String lang = locale != null && locale.getLanguage() != null ? locale.getLanguage().toLowerCase() : ""; if (org.getNimi() == null) { return ""; } for (Teksti curTeksti : org.getNimi().getTeksti()) { if (curTeksti.getKieliKoodi().equals(lang)) { return curTeksti.getValue(); } } return getAvailableName(org); }