Class DefaultStoreFinderService<ITEM extends PointOfServiceDistanceData>
- java.lang.Object
-
- de.hybris.platform.commerceservices.storefinder.impl.DefaultStoreFinderService<ITEM>
-
- Type Parameters:
ITEM- distance to point of service
- All Implemented Interfaces:
StoreFinderService<ITEM,StoreFinderSearchPageData<ITEM>>
public class DefaultStoreFinderService<ITEM extends PointOfServiceDistanceData> extends java.lang.Object implements StoreFinderService<ITEM,StoreFinderSearchPageData<ITEM>>
Default implementation ofStoreFinderService
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDefaultStoreFinderService.Boundary<T>static classDefaultStoreFinderService.StoreFinderResultDataComparator
-
Constructor Summary
Constructors Constructor Description DefaultStoreFinderService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected DefaultStoreFinderService.Boundary<GeoPoint>calculateBounds(java.util.List<ITEM> results, GeoPoint centerPoint)protected doublecalculateDistance(GeoPoint centerPoint, PointOfServiceModel posModel)protected java.util.List<ITEM>calculateDistances(GeoPoint centerPoint, java.util.Collection<PointOfServiceModel> pointsOfService)protected PaginationDatacreatePagination(PageableData pageableData, long totalNumberOfResults)protected PaginationDatacreatePaginationData()protected StoreFinderSearchPageData<ITEM>createSearchResult(java.lang.String locationText, GeoPoint centerPoint, java.util.List<ITEM> results, PaginationData paginationData)protected ITEMcreateStoreFinderResultData()protected StoreFinderSearchPageData<ITEM>createStoreFinderSearchPageData()protected StoreFinderSearchPageData<ITEM>doSearch(BaseStoreModel baseStore, java.lang.String locationText, GeoPoint centerPoint, PageableData pageableData, java.lang.Double maxRadiusKm)protected AddressDatagenerateGeoAddressForSearchQuery(BaseStoreModel baseStore, java.lang.String locationText)This method generates anAddressDataobject based on a search location text.StoreFinderSearchPageData<ITEM>getAllPos(BaseStoreModel baseStore, PageableData pageableData)Gets the locations retrieved basing on the given arguments.java.util.List<PointOfServiceModel>getAllPosForCountry(java.lang.String countryIsoCode, BaseStoreModel baseStore)Gets a list ofPointOfServiceModelfor all points of service in a given countryjava.util.List<PointOfServiceModel>getAllPosForRegion(java.lang.String countryIsoCode, java.lang.String regionIsoCode, BaseStoreModel baseStore)Gets a list ofPointOfServiceModelfor all points of service in a given country and regionprotected GeoWebServiceWrappergetGeoWebServiceWrapper()protected PointOfServiceDaogetPointOfServiceDao()ITEMgetPointOfServiceDistanceForName(BaseStoreModel baseStore, java.lang.String name, GeoPoint geoPoint)Gets the location for the given name that should be unique.PointOfServiceModelgetPointOfServiceForName(BaseStoreModel baseStore, java.lang.String name)Gets thePointOfServiceModelfor the given name that should be uniqueprotected GenericDao<PointOfServiceModel>getPointOfServiceGenericDao()protected PagedGenericDao<PointOfServiceModel>getPointOfServicePagedGenericDao()protected java.util.Collection<PointOfServiceModel>getPointsOfServiceNear(GeoPoint centerPoint, double radiusKm, BaseStoreModel baseStore)StoreFinderSearchPageData<ITEM>locationSearch(BaseStoreModel baseStore, java.lang.String locationText, PageableData pageableData)Gets the locations retrieved based on the given arguments.StoreFinderSearchPageData<ITEM>locationSearch(BaseStoreModel baseStore, java.lang.String locationText, PageableData pageableData, double maxRadiusKm)Gets the locations retrieved based on the given arguments.StoreFinderSearchPageData<ITEM>positionSearch(BaseStoreModel baseStore, GeoPoint geoPoint, PageableData pageableData)Gets the locations retrieved basing on the given arguments.StoreFinderSearchPageData<ITEM>positionSearch(BaseStoreModel baseStore, GeoPoint geoPoint, PageableData pageableData, double maxRadius)Gets the locations retrieved basing on the given arguments.protected DefaultStoreFinderService.Boundary<java.lang.Double>recalculateSpanAgainstCenter(double leftBorder, double rightBorder, double centerPosition)voidsetGeoWebServiceWrapper(GeoWebServiceWrapper geoWebServiceWrapper)voidsetPointOfServiceDao(PointOfServiceDao pointOfServiceDao)voidsetPointOfServiceGenericDao(GenericDao<PointOfServiceModel> pointOfServiceGenericDao)voidsetPointOfServicePagedGenericDao(PagedGenericDao<PointOfServiceModel> pointOfServicePagedGenericDao)
-
-
-
Method Detail
-
getPointOfServiceGenericDao
protected GenericDao<PointOfServiceModel> getPointOfServiceGenericDao()
-
setPointOfServiceGenericDao
public void setPointOfServiceGenericDao(GenericDao<PointOfServiceModel> pointOfServiceGenericDao)
-
getPointOfServiceDao
protected PointOfServiceDao getPointOfServiceDao()
-
setPointOfServiceDao
public void setPointOfServiceDao(PointOfServiceDao pointOfServiceDao)
-
getGeoWebServiceWrapper
protected GeoWebServiceWrapper getGeoWebServiceWrapper()
-
setGeoWebServiceWrapper
public void setGeoWebServiceWrapper(GeoWebServiceWrapper geoWebServiceWrapper)
-
getPointOfServicePagedGenericDao
protected PagedGenericDao<PointOfServiceModel> getPointOfServicePagedGenericDao()
-
setPointOfServicePagedGenericDao
public void setPointOfServicePagedGenericDao(PagedGenericDao<PointOfServiceModel> pointOfServicePagedGenericDao)
-
locationSearch
public StoreFinderSearchPageData<ITEM> locationSearch(BaseStoreModel baseStore, java.lang.String locationText, PageableData pageableData)
Description copied from interface:StoreFinderServiceGets the locations retrieved based on the given arguments.- Specified by:
locationSearchin interfaceStoreFinderService<ITEM extends PointOfServiceDistanceData,StoreFinderSearchPageData<ITEM extends PointOfServiceDistanceData>>- Parameters:
baseStore-BaseStoreModelinstance that returned locations belongs tolocationText- text that will be used for locations searchpageableData-PageableDataobject that contains basing information for search result set- Returns:
- locations found for the given parameters
-
locationSearch
public StoreFinderSearchPageData<ITEM> locationSearch(BaseStoreModel baseStore, java.lang.String locationText, PageableData pageableData, double maxRadiusKm)
Description copied from interface:StoreFinderServiceGets the locations retrieved based on the given arguments.- Specified by:
locationSearchin interfaceStoreFinderService<ITEM extends PointOfServiceDistanceData,StoreFinderSearchPageData<ITEM extends PointOfServiceDistanceData>>- Parameters:
baseStore-BaseStoreModelinstance that returned locations belongs tolocationText- text that will be used for locations searchpageableData-PageableDataobject that contains basing information for search result setmaxRadiusKm- the maximum radius from the location that results should be returned for.- Returns:
- locations found for the given parameters
-
positionSearch
public StoreFinderSearchPageData<ITEM> positionSearch(BaseStoreModel baseStore, GeoPoint geoPoint, PageableData pageableData)
Description copied from interface:StoreFinderServiceGets the locations retrieved basing on the given arguments.- Specified by:
positionSearchin interfaceStoreFinderService<ITEM extends PointOfServiceDistanceData,StoreFinderSearchPageData<ITEM extends PointOfServiceDistanceData>>- Parameters:
baseStore-BaseStoreModelinstance that returned locations belongs togeoPoint- geographical point that search is performed forpageableData-PageableDataobject that contains basing information for search result set- Returns:
- locations found for the given parameters
-
positionSearch
public StoreFinderSearchPageData<ITEM> positionSearch(BaseStoreModel baseStore, GeoPoint geoPoint, PageableData pageableData, double maxRadius)
Description copied from interface:StoreFinderServiceGets the locations retrieved basing on the given arguments.- Specified by:
positionSearchin interfaceStoreFinderService<ITEM extends PointOfServiceDistanceData,StoreFinderSearchPageData<ITEM extends PointOfServiceDistanceData>>- Parameters:
baseStore-BaseStoreModelinstance that returned locations belongs togeoPoint- geographical point that search is performed forpageableData-PageableDataobject that contains basing information for search result setmaxRadius- the maximum radius from the location that results should be returned for.- Returns:
- locations found for the given parameters
-
getPointOfServiceForName
public PointOfServiceModel getPointOfServiceForName(BaseStoreModel baseStore, java.lang.String name)
Description copied from interface:StoreFinderServiceGets thePointOfServiceModelfor the given name that should be unique- Specified by:
getPointOfServiceForNamein interfaceStoreFinderService<ITEM extends PointOfServiceDistanceData,StoreFinderSearchPageData<ITEM extends PointOfServiceDistanceData>>- Parameters:
baseStore-BaseStoreModelinstance that returned location belongs toname- the requested point of service name- Returns:
PointOfServiceModelfor the given parameter
-
getPointOfServiceDistanceForName
public ITEM getPointOfServiceDistanceForName(BaseStoreModel baseStore, java.lang.String name, GeoPoint geoPoint)
Description copied from interface:StoreFinderServiceGets the location for the given name that should be unique. Additionally the distance between the location and given coordinates is calculated.- Specified by:
getPointOfServiceDistanceForNamein interfaceStoreFinderService<ITEM extends PointOfServiceDistanceData,StoreFinderSearchPageData<ITEM extends PointOfServiceDistanceData>>- Parameters:
baseStore-BaseStoreModelinstance that returned location belongs toname- name of the requested point of servicegeoPoint- geographical point of the origin point- Returns:
- location for the given parameter
-
getAllPos
public StoreFinderSearchPageData<ITEM> getAllPos(BaseStoreModel baseStore, PageableData pageableData)
Description copied from interface:StoreFinderServiceGets the locations retrieved basing on the given arguments.- Specified by:
getAllPosin interfaceStoreFinderService<ITEM extends PointOfServiceDistanceData,StoreFinderSearchPageData<ITEM extends PointOfServiceDistanceData>>- Parameters:
baseStore-BaseStoreModelinstance that returned locations belongs topageableData-PageableDataobject that contains basing information for search result set- Returns:
- locations found for the given parameters
-
getAllPosForCountry
public java.util.List<PointOfServiceModel> getAllPosForCountry(java.lang.String countryIsoCode, BaseStoreModel baseStore)
Description copied from interface:StoreFinderServiceGets a list ofPointOfServiceModelfor all points of service in a given country- Specified by:
getAllPosForCountryin interfaceStoreFinderService<ITEM extends PointOfServiceDistanceData,StoreFinderSearchPageData<ITEM extends PointOfServiceDistanceData>>- Parameters:
countryIsoCode- {@link CountryModel:ISOCODE}baseStore- the activeBaseStoreModel- Returns:
- list of
PointOfServiceModel
-
getAllPosForRegion
public java.util.List<PointOfServiceModel> getAllPosForRegion(java.lang.String countryIsoCode, java.lang.String regionIsoCode, BaseStoreModel baseStore)
Description copied from interface:StoreFinderServiceGets a list ofPointOfServiceModelfor all points of service in a given country and region- Specified by:
getAllPosForRegionin interfaceStoreFinderService<ITEM extends PointOfServiceDistanceData,StoreFinderSearchPageData<ITEM extends PointOfServiceDistanceData>>- Parameters:
countryIsoCode- {@link CountryModel:ISOCODE}regionIsoCode- {@link RegionModel:ISOCODE}baseStore- the activeBaseStoreModel- Returns:
- list of
PointOfServiceModel
-
generateGeoAddressForSearchQuery
protected AddressData generateGeoAddressForSearchQuery(BaseStoreModel baseStore, java.lang.String locationText)
This method generates anAddressDataobject based on a search location text. It sets country to theAddressDataobject from the first POS country in the list of base store POS. Adding the country to theAddressDataobject will help to narrow the search region. It must be noted however that the country is only set if the search text does not contains any comma separators whose presence indicates that the user is attempting to enter multiple fields, post code, country, etc in an attempt to narrow the search area.- Parameters:
baseStore- - the base store for the current site.locationText- - the search location text to base the search upon.- Returns:
- an
AddressDataobject.
-
doSearch
protected StoreFinderSearchPageData<ITEM> doSearch(BaseStoreModel baseStore, java.lang.String locationText, GeoPoint centerPoint, PageableData pageableData, java.lang.Double maxRadiusKm)
-
createPagination
protected PaginationData createPagination(PageableData pageableData, long totalNumberOfResults)
-
createSearchResult
protected StoreFinderSearchPageData<ITEM> createSearchResult(java.lang.String locationText, GeoPoint centerPoint, java.util.List<ITEM> results, PaginationData paginationData)
-
calculateBounds
protected DefaultStoreFinderService.Boundary<GeoPoint> calculateBounds(java.util.List<ITEM> results, GeoPoint centerPoint)
-
recalculateSpanAgainstCenter
protected DefaultStoreFinderService.Boundary<java.lang.Double> recalculateSpanAgainstCenter(double leftBorder, double rightBorder, double centerPosition) throws GeoLocatorException
- Throws:
GeoLocatorException
-
getPointsOfServiceNear
protected java.util.Collection<PointOfServiceModel> getPointsOfServiceNear(GeoPoint centerPoint, double radiusKm, BaseStoreModel baseStore) throws PointOfServiceDaoException
- Throws:
PointOfServiceDaoException
-
calculateDistances
protected java.util.List<ITEM> calculateDistances(GeoPoint centerPoint, java.util.Collection<PointOfServiceModel> pointsOfService)
-
calculateDistance
protected double calculateDistance(GeoPoint centerPoint, PointOfServiceModel posModel) throws GeoLocatorException, LocationServiceException
-
createStoreFinderSearchPageData
protected StoreFinderSearchPageData<ITEM> createStoreFinderSearchPageData()
-
createStoreFinderResultData
protected ITEM createStoreFinderResultData()
-
createPaginationData
protected PaginationData createPaginationData()
-
-