Class DefaultLocationService

java.lang.Object
de.hybris.platform.storelocator.location.impl.DefaultLocationService
All Implemented Interfaces:
LocationService

public class DefaultLocationService extends Object implements LocationService
Default implementation for LocationService.
  • Constructor Details

    • DefaultLocationService

      public DefaultLocationService()
  • Method Details

    • deleteLocation

      public boolean deleteLocation(Location location)
      Description copied from interface: LocationService
      Delete the given IAddress from the collection of stored addresses
      Specified by:
      deleteLocation in interface LocationService
      Parameters:
      location - GPS coordinates
      Returns:
      true if address was deleted
    • getLocationsNearby

      public List<Location> getLocationsNearby(GPS gps, double distance)
      Description copied from interface: LocationService
      Get all known addresses which are located in the circle centered in the given gps location and a given radius
      Specified by:
      getLocationsNearby in interface LocationService
      Parameters:
      gps - GPS coordinates
      distance - in kilometers
      Returns:
      List of addresses
    • getLocationsNearby

      public List<Location> getLocationsNearby(GPS gps, double distance, BaseStoreModel baseStore)
      Description copied from interface: LocationService
      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
      Specified by:
      getLocationsNearby in interface LocationService
      Parameters:
      gps - GPS coordinates
      distance - in kilometers
      baseStore - base store
      Returns:
      List of addresses
    • getSortedLocationsNearby

      public List<DistanceAwareLocation> getSortedLocationsNearby(GPS gps, double distance, BaseStoreModel baseStore)
      Description copied from interface: LocationService
      Returns list of sorted DistanceAwareLocations. Sorting order is ascending - the closest locations come first.
      Specified by:
      getSortedLocationsNearby in interface LocationService
      Parameters:
      gps - - 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 BaseStoreModel
      Returns:
      a sorted list of nearby locations
    • calculateDistance

      protected double calculateDistance(GPS referenceGps, PointOfServiceModel posModel)
    • saveOrUpdateLocation

      public boolean saveOrUpdateLocation(Location location)
      Description copied from interface: LocationService
      Adds a new address or update existing one
      Specified by:
      saveOrUpdateLocation in interface LocationService
      Parameters:
      location - GPS coordinates
      Returns:
      true if operation was successful
    • getLocationByName

      public Location getLocationByName(String name)
      Description copied from interface: LocationService
      Returns persisted Location by name
      Specified by:
      getLocationByName in interface LocationService
      Parameters:
      name - name of location
      Returns:
      Location matched by unique name
    • getLocation

      public Location getLocation(String streetName, String streetNumber, String postalCode, String town, String countryCode, boolean geocode)
      Description copied from interface: LocationService
      Get temporary, non-persisted location
      Specified by:
      getLocation in interface LocationService
      Parameters:
      streetName - street name
      streetNumber - street number
      postalCode - postal code
      town - name of town
      countryCode - country code
      geocode - - set to true if return Location should have GPS data populated
      Returns:
      Location
    • getLocationsForPostcode

      public List<Location> getLocationsForPostcode(String postalCode, String countryCode, int limitLocationsCount, BaseStoreModel baseStore)
      Description copied from interface: LocationService
      Method looks for nearest locations (points of interest) to the place defined by postal code and country. Number of returned locations is adequate to user definition. Use when you don't need any map, only list of sorted locations is enough.
      Specified by:
      getLocationsForPostcode in interface LocationService
      Parameters:
      postalCode - searching condition for locations - postal code
      countryCode - searching condition for locations - country code
      limitLocationsCount - number of locations to return
      baseStore - if set, method will return locations bound to the given BaseStoreModel
      Returns:
      list of found locations
    • getLocationsForTown

      public List<Location> getLocationsForTown(String town, int limitLocationsCount, BaseStoreModel baseStore)
      Description copied from interface: LocationService
      Method looks for nearest locations (points of interest) to the place defined by city name. Number of returned locations is adequate to user definition. Use when you don't need any map, only list of sorted locations is enough.
      Specified by:
      getLocationsForTown in interface LocationService
      Parameters:
      town - searching condition for locations
      limitLocationsCount - number of locations to return
      baseStore - if set, method will return locations bound to the given BaseStoreModel
      Returns:
      list of found locations
    • getLocationsForSearch

      public List<Location> getLocationsForSearch(String searchTerm, String countryCode, int limitLocationsCount, BaseStoreModel baseStore)
      Description copied from interface: LocationService
      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. Basically it combines two other methods that retrieves locations for town name and postal code.
      Specified by:
      getLocationsForSearch in interface LocationService
      Parameters:
      searchTerm - the search term - can be postal code or town name
      countryCode - the country code - country code to look for (valid if given value is postal code)
      limitLocationsCount - number of locations to return
      baseStore - if set, method will return locations bound to the given BaseStoreModel
      Returns:
      list of found locations
    • getLocationsForPoint

      public List<Location> getLocationsForPoint(GPS gps, int limitLocationsCount, BaseStoreModel baseStore)
      Description copied from interface: LocationService
      Method returns the nearest locations (points of interest) to the given coordinates, in the number adequate to user definition. Use when you have got defined coordinates and need only sorted locations nearby, without any map.
      Specified by:
      getLocationsForPoint in interface LocationService
      Parameters:
      gps - coordinates of center point
      limitLocationsCount - number of POIs chosen by user
      baseStore - if set, method will return locations bound to the given BaseStoreModel
      Returns:
      list of proper Locations
    • validateInputData

      protected void validateInputData(Object input, String message)
      Validation for input parameters.
      Parameters:
      input - parameter to validate
      message - message to be thrown
    • getMapService

      protected MapService getMapService()
    • setMapService

      public void setMapService(MapService mapService)
    • getLocationMapService

      protected LocationMapService getLocationMapService()
    • setLocationMapService

      public void setLocationMapService(LocationMapService locationMapService)
    • getModelService

      protected ModelService getModelService()
    • setModelService

      public void setModelService(ModelService modelService)
    • getGeoServiceWrapper

      protected GeoWebServiceWrapper getGeoServiceWrapper()
    • setGeoServiceWrapper

      public void setGeoServiceWrapper(GeoWebServiceWrapper geoServiceWrapper)
    • getCommonI18NService

      protected CommonI18NService getCommonI18NService()
    • setCommonI18NService

      public void setCommonI18NService(CommonI18NService commonI18NService)
    • getPointOfServiceDao

      protected PointOfServiceDao getPointOfServiceDao()
    • setPointOfServiceDao

      public void setPointOfServiceDao(PointOfServiceDao pointOfServiceDao)