Class GoogleMapTools
- java.lang.Object
-
- de.hybris.platform.storelocator.impl.GoogleMapTools
-
public class GoogleMapTools extends java.lang.ObjectSpring Bean performing the geo-location HTTP requests towards Google Maps Service.
-
-
Constructor Summary
Constructors Constructor Description GoogleMapTools()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.StringappendBusinessParams(java.lang.String urlAddress)Appends business user parameters client and signature.GPSgeocodeAddress(AddressData addressData)geo-codes the given address dataGPSgeocodeAddress(Location address)geo-codes the given location.protected org.springframework.web.client.ResponseExtractor<MapLocationData>getAddressLocationParser()protected java.lang.StringgetBaseUrl()protected java.lang.StringgetCliendId()protected java.lang.StringgetCryptoKey()protected GeolocationDirectionsUrlBuildergetDirectionsUrlBuilder()RouteDatagetDistanceAndRoute(GPS start, GPS destination)creates Distance and Route for the given start/destination GPSRouteDatagetDistanceAndRoute(Location start, Location destination)creates Distance and Route for the given start/destination locationsprotected java.lang.StringgetGoogleKey()java.lang.StringgetGoogleQuery(AddressData addressData)protected RouteDatagetRouteData(java.lang.String urlAddress)protected org.springframework.web.client.ResponseExtractor<RouteData>getRouteDataParser()protected booleanisBusinessAPI()voidsetAddressLocationParser(org.springframework.web.client.ResponseExtractor<MapLocationData> addressLocationParser)voidsetBaseUrl(java.lang.String baseUrl)voidsetCliendId(java.lang.String cliendId)voidsetCryptoKey(java.lang.String signature)voidsetDirectionsUrlBuilder(GeolocationDirectionsUrlBuilder directionsUrlBuilder)voidsetGoogleKey(java.lang.String googleKey)voidsetRouteDataParser(org.springframework.web.client.ResponseExtractor<RouteData> routeDataParser)protected java.net.URIsingAndEncodeURL(java.lang.String urlAddress)Encodes URL query, generates signature and appends it to the query.
-
-
-
Method Detail
-
getGoogleQuery
public java.lang.String getGoogleQuery(AddressData addressData)
-
geocodeAddress
public GPS geocodeAddress(Location address)
geo-codes the given location.- Parameters:
address- the address to geocode- Returns:
- the GPS of the given address
- Throws:
GeoServiceWrapperException
-
getDistanceAndRoute
public RouteData getDistanceAndRoute(Location start, Location destination)
creates Distance and Route for the given start/destination locations- Parameters:
start- the start locationdestination- the destination location- Returns:
- the calculated RouteData for the given locations
- Throws:
GeoServiceWrapperException
-
getDistanceAndRoute
public RouteData getDistanceAndRoute(GPS start, GPS destination)
creates Distance and Route for the given start/destination GPS- Parameters:
start- the start GPSdestination- the destination GPS- Returns:
- the calculated RouteData for the given GPS'
- Throws:
GeoServiceWrapperException
-
getRouteData
protected RouteData getRouteData(java.lang.String urlAddress)
-
geocodeAddress
public GPS geocodeAddress(AddressData addressData)
geo-codes the given address data- Parameters:
addressData- the address to geocode- Returns:
- the calculated GPS
- Throws:
GeoServiceWrapperException
-
appendBusinessParams
protected java.lang.String appendBusinessParams(java.lang.String urlAddress)
Appends business user parameters client and signature. Example URL after appending http://maps.googleapis.com/maps/api/geocode/xml ?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA &client=gme-YOUR_CLIENT_ID &signature=YOUR_URL_SIGNATURE- Parameters:
urlAddress-- Returns:
- url with client id and signature
-
singAndEncodeURL
protected java.net.URI singAndEncodeURL(java.lang.String urlAddress)
Encodes URL query, generates signature and appends it to the query. Return URI to avoid second encoding- Parameters:
urlAddress-- Returns:
- URI
-
isBusinessAPI
protected boolean isBusinessAPI()
-
setAddressLocationParser
public void setAddressLocationParser(org.springframework.web.client.ResponseExtractor<MapLocationData> addressLocationParser)
-
getAddressLocationParser
protected org.springframework.web.client.ResponseExtractor<MapLocationData> getAddressLocationParser()
-
setRouteDataParser
public void setRouteDataParser(org.springframework.web.client.ResponseExtractor<RouteData> routeDataParser)
-
getRouteDataParser
protected org.springframework.web.client.ResponseExtractor<RouteData> getRouteDataParser()
-
setBaseUrl
public void setBaseUrl(java.lang.String baseUrl)
-
getBaseUrl
protected java.lang.String getBaseUrl()
-
setGoogleKey
public void setGoogleKey(java.lang.String googleKey)
-
getGoogleKey
protected java.lang.String getGoogleKey()
-
setDirectionsUrlBuilder
public void setDirectionsUrlBuilder(GeolocationDirectionsUrlBuilder directionsUrlBuilder)
-
getDirectionsUrlBuilder
protected GeolocationDirectionsUrlBuilder getDirectionsUrlBuilder()
-
setCliendId
public void setCliendId(java.lang.String cliendId)
-
getCliendId
protected java.lang.String getCliendId()
-
setCryptoKey
public void setCryptoKey(java.lang.String signature)
-
getCryptoKey
protected java.lang.String getCryptoKey()
-
-