public class DefaultLocationService extends java.lang.Object implements LocationService
| Constructor and Description |
|---|
DefaultLocationService() |
| Modifier and Type | Method and Description |
|---|---|
protected double |
calculateDistance(GPS referenceGps,
PointOfServiceModel posModel) |
boolean |
deleteLocation(Location location)
Delete the given IAddress from the collection of stored addresses
|
protected CommonI18NService |
getCommonI18NService() |
protected GeoWebServiceWrapper |
getGeoServiceWrapper() |
Location |
getLocation(java.lang.String streetName,
java.lang.String streetNumber,
java.lang.String postalCode,
java.lang.String town,
java.lang.String countryCode,
boolean geocode)
Get temporary, non-persisted location
|
Location |
getLocationByName(java.lang.String name)
Returns persisted Location by name
|
protected LocationMapService |
getLocationMapService() |
java.util.List<Location> |
getLocationsForPoint(GPS gps,
int limitLocationsCount,
BaseStoreModel baseStore)
Method returns the nearest locations (points of interest) to the given coordinates, in the number adequate to user
definition.
|
java.util.List<Location> |
getLocationsForPostcode(java.lang.String postalCode,
java.lang.String countryCode,
int limitLocationsCount,
BaseStoreModel baseStore)
Method looks for nearest locations (points of interest) to the place defined by postal code and country.
|
java.util.List<Location> |
getLocationsForSearch(java.lang.String searchTerm,
java.lang.String countryCode,
int limitLocationsCount,
BaseStoreModel baseStore)
Method looks for nearby locations (points of interest) in the place defined by search term (that can be postal
code or town name) and country.
|
java.util.List<Location> |
getLocationsForTown(java.lang.String town,
int limitLocationsCount,
BaseStoreModel baseStore)
Method looks for nearest locations (points of interest) to the place defined by city name.
|
java.util.List<Location> |
getLocationsNearby(GPS gps,
double distance)
Get all known addresses which are located in the circle centered in the given gps location and a given radius
|
java.util.List<Location> |
getLocationsNearby(GPS gps,
double distance,
BaseStoreModel baseStore)
Get all known addresses which are located in the circle centered in the given gps location and a given radius,
which belong to a given store
|
protected MapService |
getMapService() |
protected ModelService |
getModelService() |
protected PointOfServiceDao |
getPointOfServiceDao() |
java.util.List<DistanceAwareLocation> |
getSortedLocationsNearby(GPS gps,
double distance,
BaseStoreModel baseStore)
Returns list of sorted
DistanceAwareLocations. |
boolean |
saveOrUpdateLocation(Location location)
Adds a new address or update existing one
|
void |
setCommonI18NService(CommonI18NService commonI18NService) |
void |
setGeoServiceWrapper(GeoWebServiceWrapper geoServiceWrapper) |
void |
setLocationMapService(LocationMapService locationMapService) |
void |
setMapService(MapService mapService) |
void |
setModelService(ModelService modelService) |
void |
setPointOfServiceDao(PointOfServiceDao pointOfServiceDao) |
protected void |
validateInputData(java.lang.Object input,
java.lang.String message)
Validation for input parameters.
|
public boolean deleteLocation(Location location)
LocationServicedeleteLocation in interface LocationServicelocation - GPS coordinatespublic java.util.List<Location> getLocationsNearby(GPS gps, double distance)
LocationServicegetLocationsNearby in interface LocationServicegps - GPS coordinatesdistance - in kilometerspublic java.util.List<Location> getLocationsNearby(GPS gps, double distance, BaseStoreModel baseStore)
LocationServicegetLocationsNearby in interface LocationServicegps - GPS coordinatesdistance - in kilometersbaseStore - base storepublic java.util.List<DistanceAwareLocation> getSortedLocationsNearby(GPS gps, double distance, BaseStoreModel baseStore)
LocationServiceDistanceAwareLocations. Sorting order is ascending - the closest locations come
first.getSortedLocationsNearby in interface LocationServicegps - - reference location. Center.distance - - radius in [km]. The returned locations are contained in the square that the circle describes.baseStore - - if set, method will return locations bound to the given BaseStoreModelprotected double calculateDistance(GPS referenceGps, PointOfServiceModel posModel)
public boolean saveOrUpdateLocation(Location location)
LocationServicesaveOrUpdateLocation in interface LocationServicelocation - GPS coordinatespublic Location getLocationByName(java.lang.String name)
LocationServicegetLocationByName in interface LocationServicename - name of locationLocation matched by unique namepublic Location getLocation(java.lang.String streetName, java.lang.String streetNumber, java.lang.String postalCode, java.lang.String town, java.lang.String countryCode, boolean geocode)
LocationServicegetLocation in interface LocationServicestreetName - street namestreetNumber - street numberpostalCode - postal codetown - name of towncountryCode - country codegeocode - - set to true if return Location should have GPS data populatedLocationpublic java.util.List<Location> getLocationsForPostcode(java.lang.String postalCode, java.lang.String countryCode, int limitLocationsCount, BaseStoreModel baseStore)
LocationServicegetLocationsForPostcode in interface LocationServicepostalCode - searching condition for locations - postal codecountryCode - searching condition for locations - country codelimitLocationsCount - number of locations to returnbaseStore - if set, method will return locations bound to the given BaseStoreModelpublic java.util.List<Location> getLocationsForTown(java.lang.String town, int limitLocationsCount, BaseStoreModel baseStore)
LocationServicegetLocationsForTown in interface LocationServicetown - searching condition for locationslimitLocationsCount - number of locations to returnbaseStore - if set, method will return locations bound to the given BaseStoreModelpublic java.util.List<Location> getLocationsForSearch(java.lang.String searchTerm, java.lang.String countryCode, int limitLocationsCount, BaseStoreModel baseStore)
LocationServicegetLocationsForSearch in interface LocationServicesearchTerm - the search term - can be postal code or town namecountryCode - the country code - country code to look for (valid if given value is postal code)limitLocationsCount - number of locations to returnbaseStore - if set, method will return locations bound to the given BaseStoreModelpublic java.util.List<Location> getLocationsForPoint(GPS gps, int limitLocationsCount, BaseStoreModel baseStore)
LocationServicegetLocationsForPoint in interface LocationServicegps - coordinates of center pointlimitLocationsCount - number of POIs chosen by userbaseStore - if set, method will return locations bound to the given BaseStoreModelprotected void validateInputData(java.lang.Object input,
java.lang.String message)
input - parameter to validatemessage - message to be thrownprotected MapService getMapService()
public void setMapService(MapService mapService)
protected LocationMapService getLocationMapService()
public void setLocationMapService(LocationMapService locationMapService)
protected ModelService getModelService()
public void setModelService(ModelService modelService)
protected GeoWebServiceWrapper getGeoServiceWrapper()
public void setGeoServiceWrapper(GeoWebServiceWrapper geoServiceWrapper)
protected CommonI18NService getCommonI18NService()
public void setCommonI18NService(CommonI18NService commonI18NService)
protected PointOfServiceDao getPointOfServiceDao()
public void setPointOfServiceDao(PointOfServiceDao pointOfServiceDao)
Copyright © 2018 SAP SE. All Rights Reserved.