예제 #1
0
 public List<Person> findLinkedPersons(Person person) {
   List<Person> linkedPersons = new ArrayList<Person>();
   if (person == null) {
     return linkedPersons;
   }
   List<PersonLink> links = personLinkDao.getPersonLinks(person);
   for (PersonLink link : links) {
     if (person.getPersonId().equals(link.getPersonLeft().getPersonId())) {
       linkedPersons.add(link.getPersonRight());
     } else {
       linkedPersons.add(link.getPersonLeft());
     }
   }
   return linkedPersons;
 }
예제 #2
0
  public List<Person> findLinkedPersons(PersonIdentifier identifier) {
    ValidationService validationService = Context.getValidationService();
    validationService.validate(identifier);

    List<Person> linkedPersons = new ArrayList<Person>();
    Person person = personDao.getPersonById(identifier);
    if (person == null) {
      return linkedPersons;
    }
    List<PersonLink> links = personLinkDao.getPersonLinks(person);
    for (PersonLink link : links) {
      if (person.getPersonId().equals(link.getPersonLeft().getPersonId())) {
        linkedPersons.add(link.getPersonRight());
      } else {
        linkedPersons.add(link.getPersonLeft());
      }
    }
    return linkedPersons;
  }