public boolean checkForSelectedContactAdministratorTypeCode(AwardUnitContact newContact) {
    AwardUnitContact awardUnitContact = (AwardUnitContact) newContact;
    boolean valid = awardUnitContact.getUnitAdministratorTypeCode() != null;

    if (!valid) {
      GlobalVariables.getMessageMap()
          .putError(AWARD_UNIT_CONTACT_LIST_ERROR_KEY, ERROR_AWARD_CONTACT_ROLE_REQUIRED);
    }

    return valid;
  }
  private boolean checkForSelectedPerson(AwardUnitContact newContact) {
    boolean valid = true;

    if (StringUtils.isBlank(newContact.getPersonId())) {
      if (StringUtils.isBlank(newContact.getFullName())) {
        GlobalVariables.getMessageMap()
            .putError(PERSON_ERROR_KEY, KeyConstants.ERROR_MISSING_UNITCONTACT_PERSON);
      } else {
        GlobalVariables.getMessageMap()
            .putError(PERSON_ERROR_KEY, KeyConstants.ERROR_INVALID_UNITCONTACT_PERSON);
      }
      valid = false;
    }

    return valid;
  }
  boolean checkForDuplicatePerson(Award award, AwardUnitContact newUnitContact) {
    boolean valid = true;
    for (AwardUnitContact unitContact : award.getAwardUnitContacts()) {
      // equal, but not both are null
      valid =
          !(StringUtils.equals(unitContact.getPersonId(), newUnitContact.getPersonId())
              && StringUtils.equals(
                  unitContact.getUnitAdministratorTypeCode(),
                  newUnitContact.getUnitAdministratorTypeCode()));
      if (!valid) {
        registerError(newUnitContact);
        break;
      }
    }

    return valid;
  }
 private void registerError(AwardUnitContact newUnitContact) {
   String roleDescription = getRoleDescription(newUnitContact);
   GlobalVariables.getMessageMap()
       .putError(
           PERSON_ERROR_KEY,
           ERROR_AWARD_UNIT_CONTACT_EXISTS,
           newUnitContact.getContact().getFullName(),
           roleDescription);
 }
 private String getRoleDescription(AwardUnitContact newUnitContact) {
   String roleDescription = "";
   BusinessObjectService boService = KcServiceLocator.getService(BusinessObjectService.class);
   UnitAdministratorType aType =
       boService.findBySinglePrimaryKey(
           UnitAdministratorType.class, newUnitContact.getUnitAdministratorTypeCode());
   if (aType != null) {
     roleDescription = aType.getDescription();
   }
   return roleDescription;
 }