private void loadPatientIdentifiers() {
    List<IdentifierType> types = PatientManager.getAllIdentifierTypes(getHSession());
    identiers = new ArrayList<PatientIdentifier>();
    typeLoop:
    for (IdentifierType type : types) {
      if (type.isVoided()) continue;

      for (PatientIdentifier identifier : localPatient.getPatientIdentifiers()) {
        if (identifier.getType().getId() == type.getId()) {
          identifier.setValueEdit(identifier.getValue());
          identiers.add(identifier);
          continue typeLoop;
        }
      }

      // create new identifier if the patient doesn't already have on for this type
      PatientIdentifier identifier = new PatientIdentifier();
      identifier.setType(type);
      identifier.setValueEdit(EMPTY);
      identifier.setPatient(localPatient);
      identiers.add(identifier);
    }

    tblViewer.setInput(identiers);
  }
  protected void cmdSaveSelected() {
    if (fieldsOk()) {
      Set<PatientIdentifier> patientIds = localPatient.getPatientIdentifiers();
      for (PatientIdentifier newId : identiers) {
        if (newId.getValueEdit() == null || newId.getValueEdit().isEmpty()) {
          if (newId.getId() != -1) {
            patientIds.remove(newId);
            changesMade = true;
          }
          continue;
        }

        if (newId.getId() == -1) {
          changesMade = true;
          patientIds.add(newId);
          newId.setValue(newId.getValueEdit());
          newId.setValueEdit(null);
          continue;
        }

        // check if an existing id was changed
        if (!newId.getValue().equals(newId.getValueEdit())) {
          changesMade = true;
          AlternatePatientIdentifier alt =
              new AlternatePatientIdentifier(
                  newId.getValue(), localPatient, new Date(), true, newId.getType());
          localPatient.getAlternateIdentifiers().add(alt);
          newId.setValue(newId.getValueEdit());
          newId.setValueEdit(null);
        }
      }

      localPatient.setPatientId(localPatient.getPreferredIdentifier().getValue());
      cmdCloseSelected();
    }
  }
 @Override
 protected void setValue(Object element, Object value) {
   PatientIdentifier model = (PatientIdentifier) element;
   model.setValueEdit(((String) value).trim().toUpperCase());
   getViewer().update(element, null);
 }