Class SellerRegistrationServiceImpl
- java.lang.Object
-
- co.mastermindcms.modules.services.SellerRegistrationServiceImpl
-
- All Implemented Interfaces:
SellerRegistrationService
@Service public class SellerRegistrationServiceImpl extends java.lang.Object implements SellerRegistrationService
-
-
Field Summary
Fields Modifier and Type Field Description private AccessManagementServiceaccessManagementServiceprivate CertificateRepositorycertificateRepositoryprivate ChatRepositorychatRepositoryprivate CommerceItemServicecommerceItemServiceprivate CommonPropertiescommonPropertiesprivate EmailPropertiesemailPropertiesprivate EmailSenderServiceemailSenderServiceprivate GeoLocationServicegeoLocationServiceprivate static com.fasterxml.jackson.databind.ObjectMappermapperprivate org.springframework.security.crypto.password.PasswordEncoderpasswordEncoderprivate ProfileManagementServiceprofileManagementServiceprivate SalesCatalogServicesalesCatalogServiceprivate SellerRepositorysellerRepositoryprivate SellerSkuRepositorysellerSkuRepositoryprivate SequenceGeneratorServicesequenceGeneratorprivate ShoppingCartRepositoryshoppingCartRepositoryprivate UserManagementServiceuserManagementService
-
Constructor Summary
Constructors Constructor Description SellerRegistrationServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.HashSet<java.lang.String>addFavoriteSeller(java.lang.String sellerId)This method adds database entity at already in the existing database entities list.java.util.LinkedHashSet<java.lang.String>addFavoriteSellerSKU(java.lang.String sellerSkuId)This method adds database entity at already in the existing database entities list.private voidaddRelations(Seller seller)voidchangeProfileEmbeddedParent(java.lang.String profileId, java.lang.String sellerId)This method updates database entities.private voiddeactivateAllProfiles(java.lang.String sellerId)java.util.List<Certificate>getCertificates()This method returns database entities as list.java.util.List<Chat>getChatsByLoggedProfile()This method does returns database entities list.CountrygetCountryBySellerId(java.lang.String sellerId)This method returns data as list.java.util.HashSet<Seller>getFavoriteSellers()This method returns database entities as list.java.util.LinkedHashSet<SellerSKU>getFavoriteSellerSKUs()This method returns database entities as list.ProfilegetLoggedProfile()This method does returns database entity which logged in system.SellergetLoggedSeller()This method does returns database entity which logged in system.SellerRepositorygetRepository()java.util.List<Attachment>getSellerDocumentUrls(java.lang.String sellerId, java.lang.String type)This method returns data as list.java.util.List<java.util.Map<java.lang.String,java.lang.String>>getSellers()This method retrieves a map, which can be processed in a templates.java.util.List<SellerSKU>getSellerSellerSkus(java.lang.String sellerId)This method returns data as list.java.util.Map<java.lang.String,java.lang.Boolean>isEmailNotificationEnabled(java.lang.String sellerId)This method checks and returns mapbooleanisEmailTaken(java.lang.String email)Checks if given email is taken by any user.booleanisFavoriteSellerExists(java.lang.String sellerId)This method checks is exists database entity.booleanisFavoriteSellerNotExists(java.lang.String sellerId)This method checks is not exists database entity.booleanisFavoriteSellerSkuExists(java.lang.String sellerSkuId)This method checks is exists database entity.booleanisFavoriteSellerSkuNotExists(java.lang.String sellerSkuId)This method checks is not exists database entity.booleanisLogged()This method does check is database entity logged in system.booleanisNotLogged()This method does check is not database entity logged in system.booleanisTariffNotPaid(java.lang.String sellerId)This method checks is database entity field had some value.booleanisTariffPaid(java.lang.String sellerId)This method checks is database entity field had some value.private voidprepareRelations(Seller seller)java.util.Optional<Seller>registerSeller(java.util.LinkedHashMap<java.lang.String,java.lang.Object> sellerAsMap)This method creates a database entity.private voidremoveCategoryFromSeller(java.lang.String sellerId, java.lang.String catId)private voidremoveDocumentFromSeller(java.lang.String sellerId, java.lang.String docUrl)voidremoveFavoriteSeller(java.lang.String sellerId)This method removes database entity.voidremoveFavoriteSellerSKU(java.lang.String sellerSkuId)This method removes database entity.private voidremoveImageUrlFromSeller(java.lang.String sellerId, java.lang.String imageUrl)private voidremoveProductFromSeller(java.lang.String sellerId, java.lang.String prodId)private voidremoveProfileFromSeller(java.lang.String sellerId, java.lang.String profileId)private voidremoveProfilesFromSeller(java.lang.String sellerId)private voidremoveRelations(Seller sUI, Seller sDB)voidremoveSellerAndClean(java.lang.String sellerId)This method removes a database entity and clean all relationships from another entities.private voidremoveSellerAndSellerSKUs(java.lang.String sellerId)private voidremoveSellerFromAddress(java.lang.String sellerId)private voidremoveSellerFromCertificate(java.lang.String sellerId, java.lang.String certificateId)private voidremoveSellerFromCertificates(java.lang.String sellerId)voidremoveSellersByIds(java.util.ArrayList<java.lang.String> sellersIds)This method removes a list of database entities.private voidremoveSellerSkuFromSeller(java.lang.String sellerId, java.lang.String sellerSkuId)private voidremoveShoppingCartFromSeller(java.lang.String sellerId)SellersaveSeller(Seller seller)This method saves database entity.SellersaveSeller(java.util.LinkedHashMap<java.lang.String,java.lang.Object> sellerAsMap)This method saves database entity.voidsendContactSupplierEmail(java.lang.String sellerId, java.lang.String messageText, java.lang.String topic)This method sends a email for contact supplier.private voidupdateAddressFromSeller(Seller seller, Seller sellerDB)private voidupdateProfilesFromSeller(Seller seller, Seller sellerDB, boolean verifyRequired)SellerupdateSeller(java.util.LinkedHashMap<java.lang.String,java.lang.Object> sellerAsMap, java.lang.Boolean verifyRequired)This method save an updates of database entity.private UserupdateUser(User user, Profile profileDB, User userDB, java.lang.String password, boolean verifyRequired)
-
-
-
Field Detail
-
chatRepository
@Autowired private ChatRepository chatRepository
-
sellerRepository
@Autowired private SellerRepository sellerRepository
-
sellerSkuRepository
@Autowired private SellerSkuRepository sellerSkuRepository
-
certificateRepository
@Autowired private CertificateRepository certificateRepository
-
userManagementService
@Autowired private UserManagementService userManagementService
-
profileManagementService
@Autowired private ProfileManagementService profileManagementService
-
shoppingCartRepository
@Autowired private ShoppingCartRepository shoppingCartRepository
-
commerceItemService
@Autowired private CommerceItemService commerceItemService
-
geoLocationService
@Autowired private GeoLocationService geoLocationService
-
salesCatalogService
@Autowired private SalesCatalogService salesCatalogService
-
accessManagementService
@Autowired private AccessManagementService accessManagementService
-
sequenceGenerator
@Autowired private SequenceGeneratorService sequenceGenerator
-
emailSenderService
@Autowired private EmailSenderService emailSenderService
-
emailProperties
@Autowired private EmailProperties emailProperties
-
passwordEncoder
@Autowired private org.springframework.security.crypto.password.PasswordEncoder passwordEncoder
-
commonProperties
@Autowired private CommonProperties commonProperties
-
mapper
private static final com.fasterxml.jackson.databind.ObjectMapper mapper
-
-
Method Detail
-
getRepository
public SellerRepository getRepository()
- Specified by:
getRepositoryin interfaceSellerRegistrationService
-
isLogged
public boolean isLogged()
Description copied from interface:SellerRegistrationServiceThis method does check is database entity logged in system.- Specified by:
isLoggedin interfaceSellerRegistrationService- Returns:
- value as boolean
-
isNotLogged
public boolean isNotLogged()
Description copied from interface:SellerRegistrationServiceThis method does check is not database entity logged in system.- Specified by:
isNotLoggedin interfaceSellerRegistrationService- Returns:
- value as boolean
-
getLoggedSeller
public Seller getLoggedSeller()
Description copied from interface:SellerRegistrationServiceThis method does returns database entity which logged in system.- Specified by:
getLoggedSellerin interfaceSellerRegistrationService- Returns:
- database entity
-
getLoggedProfile
public Profile getLoggedProfile()
Description copied from interface:SellerRegistrationServiceThis method does returns database entity which logged in system.- Specified by:
getLoggedProfilein interfaceSellerRegistrationService- Returns:
- database entity
-
getChatsByLoggedProfile
public java.util.List<Chat> getChatsByLoggedProfile()
Description copied from interface:SellerRegistrationServiceThis method does returns database entities list.- Specified by:
getChatsByLoggedProfilein interfaceSellerRegistrationService- Returns:
- database entities as list
-
getCertificates
public java.util.List<Certificate> getCertificates()
Description copied from interface:SellerRegistrationServiceThis method returns database entities as list.- Specified by:
getCertificatesin interfaceSellerRegistrationService- Returns:
- database entities as list
-
registerSeller
@Transactional public java.util.Optional<Seller> registerSeller(java.util.LinkedHashMap<java.lang.String,java.lang.Object> sellerAsMap)
Description copied from interface:SellerRegistrationServiceThis method creates a database entity.- Specified by:
registerSellerin interfaceSellerRegistrationService- Parameters:
sellerAsMap- map-representation of database entity- Returns:
- optional value to externally interaction
-
sendContactSupplierEmail
public void sendContactSupplierEmail(java.lang.String sellerId, java.lang.String messageText, java.lang.String topic)Description copied from interface:SellerRegistrationServiceThis method sends a email for contact supplier.- Specified by:
sendContactSupplierEmailin interfaceSellerRegistrationService- Parameters:
sellerId- identification database entity who send emailmessageText- email massage texttopic- email message topic
-
saveSeller
@Transactional public Seller saveSeller(java.util.LinkedHashMap<java.lang.String,java.lang.Object> sellerAsMap)
Description copied from interface:SellerRegistrationServiceThis method saves database entity.- Specified by:
saveSellerin interfaceSellerRegistrationService- Parameters:
sellerAsMap- map-representation of database entity- Returns:
- saved instance of database entity
-
saveSeller
@Transactional public Seller saveSeller(Seller seller)
Description copied from interface:SellerRegistrationServiceThis method saves database entity.- Specified by:
saveSellerin interfaceSellerRegistrationService- Parameters:
seller- database entity- Returns:
- saved instance of database entity
-
updateSeller
@Transactional public Seller updateSeller(java.util.LinkedHashMap<java.lang.String,java.lang.Object> sellerAsMap, java.lang.Boolean verifyRequired)
Description copied from interface:SellerRegistrationServiceThis method save an updates of database entity.- Specified by:
updateSellerin interfaceSellerRegistrationService- Parameters:
sellerAsMap- map-representation of database entityverifyRequired- boolean value- Returns:
- saved instance of database entity
-
removeSellerAndClean
@Transactional public void removeSellerAndClean(java.lang.String sellerId)
Description copied from interface:SellerRegistrationServiceThis method removes a database entity and clean all relationships from another entities.- Specified by:
removeSellerAndCleanin interfaceSellerRegistrationService- Parameters:
sellerId- identification for database entity which will be removed
-
removeSellersByIds
@Transactional public void removeSellersByIds(java.util.ArrayList<java.lang.String> sellersIds)
Description copied from interface:SellerRegistrationServiceThis method removes a list of database entities.- Specified by:
removeSellersByIdsin interfaceSellerRegistrationService- Parameters:
sellersIds- the list of database entities which will be removed
-
getSellerSellerSkus
public java.util.List<SellerSKU> getSellerSellerSkus(java.lang.String sellerId)
Description copied from interface:SellerRegistrationServiceThis method returns data as list.- Specified by:
getSellerSellerSkusin interfaceSellerRegistrationService- Parameters:
sellerId- identification for database entity which related entities list be returned- Returns:
- database entities as list
-
getCountryBySellerId
public Country getCountryBySellerId(java.lang.String sellerId)
Description copied from interface:SellerRegistrationServiceThis method returns data as list.- Specified by:
getCountryBySellerIdin interfaceSellerRegistrationService- Parameters:
sellerId- identification for database entity which related entities list be returned- Returns:
- country entity
-
isTariffPaid
public boolean isTariffPaid(java.lang.String sellerId)
Description copied from interface:SellerRegistrationServiceThis method checks is database entity field had some value.- Specified by:
isTariffPaidin interfaceSellerRegistrationService- Parameters:
sellerId- identification for database entity which will be checked- Returns:
- value as boolean
-
isTariffNotPaid
public boolean isTariffNotPaid(java.lang.String sellerId)
Description copied from interface:SellerRegistrationServiceThis method checks is database entity field had some value.- Specified by:
isTariffNotPaidin interfaceSellerRegistrationService- Parameters:
sellerId- identification for database entity which will be checked- Returns:
- value as boolean
-
isFavoriteSellerNotExists
public boolean isFavoriteSellerNotExists(java.lang.String sellerId)
Description copied from interface:SellerRegistrationServiceThis method checks is not exists database entity.- Specified by:
isFavoriteSellerNotExistsin interfaceSellerRegistrationService- Parameters:
sellerId- identification for database entity which will be checked- Returns:
- value as boolean
-
isFavoriteSellerExists
public boolean isFavoriteSellerExists(java.lang.String sellerId)
Description copied from interface:SellerRegistrationServiceThis method checks is exists database entity.- Specified by:
isFavoriteSellerExistsin interfaceSellerRegistrationService- Parameters:
sellerId- identification for database entity which will be checked- Returns:
- value as boolean
-
isFavoriteSellerSkuNotExists
public boolean isFavoriteSellerSkuNotExists(java.lang.String sellerSkuId)
Description copied from interface:SellerRegistrationServiceThis method checks is not exists database entity.- Specified by:
isFavoriteSellerSkuNotExistsin interfaceSellerRegistrationService- Parameters:
sellerSkuId- identification for database entity which will be checked- Returns:
- value as boolean
-
isFavoriteSellerSkuExists
public boolean isFavoriteSellerSkuExists(java.lang.String sellerSkuId)
Description copied from interface:SellerRegistrationServiceThis method checks is exists database entity.- Specified by:
isFavoriteSellerSkuExistsin interfaceSellerRegistrationService- Parameters:
sellerSkuId- identification for database entity which will be checked- Returns:
- value as boolean
-
isEmailNotificationEnabled
public java.util.Map<java.lang.String,java.lang.Boolean> isEmailNotificationEnabled(java.lang.String sellerId)
Description copied from interface:SellerRegistrationServiceThis method checks and returns map- Specified by:
isEmailNotificationEnabledin interfaceSellerRegistrationService- Parameters:
sellerId- identification for database entity which will be checked- Returns:
- value as boolean
-
getSellerDocumentUrls
public java.util.List<Attachment> getSellerDocumentUrls(java.lang.String sellerId, java.lang.String type)
Description copied from interface:SellerRegistrationServiceThis method returns data as list.- Specified by:
getSellerDocumentUrlsin interfaceSellerRegistrationService- Parameters:
sellerId- identification for database entity which related beans list be returnedtype- field for database entity from filter- Returns:
- database beans as list
-
getFavoriteSellers
public java.util.HashSet<Seller> getFavoriteSellers()
Description copied from interface:SellerRegistrationServiceThis method returns database entities as list.- Specified by:
getFavoriteSellersin interfaceSellerRegistrationService- Returns:
- database entities as list
-
addFavoriteSeller
@Transactional public java.util.HashSet<java.lang.String> addFavoriteSeller(java.lang.String sellerId)
Description copied from interface:SellerRegistrationServiceThis method adds database entity at already in the existing database entities list.- Specified by:
addFavoriteSellerin interfaceSellerRegistrationService- Parameters:
sellerId- identification for database entity which added in list- Returns:
- database entities as list
-
removeFavoriteSeller
@Transactional public void removeFavoriteSeller(java.lang.String sellerId)
Description copied from interface:SellerRegistrationServiceThis method removes database entity.- Specified by:
removeFavoriteSellerin interfaceSellerRegistrationService- Parameters:
sellerId- database entity which will be removed
-
getFavoriteSellerSKUs
public java.util.LinkedHashSet<SellerSKU> getFavoriteSellerSKUs()
Description copied from interface:SellerRegistrationServiceThis method returns database entities as list.- Specified by:
getFavoriteSellerSKUsin interfaceSellerRegistrationService- Returns:
- database entities as list
-
addFavoriteSellerSKU
@Transactional public java.util.LinkedHashSet<java.lang.String> addFavoriteSellerSKU(java.lang.String sellerSkuId)
Description copied from interface:SellerRegistrationServiceThis method adds database entity at already in the existing database entities list.- Specified by:
addFavoriteSellerSKUin interfaceSellerRegistrationService- Parameters:
sellerSkuId- identification for database entity which added in list- Returns:
- database entities as list
-
removeFavoriteSellerSKU
@Transactional public void removeFavoriteSellerSKU(java.lang.String sellerSkuId)
Description copied from interface:SellerRegistrationServiceThis method removes database entity.- Specified by:
removeFavoriteSellerSKUin interfaceSellerRegistrationService- Parameters:
sellerSkuId- database entity which will be removed
-
getSellers
public java.util.List<java.util.Map<java.lang.String,java.lang.String>> getSellers()
Description copied from interface:SellerRegistrationServiceThis method retrieves a map, which can be processed in a templates.- Specified by:
getSellersin interfaceSellerRegistrationService- Returns:
- map-representation of data
-
changeProfileEmbeddedParent
@Transactional public void changeProfileEmbeddedParent(java.lang.String profileId, java.lang.String sellerId)Description copied from interface:SellerRegistrationServiceThis method updates database entities.- Specified by:
changeProfileEmbeddedParentin interfaceSellerRegistrationService- Parameters:
profileId- identification for database entity which will be updatedsellerId- identification for database entity which will be updated
-
isEmailTaken
public boolean isEmailTaken(java.lang.String email)
Description copied from interface:SellerRegistrationServiceChecks if given email is taken by any user.- Specified by:
isEmailTakenin interfaceSellerRegistrationService- Parameters:
email- email- Returns:
trueif email is taken
-
addRelations
private void addRelations(Seller seller)
-
prepareRelations
private void prepareRelations(Seller seller)
-
removeProfilesFromSeller
private void removeProfilesFromSeller(java.lang.String sellerId)
-
removeProfileFromSeller
private void removeProfileFromSeller(java.lang.String sellerId, java.lang.String profileId)
-
removeSellerFromCertificates
private void removeSellerFromCertificates(java.lang.String sellerId)
-
removeSellerFromCertificate
private void removeSellerFromCertificate(java.lang.String sellerId, java.lang.String certificateId)
-
removeSellerAndSellerSKUs
private void removeSellerAndSellerSKUs(java.lang.String sellerId)
-
removeShoppingCartFromSeller
private void removeShoppingCartFromSeller(java.lang.String sellerId)
-
removeSellerSkuFromSeller
private void removeSellerSkuFromSeller(java.lang.String sellerId, java.lang.String sellerSkuId)
-
removeSellerFromAddress
private void removeSellerFromAddress(java.lang.String sellerId)
-
removeDocumentFromSeller
private void removeDocumentFromSeller(java.lang.String sellerId, java.lang.String docUrl)
-
removeImageUrlFromSeller
private void removeImageUrlFromSeller(java.lang.String sellerId, java.lang.String imageUrl)
-
removeCategoryFromSeller
private void removeCategoryFromSeller(java.lang.String sellerId, java.lang.String catId)
-
removeProductFromSeller
private void removeProductFromSeller(java.lang.String sellerId, java.lang.String prodId)
-
deactivateAllProfiles
private void deactivateAllProfiles(java.lang.String sellerId)
-
updateProfilesFromSeller
private void updateProfilesFromSeller(Seller seller, Seller sellerDB, boolean verifyRequired)
-
-