Ejemplo n.º 1
0
  /**
   * This handles a 3 part name
   *
   * @param nameParts
   * @return
   */
  private PersonNameAuthority maxThreePartNameSplit(String[] fullNameParts) {
    PersonName personName = new PersonName();
    PersonNameAuthority nameAuthority = new PersonNameAuthority(personName);
    int size = fullNameParts.length;

    if (size >= 1) {
      personName.setSurname(fullNameParts[0].trim());
    }
    if (size >= 2) {
      String firstNameParts = fullNameParts[1].trim();
      if (firstNameParts.indexOf("(") == -1) {
        secondPartWithoutParens(personName, fullNameParts[1].trim());
      } else {
        secondPartWithParens(personName, fullNameParts[1].trim());
      }
    }
    if (size >= 3) {
      int birthYear = getBirthYear(fullNameParts[2]);
      if (birthYear > 0) {
        nameAuthority.addBirthDate(birthYear);
      }

      int deathYear = getDeathYear(fullNameParts[2]);
      if (deathYear > 0) {
        nameAuthority.addDeathDate(deathYear);
      }
    }

    return nameAuthority;
  }
Ejemplo n.º 2
0
  /**
   * Handles a name that has four parts.
   *
   * @param fullNameParts
   * @return
   */
  private PersonNameAuthority fourPartNameSplit(String[] fullNameParts) {
    PersonName personName = new PersonName();
    PersonNameAuthority nameAuthority = new PersonNameAuthority(personName);

    // set the last name
    personName.setSurname(fullNameParts[0].trim());

    // take care of last/middle name
    String firstNameParts = fullNameParts[1].trim();
    if (firstNameParts.indexOf("(") == -1) {
      secondPartWithoutParens(personName, fullNameParts[1].trim());
    } else {
      secondPartWithParens(personName, fullNameParts[1].trim());
    }

    String title = fullNameParts[2];
    personName.addPersonNameTitle(title);

    int birthYear = getBirthYear(fullNameParts[3]);
    if (birthYear > 0) {
      nameAuthority.addBirthDate(birthYear);
    }

    int deathYear = getDeathYear(fullNameParts[3]);
    if (deathYear > 0) {
      nameAuthority.addDeathDate(deathYear);
    }

    return nameAuthority;
  }