Class BlogCategoryServiceImpl
- java.lang.Object
-
- co.mastermindcms.modules.services.BlogCategoryServiceImpl
-
- All Implemented Interfaces:
BlogCategoryService
@Service public class BlogCategoryServiceImpl extends java.lang.Object implements BlogCategoryService
-
-
Field Summary
Fields Modifier and Type Field Description private BlogCategoryRepository
blogCategoryRepository
private ContentContainerRepository
contentContainerRepository
private static com.fasterxml.jackson.databind.ObjectMapper
mapper
private SequenceGeneratorService
sequenceGenerator
private TranslationsRepository
translationsRepository
-
Constructor Summary
Constructors Constructor Description BlogCategoryServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BlogCategory
addChildCategory(java.lang.String parentId, java.lang.String childId)
This method does add child entity in parent entity.private void
addRelations(BlogCategory categoryUI)
java.util.Optional<BlogCategory>
createCategory(java.util.LinkedHashMap<java.lang.String,java.lang.Object> categoryAsMap)
This method creates a database entity.BlogCategoryRepository
getRepository()
private void
prepareRelations(BlogCategory categoryUI, BlogCategory categoryDB)
java.util.List<BlogCategory>
rebuildAllCategories(java.util.ArrayList<java.lang.Object> categories)
This method rebuilds a list of database entities.void
removeCategoriesByIds(java.util.ArrayList<java.lang.String> categoriesIds)
This method removes a list of database entities.void
removeCategoryFromTranslation(java.lang.String categoryId, java.lang.String translationId)
This method removes relationship between database entities.void
removeCategoryWithDescendants(java.lang.String itemId)
This method removes database entity with child database entity.void
removeContainerFromBlogCategory(java.lang.String containerId, java.lang.String categoryId)
This method removes relationship between database entities.private void
removeRelations(BlogCategory categoryUI, BlogCategory categoryDB)
java.util.List<BlogCategory>
searchCategories(java.lang.String query, java.lang.String from, java.lang.String to)
This method does search requests and returns data as list.BlogCategory
updateCategory(BlogCategory category)
This method updates of database entity.BlogCategory
updateCategory(java.util.LinkedHashMap<java.lang.String,java.lang.Object> categoryAsMap)
This method updates of database entity.
-
-
-
Field Detail
-
translationsRepository
@Autowired private TranslationsRepository translationsRepository
-
blogCategoryRepository
@Autowired private BlogCategoryRepository blogCategoryRepository
-
contentContainerRepository
@Autowired private ContentContainerRepository contentContainerRepository
-
sequenceGenerator
@Autowired private SequenceGeneratorService sequenceGenerator
-
mapper
private static final com.fasterxml.jackson.databind.ObjectMapper mapper
-
-
Method Detail
-
getRepository
public BlogCategoryRepository getRepository()
- Specified by:
getRepository
in interfaceBlogCategoryService
-
searchCategories
public java.util.List<BlogCategory> searchCategories(java.lang.String query, java.lang.String from, java.lang.String to)
Description copied from interface:BlogCategoryService
This method does search requests and returns data as list.- Specified by:
searchCategories
in interfaceBlogCategoryService
- 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<BlogCategory> createCategory(java.util.LinkedHashMap<java.lang.String,java.lang.Object> categoryAsMap)
Description copied from interface:BlogCategoryService
This method creates a database entity.- Specified by:
createCategory
in interfaceBlogCategoryService
- Parameters:
categoryAsMap
- map-representation of database entity- Returns:
- optional value to externally interaction
-
addChildCategory
@Transactional public BlogCategory addChildCategory(java.lang.String parentId, java.lang.String childId)
Description copied from interface:BlogCategoryService
This method does add child entity in parent entity.- Specified by:
addChildCategory
in interfaceBlogCategoryService
- 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
-
updateCategory
@Transactional public BlogCategory updateCategory(java.util.LinkedHashMap<java.lang.String,java.lang.Object> categoryAsMap)
Description copied from interface:BlogCategoryService
This method updates of database entity.- Specified by:
updateCategory
in interfaceBlogCategoryService
- Parameters:
categoryAsMap
- map-representation of database entity- Returns:
- updated instance of database entity
-
updateCategory
@Transactional public BlogCategory updateCategory(BlogCategory category)
Description copied from interface:BlogCategoryService
This method updates of database entity.- Specified by:
updateCategory
in interfaceBlogCategoryService
- Parameters:
category
- database entity which will be updated- Returns:
- updated instance of database entity
-
prepareRelations
private void prepareRelations(BlogCategory categoryUI, BlogCategory categoryDB)
-
removeRelations
private void removeRelations(BlogCategory categoryUI, BlogCategory categoryDB)
-
addRelations
private void addRelations(BlogCategory categoryUI)
-
removeCategoryFromTranslation
@Transactional public void removeCategoryFromTranslation(java.lang.String categoryId, java.lang.String translationId)
Description copied from interface:BlogCategoryService
This method removes relationship between database entities.- Specified by:
removeCategoryFromTranslation
in interfaceBlogCategoryService
- 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:BlogCategoryService
This method removes database entity with child database entity.- Specified by:
removeCategoryWithDescendants
in interfaceBlogCategoryService
- Parameters:
itemId
- identification for child database entity which will be removed and whose parent entity will be removed
-
removeContainerFromBlogCategory
@Transactional public void removeContainerFromBlogCategory(java.lang.String containerId, java.lang.String categoryId)
Description copied from interface:BlogCategoryService
This method removes relationship between database entities.- Specified by:
removeContainerFromBlogCategory
in interfaceBlogCategoryService
- Parameters:
containerId
- identification for database entity which will be removedcategoryId
- identification for database entity which will be updated
-
removeCategoriesByIds
@Transactional public void removeCategoriesByIds(java.util.ArrayList<java.lang.String> categoriesIds)
Description copied from interface:BlogCategoryService
This method removes a list of database entities.- Specified by:
removeCategoriesByIds
in interfaceBlogCategoryService
- Parameters:
categoriesIds
- the list of database entities which will be removed
-
rebuildAllCategories
@Transactional public java.util.List<BlogCategory> rebuildAllCategories(java.util.ArrayList<java.lang.Object> categories)
Description copied from interface:BlogCategoryService
This method rebuilds a list of database entities.- Specified by:
rebuildAllCategories
in interfaceBlogCategoryService
- Parameters:
categories
- the list of database entities which will be removed and updated- Returns:
- list of blog categories
-
-