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 BlogCategoryRepositoryblogCategoryRepositoryprivate ContentContainerRepositorycontentContainerRepositoryprivate static com.fasterxml.jackson.databind.ObjectMappermapperprivate SequenceGeneratorServicesequenceGeneratorprivate TranslationsRepositorytranslationsRepository
-
Constructor Summary
Constructors Constructor Description BlogCategoryServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BlogCategoryaddChildCategory(java.lang.String parentId, java.lang.String childId)This method does add child entity in parent entity.private voidaddRelations(BlogCategory categoryUI)java.util.Optional<BlogCategory>createCategory(java.util.LinkedHashMap<java.lang.String,java.lang.Object> categoryAsMap)This method creates a database entity.BlogCategoryRepositorygetRepository()private voidprepareRelations(BlogCategory categoryUI, BlogCategory categoryDB)java.util.List<BlogCategory>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.voidremoveContainerFromBlogCategory(java.lang.String containerId, java.lang.String categoryId)This method removes relationship between database entities.private voidremoveRelations(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.BlogCategoryupdateCategory(BlogCategory category)This method updates of database entity.BlogCategoryupdateCategory(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:
getRepositoryin interfaceBlogCategoryService
-
searchCategories
public java.util.List<BlogCategory> searchCategories(java.lang.String query, java.lang.String from, java.lang.String to)
Description copied from interface:BlogCategoryServiceThis method does search requests and returns data as list.- Specified by:
searchCategoriesin 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:BlogCategoryServiceThis method creates a database entity.- Specified by:
createCategoryin 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:BlogCategoryServiceThis method does add child entity in parent entity.- Specified by:
addChildCategoryin 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:BlogCategoryServiceThis method updates of database entity.- Specified by:
updateCategoryin 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:BlogCategoryServiceThis method updates of database entity.- Specified by:
updateCategoryin 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:BlogCategoryServiceThis method removes relationship between database entities.- Specified by:
removeCategoryFromTranslationin 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:BlogCategoryServiceThis method removes database entity with child database entity.- Specified by:
removeCategoryWithDescendantsin 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:BlogCategoryServiceThis method removes relationship between database entities.- Specified by:
removeContainerFromBlogCategoryin 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:BlogCategoryServiceThis method removes a list of database entities.- Specified by:
removeCategoriesByIdsin 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:BlogCategoryServiceThis method rebuilds a list of database entities.- Specified by:
rebuildAllCategoriesin interfaceBlogCategoryService- Parameters:
categories- the list of database entities which will be removed and updated- Returns:
- list of blog categories
-
-