Class GeoLocationServiceImpl
- java.lang.Object
-
- co.mastermindcms.modules.services.GeoLocationServiceImpl
-
- All Implemented Interfaces:
GeoLocationService
@Service public class GeoLocationServiceImpl extends java.lang.Object implements GeoLocationService
-
-
Field Summary
Fields Modifier and Type Field Description private AddressRepository
addressRepository
private CommerceProperties
commerceProperties
private static com.fasterxml.jackson.databind.ObjectMapper
mapper
private SellerRepository
sellerRepository
private SequenceGeneratorService
sequenceGenerator
private TranslationService
translationService
-
Constructor Summary
Constructors Constructor Description GeoLocationServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Address
addShippingAddress(java.lang.String sellerId, java.util.LinkedHashMap<java.lang.String,java.lang.Object> addressAsMap)
Adds shipping address to seller.java.util.Optional<Address>
createAddress(Address address)
This method creates a database entity.java.util.Optional<Address>
createAddress(java.util.LinkedHashMap<java.lang.String,java.lang.Object> addressAsMap)
This method creates a database entity.Address
findCompanyAddress(Address address)
This method is looking for the company address in the existing databaseAddressRepository
getAddressRepository()
java.util.List<Country>
getCountries()
This method returns database entities as list.Country
getCountryByCode(java.lang.String code)
This method returns database entity.Country
getCountryBySellerId(java.lang.String sellerId)
This method returns database entity.java.lang.String
getCountryCodeValue(java.lang.String code)
This method returns database entity field name.java.lang.String
getCountryNameBySellerId(java.lang.String sellerId)
This method returns database entity field name.java.util.Deque<java.util.Map<java.lang.String,java.lang.Object>>
getPaginationFilter(java.lang.String requestJson)
This method does calculation for a pages based on the request.java.util.List<Seller>
getSellersByCountryCode(java.lang.String countryCode)
This method returns data as list.java.util.Set<Address>
getShippingAddresses(java.lang.String sellerId)
Get saved shipping addresses.void
removeAddressAndClean(java.lang.String addressId)
This method removes a database entity and clean all relationships from another entities.void
removeAddressesByIds(java.util.ArrayList<java.lang.String> addressesIds)
This method removes a list of database entities.java.util.Optional<Address>
saveAddress(Address address)
This method save an updates of database entity.java.util.Optional<Address>
saveAddress(java.util.LinkedHashMap<java.lang.String,java.lang.Object> addressAsMap)
This method save an updates of database entity.java.util.List<Address>
searchAddresses(java.lang.String query, java.lang.String from, java.lang.String to)
Deprecated.java.util.LinkedHashSet<Country>
searchCountries(java.lang.String requestJson)
This method does search requests and returns data as list.org.springframework.data.domain.Page<Country>
searchCountriesPaged(java.lang.String requestJson)
This method does search requests and returns data as pages.
-
-
-
Field Detail
-
sellerRepository
@Autowired private SellerRepository sellerRepository
-
addressRepository
@Autowired private AddressRepository addressRepository
-
sequenceGenerator
@Autowired private SequenceGeneratorService sequenceGenerator
-
translationService
@Autowired private TranslationService translationService
-
commerceProperties
@Autowired private CommerceProperties commerceProperties
-
mapper
private static final com.fasterxml.jackson.databind.ObjectMapper mapper
-
-
Method Detail
-
getAddressRepository
public AddressRepository getAddressRepository()
- Specified by:
getAddressRepository
in interfaceGeoLocationService
-
getPaginationFilter
public java.util.Deque<java.util.Map<java.lang.String,java.lang.Object>> getPaginationFilter(java.lang.String requestJson)
Description copied from interface:GeoLocationService
This method does calculation for a pages based on the request.- Specified by:
getPaginationFilter
in interfaceGeoLocationService
- Parameters:
requestJson
- JSON-object of request contains an instructions for search queries- Returns:
- map-representation of data
-
searchCountries
public java.util.LinkedHashSet<Country> searchCountries(java.lang.String requestJson)
Description copied from interface:GeoLocationService
This method does search requests and returns data as list.- Specified by:
searchCountries
in interfaceGeoLocationService
- Parameters:
requestJson
- search request- Returns:
- data transport entities as list
-
searchCountriesPaged
public org.springframework.data.domain.Page<Country> searchCountriesPaged(java.lang.String requestJson)
Description copied from interface:GeoLocationService
This method does search requests and returns data as pages.- Specified by:
searchCountriesPaged
in interfaceGeoLocationService
- Parameters:
requestJson
- JSON-object of request contains an instructions for search queries- Returns:
- database entities separated to pages
-
searchAddresses
@Deprecated public java.util.List<Address> searchAddresses(java.lang.String query, java.lang.String from, java.lang.String to)
Deprecated.Description copied from interface:GeoLocationService
This method does search requests and returns data as list.- Specified by:
searchAddresses
in interfaceGeoLocationService
- Parameters:
query
- search queryfrom
- field which filter and returned itemsto
- field which filter and returned items- Returns:
- database entities as list
-
findCompanyAddress
public Address findCompanyAddress(Address address)
Description copied from interface:GeoLocationService
This method is looking for the company address in the existing database- Specified by:
findCompanyAddress
in interfaceGeoLocationService
- Parameters:
address
- input address entity- Returns:
- address of the company
-
getCountries
public java.util.List<Country> getCountries()
Description copied from interface:GeoLocationService
This method returns database entities as list.- Specified by:
getCountries
in interfaceGeoLocationService
- Returns:
- database entities as list
-
getCountryByCode
public Country getCountryByCode(java.lang.String code)
Description copied from interface:GeoLocationService
This method returns database entity.- Specified by:
getCountryByCode
in interfaceGeoLocationService
- Parameters:
code
- field for filter and return database entity- Returns:
- database entity
-
getCountryCodeValue
public java.lang.String getCountryCodeValue(java.lang.String code)
Description copied from interface:GeoLocationService
This method returns database entity field name.- Specified by:
getCountryCodeValue
in interfaceGeoLocationService
- Parameters:
code
- field for filter and return database entity field code's value- Returns:
- value as text
-
getCountryBySellerId
public Country getCountryBySellerId(java.lang.String sellerId)
Description copied from interface:GeoLocationService
This method returns database entity.- Specified by:
getCountryBySellerId
in interfaceGeoLocationService
- Parameters:
sellerId
- identification for filter and return database entity- Returns:
- database entity
-
getCountryNameBySellerId
public java.lang.String getCountryNameBySellerId(java.lang.String sellerId)
Description copied from interface:GeoLocationService
This method returns database entity field name.- Specified by:
getCountryNameBySellerId
in interfaceGeoLocationService
- Parameters:
sellerId
- identification for filter and return database entity field name- Returns:
- value as text
-
getSellersByCountryCode
public java.util.List<Seller> getSellersByCountryCode(java.lang.String countryCode)
Description copied from interface:GeoLocationService
This method returns data as list.- Specified by:
getSellersByCountryCode
in interfaceGeoLocationService
- Parameters:
countryCode
- field for database entity which filter and returned list of database entities- Returns:
- database beans as list
-
createAddress
@Transactional public java.util.Optional<Address> createAddress(java.util.LinkedHashMap<java.lang.String,java.lang.Object> addressAsMap)
Description copied from interface:GeoLocationService
This method creates a database entity.- Specified by:
createAddress
in interfaceGeoLocationService
- Parameters:
addressAsMap
- map-representation of database entity- Returns:
- optional value to externally interaction
-
createAddress
@Transactional public java.util.Optional<Address> createAddress(Address address)
Description copied from interface:GeoLocationService
This method creates a database entity.- Specified by:
createAddress
in interfaceGeoLocationService
- Parameters:
address
- database entity- Returns:
- optional value to externally interaction
-
saveAddress
@Transactional public java.util.Optional<Address> saveAddress(java.util.LinkedHashMap<java.lang.String,java.lang.Object> addressAsMap)
Description copied from interface:GeoLocationService
This method save an updates of database entity.- Specified by:
saveAddress
in interfaceGeoLocationService
- Parameters:
addressAsMap
- map-representation of database entity- Returns:
- optional value to externally interaction
-
saveAddress
@Transactional public java.util.Optional<Address> saveAddress(Address address)
Description copied from interface:GeoLocationService
This method save an updates of database entity.- Specified by:
saveAddress
in interfaceGeoLocationService
- Parameters:
address
- database entity- Returns:
- optional value to externally interaction
-
removeAddressAndClean
@Transactional public void removeAddressAndClean(java.lang.String addressId)
Description copied from interface:GeoLocationService
This method removes a database entity and clean all relationships from another entities.- Specified by:
removeAddressAndClean
in interfaceGeoLocationService
- Parameters:
addressId
- identification for database entity which will be removed
-
removeAddressesByIds
@Transactional public void removeAddressesByIds(java.util.ArrayList<java.lang.String> addressesIds)
Description copied from interface:GeoLocationService
This method removes a list of database entities.- Specified by:
removeAddressesByIds
in interfaceGeoLocationService
- Parameters:
addressesIds
- the list of database entities which will be removed
-
addShippingAddress
@Transactional public Address addShippingAddress(java.lang.String sellerId, java.util.LinkedHashMap<java.lang.String,java.lang.Object> addressAsMap)
Description copied from interface:GeoLocationService
Adds shipping address to seller.- Specified by:
addShippingAddress
in interfaceGeoLocationService
- Parameters:
sellerId
- seller IDaddressAsMap
- address- Returns:
- created Address
-
getShippingAddresses
public java.util.Set<Address> getShippingAddresses(java.lang.String sellerId)
Description copied from interface:GeoLocationService
Get saved shipping addresses.- Specified by:
getShippingAddresses
in interfaceGeoLocationService
- Parameters:
sellerId
- id of the seller to obtain addresses- Returns:
- addresses set
-
-