예제 #1
0
  private Person ingestPerson(org.atlasapi.remotesite.pa.profiles.bindings.Person paPerson) {
    Person person = new Person();
    person.setCanonicalUri(PERSON_URI_PREFIX + paPerson.getId());

    Name name = paPerson.getName();
    // First and Last name are optional in the dtd so check both are
    // non-null to avoid strange names.
    if (!Strings.isNullOrEmpty(name.getFirstname()) && !Strings.isNullOrEmpty(name.getLastname())) {
      person.withName(name.getFirstname() + " " + name.getLastname());
    }
    person.setGivenName(name.getFirstname());
    person.setFamilyName(name.getLastname());

    person.setGender(paPerson.getGender());
    if (paPerson.getBorn() != null) {
      person.setBirthDate(dateTimeFormatter.parseDateTime(paPerson.getBorn()));
    }
    person.setBirthPlace(paPerson.getBornIn());
    person.setDescription(paPerson.getEarlyLife() + "\n\n" + paPerson.getCareer());
    person.addQuote(paPerson.getQuote());
    person.setPublisher(Publisher.PA_PEOPLE);
    person.setImages(extractImages(paPerson.getPictures()));
    person.setImage(getPrimary(person.getImages()));
    setDirectEquivalentToPAPerson(person, paPerson.getId());
    return person;
  }
예제 #2
0
 private void merge(Person existing, Person newPerson) {
   existing.withName(newPerson.name());
   existing.setGivenName(newPerson.getGivenName());
   existing.setFamilyName(newPerson.getFamilyName());
   existing.setGender(newPerson.getGender());
   existing.setBirthDate(newPerson.getBirthDate());
   existing.setBirthPlace(newPerson.getBirthPlace());
   existing.setDescription(newPerson.getDescription());
   existing.setQuotes(newPerson.getQuotes());
   existing.setPublisher(Publisher.PA_PEOPLE);
   existing.setImages(newPerson.getImages());
   existing.setImage(newPerson.getImage());
 }