Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The Person Update service of the Entity Registry accepts incoming attributes, attempts to resolve a Person based on those attributes, and modify the found Person's attributes using the information given.

Pseudocode

  function Registry.handleUpdate(incomingAttributes) {
  /* if the incoming attributes already contain a registry-assigned unique id, try to resolve the person, and fail if can't */
  if(incomingAttributes.contains(registry_assigned_unique_id) {
    var currentPerson = registry.getPerson(registry_assigned_unique_id);
    if(!currentPerson) {
      throw PersonNotFound_Exception;
    }
    currentPerson.replaceAttributes(incomingAttributes);
    return currentPerson;
  }
  
  /* otherwise we must run a search-match to find a matching person */
  else {
    var matches = PersonMatchService.findMatchesByAttributes(incomingAttributes);
    if(matches.size() == 1) {
      currentPerson = matches.getNext();
      currentPerson.replaceAttributes(incomingAttributes);
      return currentPerson;
      
    } else if(matches.size() > 1) {
      var matchResolutionTicket = MatchResolutionQueue.enqueue(new WorkItem(matches, incomingAttributes))
      return matchResolutionTicket;
      
    } else if(matches.isEmpty()) {
      var newPerson = createNewPerson(incomingAttributes)
    }
    
  }

}