Class ContentContainerServiceImpl
- java.lang.Object
-
- co.mastermindcms.modules.services.ContentContainerServiceImpl
-
- All Implemented Interfaces:
ContentContainerService
@Service public class ContentContainerServiceImpl extends java.lang.Object implements ContentContainerService
-
-
Field Summary
Fields Modifier and Type Field Description private BlogCategoryServiceblogCategoryServiceprivate ContentContainerRepositorycontentContainerRepositoryprivate static com.fasterxml.jackson.databind.ObjectMappermapperprivate org.springframework.data.mongodb.core.MongoTemplatemongoTemplateprivate SequenceGeneratorServicesequenceGeneratorprivate MongoStorageServicestorageServiceprivate TranslationServicetranslationServiceprivate UserManagementServiceuserManagementService
-
Constructor Summary
Constructors Constructor Description ContentContainerServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private ContentContainerconvertToContentContainer(java.util.LinkedHashMap<java.lang.String,java.lang.Object> blogAsMap)voidcreateContainer(ContentContainer contentContainer)This method creates a database entity.voidcreateContainer(java.util.LinkedHashMap<java.lang.String,java.lang.Object> blogAsMap)This method creates a database entity from a map-representation.java.util.List<java.util.Map<java.lang.String,java.lang.Object>>getArticles(java.lang.String regex)This method retrieves a map, which can be processed in a templates.java.util.List<java.util.Map<java.lang.String,java.lang.String>>getContainerArticles(java.lang.String blogId)This method retrieves a map, which can be processed in a templates.java.util.Deque<java.util.Map<java.lang.String,java.lang.Object>>getContainerPaginationFilter(java.lang.String requestJson)This method does calculation for a pages based on the request.java.util.List<java.util.Map<java.lang.String,java.lang.Object>>getContainerTypes()This method retrieves a map, which can be processed in a templates.ContentContainerRepositorygetRepository()voidremoveArticles(java.lang.String blogId, java.util.ArrayList<java.lang.String> articleIds)This method removes a list of database entities.voidremoveContainerAndClean(java.lang.String blogId)This method removes a database entity and clean all relationships from another entities.voidremoveContainersByIds(java.util.ArrayList<java.lang.String> blogsIds)This method removes a list of database entities.ContentContainersaveContainer(ContentContainer container)This method save an updates of database entity.ContentContainersaveContainer(java.util.LinkedHashMap<java.lang.String,java.lang.Object> blogAsMap, java.lang.String blogId)This method save an updates of database entity.org.springframework.data.domain.Page<ContentContainer>searchContainerResultsPaged(java.lang.String requestJson)This method does search requests and returns data as pages.java.util.List<ContentContainer>searchContainersResults(java.lang.String requestJson)This method does search requests and returns data as list.
-
-
-
Field Detail
-
contentContainerRepository
@Autowired private ContentContainerRepository contentContainerRepository
-
blogCategoryService
@Autowired private BlogCategoryService blogCategoryService
-
translationService
@Autowired private TranslationService translationService
-
sequenceGenerator
@Autowired private SequenceGeneratorService sequenceGenerator
-
storageService
@Autowired private MongoStorageService storageService
-
mongoTemplate
@Autowired private org.springframework.data.mongodb.core.MongoTemplate mongoTemplate
-
userManagementService
@Autowired private UserManagementService userManagementService
-
mapper
private static final com.fasterxml.jackson.databind.ObjectMapper mapper
-
-
Method Detail
-
getRepository
public ContentContainerRepository getRepository()
- Specified by:
getRepositoryin interfaceContentContainerService
-
createContainer
public void createContainer(java.util.LinkedHashMap<java.lang.String,java.lang.Object> blogAsMap)
Description copied from interface:ContentContainerServiceThis method creates a database entity from a map-representation.- Specified by:
createContainerin interfaceContentContainerService- Parameters:
blogAsMap- map-representation of database entity
-
createContainer
public void createContainer(ContentContainer contentContainer)
Description copied from interface:ContentContainerServiceThis method creates a database entity.- Specified by:
createContainerin interfaceContentContainerService- Parameters:
contentContainer- database entity
-
saveContainer
@Transactional public ContentContainer saveContainer(java.util.LinkedHashMap<java.lang.String,java.lang.Object> blogAsMap, java.lang.String blogId)
Description copied from interface:ContentContainerServiceThis method save an updates of database entity.- Specified by:
saveContainerin interfaceContentContainerService- Parameters:
blogAsMap- map-representation of database entityblogId- identification for database entity which will be updated- Returns:
- saved instance of database entity
-
saveContainer
public ContentContainer saveContainer(ContentContainer container)
Description copied from interface:ContentContainerServiceThis method save an updates of database entity.- Specified by:
saveContainerin interfaceContentContainerService- Parameters:
container- database entity for a update- Returns:
- saved instance of database entity
-
removeArticles
@Transactional public void removeArticles(java.lang.String blogId, java.util.ArrayList<java.lang.String> articleIds)Description copied from interface:ContentContainerServiceThis method removes a list of database entities.- Specified by:
removeArticlesin interfaceContentContainerService- Parameters:
blogId- identification for database entity which will be updatedarticleIds- the list of database entities which will be removed
-
getContainerArticles
public java.util.List<java.util.Map<java.lang.String,java.lang.String>> getContainerArticles(java.lang.String blogId)
Description copied from interface:ContentContainerServiceThis method retrieves a map, which can be processed in a templates.- Specified by:
getContainerArticlesin interfaceContentContainerService- Parameters:
blogId- identification for database entity which will be retrieved- Returns:
- map-representation of data
-
getArticles
public java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getArticles(java.lang.String regex)
Description copied from interface:ContentContainerServiceThis method retrieves a map, which can be processed in a templates.- Specified by:
getArticlesin interfaceContentContainerService- Parameters:
regex- regexp for a filtering by "_id" field of database entity- Returns:
- map-representation of data
-
removeContainersByIds
@Transactional public void removeContainersByIds(java.util.ArrayList<java.lang.String> blogsIds)
Description copied from interface:ContentContainerServiceThis method removes a list of database entities.- Specified by:
removeContainersByIdsin interfaceContentContainerService- Parameters:
blogsIds- the list of database entities which will be removed
-
removeContainerAndClean
@Transactional public void removeContainerAndClean(java.lang.String blogId)
Description copied from interface:ContentContainerServiceThis method removes a database entity and clean all relationships from another entities.- Specified by:
removeContainerAndCleanin interfaceContentContainerService- Parameters:
blogId- identification for database entity which will be removed
-
getContainerPaginationFilter
public java.util.Deque<java.util.Map<java.lang.String,java.lang.Object>> getContainerPaginationFilter(java.lang.String requestJson)
Description copied from interface:ContentContainerServiceThis method does calculation for a pages based on the request.- Specified by:
getContainerPaginationFilterin interfaceContentContainerService- Parameters:
requestJson- JSON-object of request contains an instructions for search queries- Returns:
- map-representation of data
-
searchContainerResultsPaged
public org.springframework.data.domain.Page<ContentContainer> searchContainerResultsPaged(java.lang.String requestJson)
Description copied from interface:ContentContainerServiceThis method does search requests and returns data as pages.- Specified by:
searchContainerResultsPagedin interfaceContentContainerService- Parameters:
requestJson- JSON-object of request contains an instructions for search queries- Returns:
- database entities separated to pages
-
searchContainersResults
public java.util.List<ContentContainer> searchContainersResults(java.lang.String requestJson)
Description copied from interface:ContentContainerServiceThis method does search requests and returns data as list.- Specified by:
searchContainersResultsin interfaceContentContainerService- Parameters:
requestJson- JSON-object of request contains an instructions for search queries- Returns:
- database entities as list
-
getContainerTypes
public java.util.List<java.util.Map<java.lang.String,java.lang.Object>> getContainerTypes()
Description copied from interface:ContentContainerServiceThis method retrieves a map, which can be processed in a templates.- Specified by:
getContainerTypesin interfaceContentContainerService- Returns:
- map-representation of data
-
convertToContentContainer
private ContentContainer convertToContentContainer(java.util.LinkedHashMap<java.lang.String,java.lang.Object> blogAsMap)
-
-