Class CategoryServiceImpl
- java.lang.Object
-
- co.mastermindcms.modules.services.CategoryServiceImpl
-
- All Implemented Interfaces:
CategoryService
@Service public class CategoryServiceImpl extends java.lang.Object implements CategoryService
-
-
Field Summary
Fields Modifier and Type Field Description private AccessManagementServiceaccessManagementServiceprivate CategoryRepositorycategoryRepositoryprivate CommonPropertiescommonPropertiesprivate LanguageRepositorylanguageRepositoryprivate static com.fasterxml.jackson.databind.ObjectMappermapperprivate org.springframework.data.mongodb.core.MongoTemplatemongoTemplateprivate ProductServiceproductServiceprivate SequenceGeneratorServicesequenceGeneratorprivate MongoStorageServicestorageServiceprivate TranslationServicetranslationServiceprivate TranslationsRepositorytranslationsRepository
-
Constructor Summary
Constructors Constructor Description CategoryServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description CategoryaddChildCategory(java.lang.String parentId, java.lang.String childId)This method does add child entity in parent entity.private voidaddRelations(Category categoryUI)java.util.Optional<Category>createCategory(Category category)This method creates a database entity.java.util.Optional<Category>createCategory(java.util.LinkedHashMap<java.lang.String,java.lang.Object> categoryAsMap)This method creates a database entity.java.util.Deque<java.util.Map<java.lang.String,java.lang.Object>>getPaginationFilter(java.lang.String requestJson)Deprecated.CategoryRepositorygetRepository()java.util.List<java.lang.String>lookupToParents(java.lang.String categoryId, java.util.List<java.lang.String> result)Deprecated.CategoryDTOmapCategoryToDto(Category category, boolean optimal)Deprecated.private voidprepareRelations(Category categoryUI, Category categoryDB)java.util.List<Category>rebuildAllCategories(java.util.ArrayList<java.lang.Object> categories)This method rebuilds a list of database entities.voidremoveCategoriesByIds(java.util.ArrayList<java.lang.String> categoriesIds)This method removes a list of database entities.voidremoveCategoryFromTranslation(java.lang.String categoryId, java.lang.String translationId)This method removes relationship between database entities.voidremoveCategoryWithDescendants(java.lang.String itemId)This method removes database entity with child database entity.voidremoveChildCategory(java.lang.String parentId, java.lang.String childId)This method does delete child entity in parent entity.private voidremoveRelations(Category categoryUI, Category categoryDB)java.util.LinkedHashSet<CategoryDTO>searchCategories(java.lang.String requestJson)Deprecated.java.util.List<Category>searchCategories(java.lang.String query, java.lang.String from, java.lang.String to)Deprecated.co.mastermindcms.modules.beans.SearchResponsesearchCategories(java.util.LinkedHashMap<java.lang.String,java.lang.Object> requestJson)This method does search requests and returns data as list.co.mastermindcms.modules.beans.SearchResponsesearchCategoriesLightweight(java.util.LinkedHashMap<java.lang.String,java.lang.Object> requestJson)Retrieves lightweight categories based on the given request JSON.org.springframework.data.domain.Page<Category>searchCategoriesPaged(java.lang.String requestJson)Deprecated.CategoryupdateCategory(Category category)This method updates of database entity.CategoryupdateCategory(java.util.LinkedHashMap<java.lang.String,java.lang.Object> categoryAsMap)This method updates of database entity.
-
-
-
Field Detail
-
translationsRepository
@Autowired private TranslationsRepository translationsRepository
-
languageRepository
@Autowired private LanguageRepository languageRepository
-
categoryRepository
@Autowired private CategoryRepository categoryRepository
-
productService
@Autowired private ProductService productService
-
translationService
@Autowired private TranslationService translationService
-
storageService
@Autowired private MongoStorageService storageService
-
accessManagementService
@Autowired private AccessManagementService accessManagementService
-
commonProperties
@Autowired private CommonProperties commonProperties
-
mongoTemplate
@Autowired private org.springframework.data.mongodb.core.MongoTemplate mongoTemplate
-
sequenceGenerator
@Autowired private SequenceGeneratorService sequenceGenerator
-
mapper
private static final com.fasterxml.jackson.databind.ObjectMapper mapper
-
-
Method Detail
-
getRepository
public CategoryRepository getRepository()
- Specified by:
getRepositoryin interfaceCategoryService
-
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:CategoryServiceThis method does calculation for a pages based on the request.- Specified by:
getPaginationFilterin interfaceCategoryService- Parameters:
requestJson- JSON-object of request contains an instructions for search queries- Returns:
- map-representation of data
-
searchCategories
public co.mastermindcms.modules.beans.SearchResponse searchCategories(java.util.LinkedHashMap<java.lang.String,java.lang.Object> requestJson)
Description copied from interface:CategoryServiceThis method does search requests and returns data as list.- Specified by:
searchCategoriesin interfaceCategoryService- Parameters:
requestJson- search request- Returns:
- database entities separated to pages
-
searchCategoriesLightweight
public co.mastermindcms.modules.beans.SearchResponse searchCategoriesLightweight(java.util.LinkedHashMap<java.lang.String,java.lang.Object> requestJson)
Description copied from interface:CategoryServiceRetrieves lightweight categories based on the given request JSON.- Specified by:
searchCategoriesLightweightin interfaceCategoryService- Parameters:
requestJson- a LinkedHashMap containing the request parameters- Returns:
- a SearchResponse object containing the lightweight categories
-
searchCategories
@Deprecated public java.util.LinkedHashSet<CategoryDTO> searchCategories(java.lang.String requestJson)
Deprecated.Description copied from interface:CategoryServiceThis method does search requests and returns data as list.- Specified by:
searchCategoriesin interfaceCategoryService- Parameters:
requestJson- search request- Returns:
- data transport entities as list
-
searchCategoriesPaged
@Deprecated public org.springframework.data.domain.Page<Category> searchCategoriesPaged(java.lang.String requestJson)
Deprecated.Description copied from interface:CategoryServiceThis method does search requests and returns data as pages.- Specified by:
searchCategoriesPagedin interfaceCategoryService- Parameters:
requestJson- JSON-object of request contains an instructions for search queries- Returns:
- database entities separated to pages
-
searchCategories
@Deprecated public java.util.List<Category> searchCategories(java.lang.String query, java.lang.String from, java.lang.String to)
Deprecated.Description copied from interface:CategoryServiceThis method does search requests and returns data as list.- Specified by:
searchCategoriesin interfaceCategoryService- Parameters:
query- search queryfrom- field which filter and returned itemsto- field which filter and returned items- Returns:
- database entities as list
-
createCategory
@Transactional public java.util.Optional<Category> createCategory(java.util.LinkedHashMap<java.lang.String,java.lang.Object> categoryAsMap)
Description copied from interface:CategoryServiceThis method creates a database entity.- Specified by:
createCategoryin interfaceCategoryService- Parameters:
categoryAsMap- map-representation of database entity- Returns:
- optional value to externally interaction
-
createCategory
public java.util.Optional<Category> createCategory(Category category)
Description copied from interface:CategoryServiceThis method creates a database entity.- Specified by:
createCategoryin interfaceCategoryService- Parameters:
category- database entity- Returns:
- optional value to externally interaction
-
addChildCategory
@Transactional public Category addChildCategory(java.lang.String parentId, java.lang.String childId)
Description copied from interface:CategoryServiceThis method does add child entity in parent entity.- Specified by:
addChildCategoryin interfaceCategoryService- Parameters:
parentId- identification for database entity which will be updatedchildId- identification for database entity which will be added in parent database entity- Returns:
- database entity
-
removeChildCategory
public void removeChildCategory(java.lang.String parentId, java.lang.String childId)Description copied from interface:CategoryServiceThis method does delete child entity in parent entity.- Specified by:
removeChildCategoryin interfaceCategoryService- Parameters:
parentId- identification for database entity which will be updatedchildId- identification for database entity which will be added in parent database entity
-
updateCategory
@Transactional public Category updateCategory(java.util.LinkedHashMap<java.lang.String,java.lang.Object> categoryAsMap)
Description copied from interface:CategoryServiceThis method updates of database entity.- Specified by:
updateCategoryin interfaceCategoryService- Parameters:
categoryAsMap- map-representation of database entity- Returns:
- updated instance of database entity
-
updateCategory
@Transactional public Category updateCategory(Category category)
Description copied from interface:CategoryServiceThis method updates of database entity.- Specified by:
updateCategoryin interfaceCategoryService- Parameters:
category- database entity which will be updated- Returns:
- updated instance of database entity
-
addRelations
private void addRelations(Category categoryUI)
-
removeCategoryFromTranslation
@Transactional public void removeCategoryFromTranslation(java.lang.String categoryId, java.lang.String translationId)Description copied from interface:CategoryServiceThis method removes relationship between database entities.- Specified by:
removeCategoryFromTranslationin interfaceCategoryService- Parameters:
categoryId- identification for database entity which will be removedtranslationId- identification for database entity which will be updated
-
removeCategoryWithDescendants
@Transactional public void removeCategoryWithDescendants(java.lang.String itemId)
Description copied from interface:CategoryServiceThis method removes database entity with child database entity.- Specified by:
removeCategoryWithDescendantsin interfaceCategoryService- Parameters:
itemId- identification for child database entity which will be removed and whose parent entity will be removed
-
removeCategoriesByIds
@Transactional public void removeCategoriesByIds(java.util.ArrayList<java.lang.String> categoriesIds)
Description copied from interface:CategoryServiceThis method removes a list of database entities.- Specified by:
removeCategoriesByIdsin interfaceCategoryService- Parameters:
categoriesIds- the list of database entities which will be removed
-
rebuildAllCategories
@Transactional public java.util.List<Category> rebuildAllCategories(java.util.ArrayList<java.lang.Object> categories)
Description copied from interface:CategoryServiceThis method rebuilds a list of database entities.- Specified by:
rebuildAllCategoriesin interfaceCategoryService- Parameters:
categories- the list of database entities which will be removed and updated- Returns:
- list of categories
-
mapCategoryToDto
@Deprecated public CategoryDTO mapCategoryToDto(Category category, boolean optimal)
Deprecated.Description copied from interface:CategoryServiceThis method does map category entity to dto object- Specified by:
mapCategoryToDtoin interfaceCategoryService- Parameters:
category- database entity which be used to map to dtooptimal- this pointer optimises the data transfer object- Returns:
- data transport object
-
lookupToParents
@Deprecated public java.util.List<java.lang.String> lookupToParents(java.lang.String categoryId, java.util.List<java.lang.String> result)Deprecated.Description copied from interface:CategoryServiceThis method does call to collect all parent ids- Specified by:
lookupToParentsin interfaceCategoryService- Parameters:
categoryId- identification of entity objectresult- the collection which will be used to collect all parent ids- Returns:
- the list of ids
-
-