Search in sources :

Example 1 with SmartyStreet

use of gov.ca.cwds.rest.validation.SmartyStreet in project API by ca-cwds.

the class AddressValidationService method fetchValidatedAddresses.

/**
   * Returns all valid addresses, up to the default number set in {@link SmartyStreetsDao}
   * 
   * @param address The address to validate
   * @return array of {@link ValidatedAddress}
   * @throws ServiceException due to SmartyStreets error, I/O error, etc.
   */
public ValidatedAddress[] fetchValidatedAddresses(Address address) throws ServiceException {
    ValidatedAddress[] addresses = null;
    try {
        SmartyStreet smartyStreet = new SmartyStreet(smartyStreetsDao);
        addresses = smartyStreet.usStreetSingleAddress(address.getStreetAddress(), address.getCity(), address.getState(), address.getZip());
    } catch (Exception e) {
        throw new ServiceException("ERROR calling usStreetSingleAddress in SmartyStreet", e);
    }
    return addresses;
}
Also used : SmartyStreet(gov.ca.cwds.rest.validation.SmartyStreet) ValidatedAddress(gov.ca.cwds.rest.api.domain.ValidatedAddress) NotImplementedException(org.apache.commons.lang3.NotImplementedException)

Aggregations

ValidatedAddress (gov.ca.cwds.rest.api.domain.ValidatedAddress)1 SmartyStreet (gov.ca.cwds.rest.validation.SmartyStreet)1 NotImplementedException (org.apache.commons.lang3.NotImplementedException)1