Exemplo n.º 1
0
 public void process(org.atlasapi.remotesite.pa.profiles.bindings.Person paPerson) {
   Person person = ingestPerson(paPerson);
   Optional<Person> existing = personResolver.person(person.getCanonicalUri());
   if (!existing.isPresent()) {
     personWriter.createOrUpdatePerson(person);
   } else {
     merge(existing.get(), person);
     personWriter.createOrUpdatePerson(existing.get());
   }
 }
Exemplo n.º 2
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;
  }
Exemplo n.º 3
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());
 }
Exemplo n.º 4
0
 /**
  * PA People are ingested separately from PA biogs people. Therefore we set a direct equivalence
  * on the PA person if they exist. In the future this will change to an equivalence job so the
  * equivalence will be asserted at a later stage even if the PA person doesn't exist at the time
  * when the PA biog person is ingested.
  *
  * @param person
  */
 private void setDirectEquivalentToPAPerson(Person person, String id) {
   Optional<Person> paPerson = personResolver.person(PA_PERSON_URI_PREFIX + id);
   if (paPerson.isPresent()) {
     person.setEquivalentTo(ImmutableSet.of(LookupRef.from(paPerson.get())));
   }
 }