Interface LocationService<T extends Location>

  • Type Parameters:
    T - the Location (sub)type
    All Known Implementing Classes:
    DefaultLocationService

    public interface LocationService<T extends Location>
    Handles CRUD operations of Location. It is able to return Locations in the proximity of the given GPS that are sorted in terms of distances.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean deleteLocation​(T location)
      Delete the given IAddress from the collection of stored addresses
      T 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
      T getLocationByName​(java.lang.String name)
      Returns persisted Location by name
      java.util.List<T> 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<T> 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<T> 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<T> 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<T> 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<T> 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
      java.util.List<T> getSortedLocationsNearby​(GPS gps, double distance, BaseStoreModel baseStore)
      Returns list of sorted DistanceAwareLocations.
      boolean saveOrUpdateLocation​(T location)
      Adds a new address or update existing one
    • Method Detail

      • getLocationsNearby

        java.util.List<T> 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
        Parameters:
        gps - GPS coordinates
        distance - in kilometers
        Returns:
        List of addresses
      • getLocationsNearby

        java.util.List<T> 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
        Parameters:
        gps - GPS coordinates
        distance - in kilometers
        baseStore - base store
        Returns:
        List of addresses
      • saveOrUpdateLocation

        boolean saveOrUpdateLocation​(T location)
        Adds a new address or update existing one
        Parameters:
        location - GPS coordinates
        Returns:
        true if operation was successful
      • deleteLocation

        boolean deleteLocation​(T location)
        Delete the given IAddress from the collection of stored addresses
        Parameters:
        location - GPS coordinates
        Returns:
        true if address was deleted
      • getLocationByName

        T getLocationByName​(java.lang.String name)
        Returns persisted Location by name
        Parameters:
        name - name of location
        Returns:
        Location matched by unique name
      • getLocation

        T 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
        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
      • getLocationsForPoint

        java.util.List<T> 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. Use when you have got defined coordinates and need only sorted locations nearby, without any map.
        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
      • getLocationsForSearch

        java.util.List<T> 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. Basically it combines two other methods that retrieves locations for town name and postal code.
        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
      • getLocationsForPostcode

        java.util.List<T> 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. Number of returned locations is adequate to user definition. Use when you don't need any map, only list of sorted locations is enough.
        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

        java.util.List<T> getLocationsForTown​(java.lang.String town,
                                              int limitLocationsCount,
                                              BaseStoreModel baseStore)
        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.
        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
      • getSortedLocationsNearby

        java.util.List<T> getSortedLocationsNearby​(GPS gps,
                                                   double distance,
                                                   BaseStoreModel baseStore)
        Returns list of sorted DistanceAwareLocations. Sorting order is ascending - the closest locations come first.
        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