SummaryThe Address validator plugin enables the validation of addresses entered by the user. It uses some third party services or APIs for that purpose. The initial implementation uses Google Geocoding API, but it can be extended to use different APIs. The Address validation is optional, this means users can choose not use it and they can store invalid addresses.
Additionally, if the API returns data about latitude and longitude for a valid address, those values will be stored in the system as custom fields attached to the address.
This plugin consist of a portlet, a service and a hook to modify some Liferay elements.
The Address validator portlet presents a list of valid addresses by using the AddressProcessingTools service. That service uses the selected API for validation. The list of matching addresses depends of the completeness of data entered by user and the invoked API.
Besides, some custom fields attached to an address are created by an startup event, and with an address model listener, when users store an address, the validation is applied again to the final address and if this one valid and it returns latitude and longitude data, such values will be stored in the related custom fields.
The Address validator is available in next Liferay features:
- Edit user's addresses
- Edit organization's addresses
- Portal settings, addresses
The installation steps are as follows:
- Obtain Address validator portlet application from the Liferay Marketplace.
- Deploy the app in your existing Liferay installation. If you haven’s installed Liferay, please download and follow the instructions to do so.
- When the application is installed the users will be able to see a "Validate Address" button in the list of features listed above.
The API to use for address validation can be set by using this property:
Currently the only API integrated is Google Geocoding API. So the default value for this property is:
rivetlogic.address.validation.api = google-geocoding
Once the plugin is installed, you can go, for example, to edit an user's addresses and you'll see a screen like this, with an additional "Validate Address" button:
If you fill at least one option of the form and then you click on "Validate Address" button, the plugin will ask to the defined API (in this case Google Geocoding) about possible valid addresses related to the fields you have provided.
Lets say for example you set just the "Street 1" field with the word "main" and then click on the validate button, the results will be shown on a popup window, like this:
The "view map" links will redirect you to a Google map pointing to the requested address, these links are required by Google if someone want to use the Geocoding API. For a different API, is possible these links are not present.
Finally, if you select one of the options, the available parts of the selected address will be mapped to the address form, and will be automatically written.
The latest source code is located at the following location:
We welcome feature/bug reports concerning the Address validator portlet. Discussion helps to clarify the ways the app can be used and also helps define directions for future development. Please post your concerns at http://issues.rivetlogic.com/browse/LRA
|1.0.0||Feb 28, 2014|
|1.0.1||Apr 3, 2014|
Fix: Following the standard for addresses we are now saving the street number first and then the street name.
|1.1.0||May 11, 2016||New feature: Help page.|