Class SKUServiceImpl
- java.lang.Object
-
- co.mastermindcms.modules.services.SKUServiceImpl
-
- All Implemented Interfaces:
SKUService
@Service public class SKUServiceImpl extends java.lang.Object implements SKUService
-
-
Field Summary
Fields Modifier and Type Field Description private AccessManagementServiceaccessManagementServiceprivate AttributeRepositoryattributeRepositoryprivate CategoryRepositorycategoryRepositoryprivate CommonPropertiescommonPropertiesprivate JobsManagementServicejobServiceprivate LanguageRepositorylanguageRepositoryprivate static com.fasterxml.jackson.databind.ObjectMappermapperprivate org.springframework.data.mongodb.core.MongoTemplatemongoTemplateprivate ProductRepositoryproductRepositoryprivate SellerSkuRepositorysellerSkuRepositoryprivate SequenceGeneratorServicesequenceGeneratorprivate SKURepositoryskuRepositoryprivate MongoStorageServicestorageServiceprivate TranslationServicetranslationServiceprivate TranslationsRepositorytranslationsRepositoryprivate WebSocketServicewebSocketService
-
Constructor Summary
Constructors Constructor Description SKUServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description private voidaddRelations(SKU skuUI)SKUaddSKUToProduct(java.lang.String productId, java.util.LinkedHashMap<java.lang.String,java.lang.Object> skuAsMap)This method does a relationship between entities.java.util.Optional<SKU>createSKU(SKU sku)This method creates a database entity.java.util.Optional<SKU>createSKU(java.util.LinkedHashMap<java.lang.String,java.lang.Object> skuAsMap)This method creates a database entity.SKUfindById(java.lang.String skuId)This method does search requests and returns data as list.java.util.List<SKU>findSKUs()This method returns database entities as list.java.util.List<Category>getCategoriesBySkuId(java.lang.String skuId)This method retrieves a map, which can be processed in a templates.java.util.LinkedHashSet<EmbeddedBean>getFallIntoProducts(java.lang.String[] productIds)This method returns data as set.java.util.Deque<java.util.Map<java.lang.String,java.lang.Object>>getPaginationFilter(java.lang.String requestJson)Deprecated.SKURepositorygetRepository()java.util.List<java.util.Map<java.lang.String,java.lang.Object>>getSkusByProductAndFirstLetter(java.lang.String productId, java.lang.String firstLetter)This method retrieves a map, which can be processed in a templates.java.util.List<java.util.Map<java.lang.String,java.lang.String>>getSortedProductSkus(java.lang.String productId)This method sorted and retrieves a map, which can be processed in a templates.booleanisSKUExists(java.lang.String name)This method checks is exists database entity.SkuDTOmapSkuToDto(SKU sku, boolean optimal)Deprecated.private voidprepareRelations(SKU skuUI, SKU skuDB)private voidremoveRelations(SKU skuUI, SKU skuDB)voidremoveSKUAndClean(java.lang.String skuId)This method removes a database entity and clean all relationships from another entities.voidremoveSKUFromAttribute(java.lang.String skuId, java.lang.String attributeId)This method removes relationship between database entities.voidremoveSKUFromAttributes(java.lang.String skuId)This method removes relationship between database entities.voidremoveSKUFromProduct(java.lang.String skuId, java.lang.String productId)This method removes relationship between database entities.voidremoveSKUFromProducts(java.lang.String skuId)This method removes relationship between database entities.voidremoveSKUFromSellerSKU(java.lang.String skuId, java.lang.String sellerSkuId)This method removes relationship between database entities.voidremoveSKUFromSellerSKUs(java.lang.String skuId)This method removes relationship between database entities.voidremoveSKUFromTranslation(java.lang.String skuId, java.lang.String translationId)This method removes relationship between database entities.voidremoveSKUFromTranslations(java.lang.String skuId)This method removes relationship between database entities.voidremoveSkusByIds(java.util.ArrayList<java.lang.String> skusIds)This method removes a list of database entities.SKUsaveSKU(SKU sku)This method saves a database entity.SKUsaveSKU(java.util.LinkedHashMap<java.lang.String,java.lang.Object> skuAsMap)This method save an updates of database entity.java.util.LinkedHashSet<SkuDTO>searchSKUs(java.lang.String requestJson)Deprecated.java.util.List<SkuDTO>searchSKUs(java.lang.String query, java.lang.String offset, java.lang.String limit)Deprecated.co.mastermindcms.modules.beans.SearchResponsesearchSKUs(java.util.LinkedHashMap<java.lang.String,java.lang.Object> requestJson)This method does search requests and returns data as list.co.mastermindcms.modules.beans.SearchResponsesearchSkusLightweight(java.util.LinkedHashMap<java.lang.String,java.lang.Object> requestJson)Retrieves lightweight skus based on the given request JSON.org.springframework.data.domain.Page<SKU>searchSkusPaged(java.lang.String requestJson)Deprecated.java.util.List<SkuDTO>searchWithProductFilter(java.lang.String query, java.lang.String productId, java.lang.String offset, java.lang.String limit)This method does search requests and returns data as list.SKUupdateMetaInfo(java.lang.String skuId, java.util.LinkedHashMap<java.lang.String,java.lang.Object> metaInfo)Updates the meta information of a SKU with the given SKU ID.voiduploadSKU(java.io.File file, java.lang.String lang, java.lang.String username)Uploads a file with SKU information to the system.
-
-
-
Field Detail
-
translationsRepository
@Autowired private TranslationsRepository translationsRepository
-
languageRepository
@Autowired private LanguageRepository languageRepository
-
sellerSkuRepository
@Autowired private SellerSkuRepository sellerSkuRepository
-
categoryRepository
@Autowired private CategoryRepository categoryRepository
-
skuRepository
@Autowired private SKURepository skuRepository
-
productRepository
@Autowired private ProductRepository productRepository
-
attributeRepository
@Autowired private AttributeRepository attributeRepository
-
translationService
@Autowired private TranslationService translationService
-
sequenceGenerator
@Autowired private SequenceGeneratorService sequenceGenerator
-
accessManagementService
@Autowired private AccessManagementService accessManagementService
-
storageService
@Autowired private MongoStorageService storageService
-
mongoTemplate
@Autowired private org.springframework.data.mongodb.core.MongoTemplate mongoTemplate
-
webSocketService
@Autowired private WebSocketService webSocketService
-
jobService
@Autowired private JobsManagementService jobService
-
commonProperties
@Autowired private CommonProperties commonProperties
-
mapper
private static final com.fasterxml.jackson.databind.ObjectMapper mapper
-
-
Method Detail
-
getRepository
public SKURepository getRepository()
- Specified by:
getRepositoryin interfaceSKUService
-
getPaginationFilter
@Deprecated public java.util.Deque<java.util.Map<java.lang.String,java.lang.Object>> getPaginationFilter(java.lang.String requestJson)
Deprecated.Description copied from interface:SKUServiceThis method does calculation for a pages based on the request.- Specified by:
getPaginationFilterin interfaceSKUService- Parameters:
requestJson- JSON-object of request contains an instructions for search queries- Returns:
- map-representation of data
-
searchSKUs
public co.mastermindcms.modules.beans.SearchResponse searchSKUs(java.util.LinkedHashMap<java.lang.String,java.lang.Object> requestJson)
Description copied from interface:SKUServiceThis method does search requests and returns data as list.- Specified by:
searchSKUsin interfaceSKUService- Parameters:
requestJson- search request- Returns:
- data transport entities as list
-
searchSkusLightweight
public co.mastermindcms.modules.beans.SearchResponse searchSkusLightweight(java.util.LinkedHashMap<java.lang.String,java.lang.Object> requestJson)
Description copied from interface:SKUServiceRetrieves lightweight skus based on the given request JSON.- Specified by:
searchSkusLightweightin interfaceSKUService- Parameters:
requestJson- a LinkedHashMap containing the request parameters- Returns:
- a SearchResponse object containing the lightweight skus
-
searchSKUs
@Deprecated public java.util.LinkedHashSet<SkuDTO> searchSKUs(java.lang.String requestJson)
Deprecated.Description copied from interface:SKUServiceThis method does search requests and returns data as list.- Specified by:
searchSKUsin interfaceSKUService- Parameters:
requestJson- search request- Returns:
- data transport entities as list
-
searchSkusPaged
@Deprecated public org.springframework.data.domain.Page<SKU> searchSkusPaged(java.lang.String requestJson)
Deprecated.Description copied from interface:SKUServiceThis method does search requests and returns data as pages.- Specified by:
searchSkusPagedin interfaceSKUService- Parameters:
requestJson- JSON-object of request contains an instructions for search queries- Returns:
- database entities separated to pages
-
findById
public SKU findById(java.lang.String skuId)
Description copied from interface:SKUServiceThis method does search requests and returns data as list.- Specified by:
findByIdin interfaceSKUService- Parameters:
skuId- sku unique id- Returns:
- database entity as object
-
searchSKUs
@Deprecated public java.util.List<SkuDTO> searchSKUs(java.lang.String query, java.lang.String offset, java.lang.String limit)
Deprecated.Description copied from interface:SKUServiceThis method does search requests and returns data as list.- Specified by:
searchSKUsin interfaceSKUService- Parameters:
query- search queryoffset- offset for returned itemslimit- limit for returned items- Returns:
- database entities as list
-
searchWithProductFilter
public java.util.List<SkuDTO> searchWithProductFilter(java.lang.String query, java.lang.String productId, java.lang.String offset, java.lang.String limit)
Description copied from interface:SKUServiceThis method does search requests and returns data as list.- Specified by:
searchWithProductFilterin interfaceSKUService- Parameters:
query- search queryproductId- field "_id" for filter and return itemsoffset- offset for returned itemslimit- limit for returned items- Returns:
- database entities as list
-
findSKUs
public java.util.List<SKU> findSKUs()
Description copied from interface:SKUServiceThis method returns database entities as list.- Specified by:
findSKUsin interfaceSKUService- Returns:
- database entities as list
-
getCategoriesBySkuId
public java.util.List<Category> getCategoriesBySkuId(java.lang.String skuId)
Description copied from interface:SKUServiceThis method retrieves a map, which can be processed in a templates.- Specified by:
getCategoriesBySkuIdin interfaceSKUService- Parameters:
skuId- identification for database entity which will be retrieved- Returns:
- map-representation of data
-
createSKU
@Transactional public java.util.Optional<SKU> createSKU(java.util.LinkedHashMap<java.lang.String,java.lang.Object> skuAsMap)
Description copied from interface:SKUServiceThis method creates a database entity.- Specified by:
createSKUin interfaceSKUService- Parameters:
skuAsMap- map-representation of database entity- Returns:
- database entity
-
createSKU
public java.util.Optional<SKU> createSKU(SKU sku)
Description copied from interface:SKUServiceThis method creates a database entity.- Specified by:
createSKUin interfaceSKUService- Parameters:
sku- map-representation of database entity- Returns:
- database entity
-
addSKUToProduct
@Transactional public SKU addSKUToProduct(java.lang.String productId, java.util.LinkedHashMap<java.lang.String,java.lang.Object> skuAsMap)
Description copied from interface:SKUServiceThis method does a relationship between entities.- Specified by:
addSKUToProductin interfaceSKUService- Parameters:
productId- identification for database entity which will be updatedskuAsMap- map-representation of database entity- Returns:
- database entity
-
saveSKU
@Transactional public SKU saveSKU(java.util.LinkedHashMap<java.lang.String,java.lang.Object> skuAsMap)
Description copied from interface:SKUServiceThis method save an updates of database entity.- Specified by:
saveSKUin interfaceSKUService- Parameters:
skuAsMap- map-representation of database entity- Returns:
- saved instance of database entity
-
saveSKU
@Transactional public SKU saveSKU(SKU sku)
Description copied from interface:SKUServiceThis method saves a database entity.- Specified by:
saveSKUin interfaceSKUService- Parameters:
sku- database entity- Returns:
- saved instance of database entity
-
addRelations
private void addRelations(SKU skuUI)
-
removeSKUFromAttribute
@Transactional public void removeSKUFromAttribute(java.lang.String skuId, java.lang.String attributeId)Description copied from interface:SKUServiceThis method removes relationship between database entities.- Specified by:
removeSKUFromAttributein interfaceSKUService- Parameters:
skuId- identification for database entity which will be removedattributeId- identification for database entity which will be updated
-
removeSKUFromAttributes
@Transactional public void removeSKUFromAttributes(java.lang.String skuId)
Description copied from interface:SKUServiceThis method removes relationship between database entities.- Specified by:
removeSKUFromAttributesin interfaceSKUService- Parameters:
skuId- identification for database entity which will be removed
-
removeSKUFromSellerSKU
@Transactional public void removeSKUFromSellerSKU(java.lang.String skuId, java.lang.String sellerSkuId)Description copied from interface:SKUServiceThis method removes relationship between database entities.- Specified by:
removeSKUFromSellerSKUin interfaceSKUService- Parameters:
skuId- identification for database entity which will be removedsellerSkuId- identification for database entity which will be updated
-
removeSKUFromSellerSKUs
@Transactional public void removeSKUFromSellerSKUs(java.lang.String skuId)
Description copied from interface:SKUServiceThis method removes relationship between database entities.- Specified by:
removeSKUFromSellerSKUsin interfaceSKUService- Parameters:
skuId- identification for database entity which will be removed
-
removeSKUFromProduct
@Transactional public void removeSKUFromProduct(java.lang.String skuId, java.lang.String productId)Description copied from interface:SKUServiceThis method removes relationship between database entities.- Specified by:
removeSKUFromProductin interfaceSKUService- Parameters:
skuId- identification for database entity which will be removedproductId- identification for database entity which will be updated
-
removeSKUFromProducts
@Transactional public void removeSKUFromProducts(java.lang.String skuId)
Description copied from interface:SKUServiceThis method removes relationship between database entities.- Specified by:
removeSKUFromProductsin interfaceSKUService- Parameters:
skuId- identification for database entity which will be removed
-
removeSKUFromTranslation
@Transactional public void removeSKUFromTranslation(java.lang.String skuId, java.lang.String translationId)Description copied from interface:SKUServiceThis method removes relationship between database entities.- Specified by:
removeSKUFromTranslationin interfaceSKUService- Parameters:
skuId- identification for database entity which will be removedtranslationId- identification for database entity which will be updated
-
removeSKUFromTranslations
@Transactional public void removeSKUFromTranslations(java.lang.String skuId)
Description copied from interface:SKUServiceThis method removes relationship between database entities.- Specified by:
removeSKUFromTranslationsin interfaceSKUService- Parameters:
skuId- identification for database entity which will be removed
-
removeSKUAndClean
@Transactional public void removeSKUAndClean(java.lang.String skuId)
Description copied from interface:SKUServiceThis method removes a database entity and clean all relationships from another entities.- Specified by:
removeSKUAndCleanin interfaceSKUService- Parameters:
skuId- identification for database entity which will be removed
-
removeSkusByIds
@Transactional public void removeSkusByIds(java.util.ArrayList<java.lang.String> skusIds)
Description copied from interface:SKUServiceThis method removes a list of database entities.- Specified by:
removeSkusByIdsin interfaceSKUService- Parameters:
skusIds- the list of database entities which will be removed
-
isSKUExists
public boolean isSKUExists(java.lang.String name)
Description copied from interface:SKUServiceThis method checks is exists database entity.- Specified by:
isSKUExistsin interfaceSKUService- Parameters:
name- field "name" for database entity which will be checked- Returns:
- value as boolean
-
getSortedProductSkus
@Transactional public java.util.List<java.util.Map<java.lang.String,java.lang.String>> getSortedProductSkus(java.lang.String productId)
Description copied from interface:SKUServiceThis method sorted and retrieves a map, which can be processed in a templates.- Specified by:
getSortedProductSkusin interfaceSKUService- Parameters:
productId- identification for database entity which will be retrieved- Returns:
- map-representation of data
-
getSkusByProductAndFirstLetter
public java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getSkusByProductAndFirstLetter(java.lang.String productId, java.lang.String firstLetter)Description copied from interface:SKUServiceThis method retrieves a map, which can be processed in a templates.- Specified by:
getSkusByProductAndFirstLetterin interfaceSKUService- Parameters:
productId- identification for database entity which will be retrievedfirstLetter- first letter of the name for the sku- Returns:
- map-representation of data
-
mapSkuToDto
@Deprecated public SkuDTO mapSkuToDto(SKU sku, boolean optimal)
Deprecated.Description copied from interface:SKUServiceThis method does map product entity to dto object- Specified by:
mapSkuToDtoin interfaceSKUService- Parameters:
sku- database entity which be used to map to dtooptimal- this pointer optimises the data transfer object- Returns:
- data transport object
-
uploadSKU
@Async("asyncTaskExecutor") public void uploadSKU(java.io.File file, java.lang.String lang, java.lang.String username)Description copied from interface:SKUServiceUploads a file with SKU information to the system.- Specified by:
uploadSKUin interfaceSKUService- Parameters:
file- the file containing SKU information to be uploadedlang- the language for SKU informationusername- the username of the user uploading the SKU information
-
updateMetaInfo
public SKU updateMetaInfo(java.lang.String skuId, java.util.LinkedHashMap<java.lang.String,java.lang.Object> metaInfo)
Description copied from interface:SKUServiceUpdates the meta information of a SKU with the given SKU ID.- Specified by:
updateMetaInfoin interfaceSKUService- Parameters:
skuId- the ID of the SKU to updatemetaInfo- a LinkedHashMap containing the new meta information for the SKU- Returns:
- the updated SKU object with the new meta information
-
getFallIntoProducts
public java.util.LinkedHashSet<EmbeddedBean> getFallIntoProducts(java.lang.String[] productIds)
Description copied from interface:SKUServiceThis method returns data as set.- Specified by:
getFallIntoProductsin interfaceSKUService- Parameters:
productIds- the list of database entities which will be retrieved- Returns:
- database entities as list
-
-