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 AddressRepositoryaddressRepositoryprivate org.springframework.context.ApplicationContextappContextprivate CommercePropertiescommercePropertiesprivate static com.fasterxml.jackson.databind.ObjectMappermapperprivate org.springframework.data.mongodb.core.MongoTemplatemongoTemplateprivate SellerRepositorysellerRepositoryprivate SequenceGeneratorServicesequenceGeneratorprivate TranslationServicetranslationService
-
Constructor Summary
Constructors Constructor Description GeoLocationServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description AddressaddShippingAddress(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.AddresscreateAddress(java.util.LinkedHashMap<java.lang.String,java.lang.Object> addressAsMap)This method creates a database entity.AddressfindCompanyAddress(Address address)This method is looking for the company address in the existing databaseAddressgetAddressById(java.lang.String addressId)This method returns database entity.AddressRepositorygetAddressRepository()java.util.List<Country>getCountries()This method returns database entities as list.CountrygetCountryByCode(java.lang.String code)This method returns database entity.CountrygetCountryBySellerId(java.lang.String sellerId)This method returns database entity.java.lang.StringgetCountryCodeValue(java.lang.String code)This method returns database entity field name.java.lang.StringgetCountryNameBySellerId(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.voidremoveAddressAndClean(java.lang.String addressId)This method removes a database entity and clean all relationships from another entities.voidremoveAddressesByIds(java.util.ArrayList<java.lang.String> addressesIds)This method removes a list of database entities.voidremoveAddressFromSeller(java.lang.String sellerId, java.lang.String addressId)Removes address from seller.voidremoveShippingAddress(java.lang.String sellerId, java.lang.String addressId)Removes shipping address from seller.java.util.Optional<Address>saveAddress(Address address)This method save an updates of database entity.AddresssaveAddress(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
-
appContext
@Autowired private org.springframework.context.ApplicationContext appContext
-
mongoTemplate
@Autowired private org.springframework.data.mongodb.core.MongoTemplate mongoTemplate
-
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:
getAddressRepositoryin interfaceGeoLocationService
-
getPaginationFilter
public java.util.Deque<java.util.Map<java.lang.String,java.lang.Object>> getPaginationFilter(java.lang.String requestJson)
Description copied from interface:GeoLocationServiceThis method does calculation for a pages based on the request.- Specified by:
getPaginationFilterin 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:GeoLocationServiceThis method does search requests and returns data as list.- Specified by:
searchCountriesin 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:GeoLocationServiceThis method does search requests and returns data as pages.- Specified by:
searchCountriesPagedin 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:GeoLocationServiceThis method does search requests and returns data as list.- Specified by:
searchAddressesin 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:GeoLocationServiceThis method is looking for the company address in the existing database- Specified by:
findCompanyAddressin interfaceGeoLocationService- Parameters:
address- input address entity- Returns:
- address of the company
-
getAddressById
public Address getAddressById(java.lang.String addressId)
Description copied from interface:GeoLocationServiceThis method returns database entity.- Specified by:
getAddressByIdin interfaceGeoLocationService- Parameters:
addressId- identification for filter and return database entity- Returns:
- database entity
-
getCountries
public java.util.List<Country> getCountries()
Description copied from interface:GeoLocationServiceThis method returns database entities as list.- Specified by:
getCountriesin interfaceGeoLocationService- Returns:
- database entities as list
-
getCountryByCode
public Country getCountryByCode(java.lang.String code)
Description copied from interface:GeoLocationServiceThis method returns database entity.- Specified by:
getCountryByCodein 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:GeoLocationServiceThis method returns database entity field name.- Specified by:
getCountryCodeValuein 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:GeoLocationServiceThis method returns database entity.- Specified by:
getCountryBySellerIdin 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:GeoLocationServiceThis method returns database entity field name.- Specified by:
getCountryNameBySellerIdin 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:GeoLocationServiceThis method returns data as list.- Specified by:
getSellersByCountryCodein interfaceGeoLocationService- Parameters:
countryCode- field for database entity which filter and returned list of database entities- Returns:
- database beans as list
-
createAddress
@Transactional public Address createAddress(java.util.LinkedHashMap<java.lang.String,java.lang.Object> addressAsMap)
Description copied from interface:GeoLocationServiceThis method creates a database entity.- Specified by:
createAddressin interfaceGeoLocationService- Parameters:
addressAsMap- map-representation of database entity- Returns:
- value to externally interaction
-
createAddress
@Transactional public java.util.Optional<Address> createAddress(Address address)
Description copied from interface:GeoLocationServiceThis method creates a database entity.- Specified by:
createAddressin interfaceGeoLocationService- Parameters:
address- database entity- Returns:
- optional value to externally interaction
-
saveAddress
@Transactional public Address saveAddress(java.util.LinkedHashMap<java.lang.String,java.lang.Object> addressAsMap)
Description copied from interface:GeoLocationServiceThis method save an updates of database entity.- Specified by:
saveAddressin interfaceGeoLocationService- Parameters:
addressAsMap- map-representation of database entity- Returns:
- value to externally interaction
-
saveAddress
@Transactional public java.util.Optional<Address> saveAddress(Address address)
Description copied from interface:GeoLocationServiceThis method save an updates of database entity.- Specified by:
saveAddressin interfaceGeoLocationService- Parameters:
address- database entity- Returns:
- optional value to externally interaction
-
removeAddressAndClean
@Transactional public void removeAddressAndClean(java.lang.String addressId)
Description copied from interface:GeoLocationServiceThis method removes a database entity and clean all relationships from another entities.- Specified by:
removeAddressAndCleanin 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:GeoLocationServiceThis method removes a list of database entities.- Specified by:
removeAddressesByIdsin 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:GeoLocationServiceAdds shipping address to seller.- Specified by:
addShippingAddressin interfaceGeoLocationService- Parameters:
sellerId- seller IDaddressAsMap- address- Returns:
- created Address
-
removeShippingAddress
public void removeShippingAddress(java.lang.String sellerId, java.lang.String addressId)Description copied from interface:GeoLocationServiceRemoves shipping address from seller.- Specified by:
removeShippingAddressin interfaceGeoLocationService- Parameters:
sellerId- seller IDaddressId- address ID
-
removeAddressFromSeller
public void removeAddressFromSeller(java.lang.String sellerId, java.lang.String addressId)Description copied from interface:GeoLocationServiceRemoves address from seller.- Specified by:
removeAddressFromSellerin interfaceGeoLocationService- Parameters:
sellerId- seller IDaddressId- address ID
-
getShippingAddresses
public java.util.Set<Address> getShippingAddresses(java.lang.String sellerId)
Description copied from interface:GeoLocationServiceGet saved shipping addresses.- Specified by:
getShippingAddressesin interfaceGeoLocationService- Parameters:
sellerId- id of the seller to obtain addresses- Returns:
- addresses set
-
-