public PersonName getPersonName() { // normally the DAO layer returns these in the correct order, i.e. preferred and non-voided // first, but it's possible that someone // has fetched a Person, changed their names around, and then calls this method, so we have to // be careful. if (getNames() != null && getNames().size() > 0) { for (PersonName name : getNames()) { if (name.isPreferred() && !name.isVoided()) return name; } for (PersonName name : getNames()) { if (!name.isVoided()) return name; } return null; } return null; }