private boolean isAgentEmpty(Agent agent){
  if (agent != null) {
    String first=agent.getFirstName();
    String last=agent.getLastName();
    String email=agent.getEmail();
    String home=agent.getHomepage();
    String org=agent.getOrganisation();
    String phone=agent.getPhone();
    String position=agent.getPosition();
    String city=null;
    String street=null;
    String country=null;
    String code=null;
    String province=null;
    Address address=agent.getAddress();
    if (address != null) {
      city=address.getCity();
      street=address.getAddress();
      country=address.getCountry();
      code=address.getPostalCode();
      province=address.getProvince();
    }
    String directory=null;
    String identifier=null;
    List<UserId> userIds=agent.getUserIds();
    if (!userIds.isEmpty()) {
      UserId userId=userIds.get(0);
      directory=userId.getDirectory();
      identifier=userId.getIdentifier();
    }
    return (Strings.isNullOrEmpty(city) && Strings.isNullOrEmpty(street) && Strings.isNullOrEmpty(country)&& Strings.isNullOrEmpty(code)&& Strings.isNullOrEmpty(province)&& Strings.isNullOrEmpty(first)&& Strings.isNullOrEmpty(last)&& Strings.isNullOrEmpty(email)&& Strings.isNullOrEmpty(home)&& Strings.isNullOrEmpty(org)&& Strings.isNullOrEmpty(phone)&& Strings.isNullOrEmpty(position)&& Strings.isNullOrEmpty(directory)&& Strings.isNullOrEmpty(identifier));
  }
  return true;
}

private boolean isAgentEmpty ( Agent agent ) { if ( agent != null ) { String first = agent . getFirstName ( ) ; String last = agent . getLastName ( ) ; String email = agent . getEmail ( ) ; String home = agent . getHomepage ( ) ; String org = agent . getOrganisation ( ) ; String phone = agent . getPhone ( ) ; String position = agent . getPosition ( ) ; String city = null ; String street = null ; String country = null ; String code = null ; String province = null ; Address address = agent . getAddress ( ) ; if ( address != null ) { city = address . getCity ( ) ; street = address . getAddress ( ) ; country = address . getCountry ( ) ; code = address . getPostalCode ( ) ; province = address . getProvince ( ) ; } String directory = null ; String identifier = null ; List < UserId > userIds = agent . getUserIds ( ) ; if ( ! userIds . isEmpty ( ) ) { UserId userId = userIds . get ( 0 ) ; directory = userId . getDirectory ( ) ; identifier = userId . getIdentifier ( ) ; } return ( Strings . isNullOrEmpty ( city ) && Strings . isNullOrEmpty ( street ) && Strings . isNullOrEmpty ( country ) && Strings . isNullOrEmpty ( code ) && Strings . isNullOrEmpty ( province ) && Strings . isNullOrEmpty ( first ) && Strings . isNullOrEmpty ( last ) && Strings . isNullOrEmpty ( email ) && Strings . isNullOrEmpty ( home ) && Strings . isNullOrEmpty ( org ) && Strings . isNullOrEmpty ( phone ) && Strings . isNullOrEmpty ( position ) && Strings . isNullOrEmpty ( directory ) && Strings . isNullOrEmpty ( identifier ) ) ; } return true ; }
determine if the agent is empty . in other words , the user hasn ' t entered any information for a single field yet .
