Пример #1
0
  public PersonIdentifier getGlobalIdentifierById(PersonIdentifier personIdentifier) {

    ValidationService validationService = Context.getValidationService();
    validationService.validate(personIdentifier);

    GlobalIdentifier globalIdentifier = Context.getConfiguration().getGlobalIdentifier();
    if (!globalIdentifier.isAssignGlobalIdentifier()) {
      log.warn("The system is not configured to assign global identifiers.");
      return null;
    }

    IdentifierDomain globalDomain = globalIdentifier.getIdentifierDomain();
    // Check to see if the person already has a global identifier
    Person person = personDao.getPersonById(personIdentifier);
    if (person != null) {
      for (PersonIdentifier identifier : person.getPersonIdentifiers()) {
        IdentifierDomain identifierDomain = identifier.getIdentifierDomain();
        if (identifierDomain != null && identifierDomain.equals(globalDomain)) {
          if (log.isTraceEnabled()) {
            log.trace("Person has a global identifier assigned: " + identifier);
          }
          return identifier;
        }
      }
    }
    return null;
  }
Пример #2
0
  public Person findPersonById(PersonIdentifier personIdentifier) {

    ValidationService validationService = Context.getValidationService();
    validationService.validate(personIdentifier);

    return personDao.getPersonById(personIdentifier);
  }
Пример #3
0
  public List<IdentifierDomainAttribute> getIdentifierDomainAttributes(
      IdentifierDomain identifierDomain) {

    ValidationService validationService = Context.getValidationService();
    validationService.validate(identifierDomain);

    return personDao.getIdentifierDomainAttributes(identifierDomain);
  }
Пример #4
0
  public List<Person> findPersonsById(PersonIdentifier personIdentifier) {

    ValidationService validationService = Context.getValidationService();
    validationService.validate(personIdentifier);

    List<Person> persons = personDao.getPersonsByIdentifier(personIdentifier);
    return persons;
  }
Пример #5
0
  public IdentifierDomainAttribute getIdentifierDomainAttribute(
      IdentifierDomain identifierDomain, String attributeName) {

    ValidationService validationService = Context.getValidationService();
    validationService.validate(identifierDomain);

    return personDao.getIdentifierDomainAttribute(identifierDomain, attributeName);
  }
Пример #6
0
  public IdentifierDomain findIdentifierDomainByName(String identifierDomainName) {
    ValidationService validationService = Context.getValidationService();
    validationService.validate(identifierDomainName);

    if (identifierDomainName == null || identifierDomainName.length() == 0) {
      return null;
    }
    return personDao.findIdentifierDomainByName(identifierDomainName);
  }
Пример #7
0
  public IdentifierDomain findIdentifierDomain(IdentifierDomain identifierDomain) {
    ValidationService validationService = Context.getValidationService();
    validationService.validate(identifierDomain);

    if (identifierDomain == null
        || (identifierDomain.getIdentifierDomainId() == null
            && identifierDomain.getNamespaceIdentifier() == null
            && (identifierDomain.getUniversalIdentifier() == null
                || identifierDomain.getUniversalIdentifierTypeCode() == null))) {
      return null;
    }
    return super.findIdentifierDomain(identifierDomain);
  }
Пример #8
0
  public List<Person> findPersonsByAttributes(Person person) {
    ValidationService validationService = Context.getValidationService();
    validationService.validate(person);

    Record record = new Record(person);
    Criteria criteria = ConvertUtil.buildCriteriaFromProperties(record);
    ConvertUtil.addIndirectCriteria(person, criteria);
    List<Person> persons;
    if (person.getPersonIdentifiers() != null && person.getPersonIdentifiers().size() > 0) {
      persons = personDao.getPersons(criteria, person.getPersonIdentifiers());
    } else {
      persons = personDao.getPersons(criteria);
    }
    return persons;
  }
Пример #9
0
  public List<Person> findMatchingPersonsByAttributes(Person person) {
    ValidationService validationService = Context.getValidationService();
    validationService.validate(person);

    populateCustomFields(person);
    Record record = ConvertUtil.getRecordFromPerson(person);
    MatchingService matchingService = Context.getMatchingService();
    List<Person> persons = new java.util.ArrayList<Person>();
    try {
      Set<RecordPair> links = matchingService.match(record);
      for (RecordPair recordPair : links) {
        Person personLinked = (Person) recordPair.getRightRecord().getObject();
        persons.add(personDao.loadPerson(personLinked.getPersonId()));
      }
    } catch (ApplicationException e) {
      log.warn("While searching for matching persons, the system encountered an issue: " + e, e);
    }
    return persons;
  }
Пример #10
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;
  }