コード例 #1
0
  public boolean validateZipCode(Address address) throws BizServiceException {

    boolean validateZipCode = false;
    if (address.getZipcode() != null && address.getZipcode().toString().trim().length() == 5) {

      validateZipCode = true;
    } else if (address.getZipcode() != null
        && address.getZipcode().toString().trim().length() != 5) {
      throw new BizServiceException(TagDishConstant.IMPROPER_ZIP_CODE_LOCATION);
    }
    return validateZipCode;
  }
コード例 #2
0
  public boolean validateCityAndState(Address address) throws BizServiceException {

    boolean validateCityAndState = false;
    if (address.getCity() != null || address.getState() != null) {

      if (address.getCity() == null || address.getCity().trim().length() == 0) {
        throw new BizServiceException(TagDishConstant.IMPROPER_CITY_STATE_LOCATION);
      }
      if (address.getState() == null || address.getState().trim().length() == 0) {
        throw new BizServiceException(TagDishConstant.IMPROPER_CITY_STATE_LOCATION);
      }
    }

    if (address.getState() != null && address.getState().length() != 2) {
      throw new BizServiceException(TagDishConstant.IMPROPER_CITY_STATE_LOCATION);
    }
    validateCityAndState = true;
    return validateCityAndState;
  }