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 BlogCategoryService
blogCategoryService
private ContentContainerRepository
contentContainerRepository
private static com.fasterxml.jackson.databind.ObjectMapper
mapper
private org.springframework.data.mongodb.core.MongoTemplate
mongoTemplate
private SequenceGeneratorService
sequenceGenerator
private MongoStorageService
storageService
private TranslationService
translationService
private UserManagementService
userManagementService
-
Constructor Summary
Constructors Constructor Description ContentContainerServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private ContentContainer
convertToContentContainer(java.util.LinkedHashMap<java.lang.String,java.lang.Object> blogAsMap)
void
createContainer(ContentContainer contentContainer)
This method creates a database entity.void
createContainer(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.ContentContainerRepository
getRepository()
void
removeArticles(java.lang.String blogId, java.util.ArrayList<java.lang.String> articleIds)
This method removes a list of database entities.void
removeContainerAndClean(java.lang.String blogId)
This method removes a database entity and clean all relationships from another entities.void
removeContainersByIds(java.util.ArrayList<java.lang.String> blogsIds)
This method removes a list of database entities.ContentContainer
saveContainer(ContentContainer container)
This method save an updates of database entity.ContentContainer
saveContainer(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:
getRepository
in interfaceContentContainerService
-
createContainer
public void createContainer(java.util.LinkedHashMap<java.lang.String,java.lang.Object> blogAsMap)
Description copied from interface:ContentContainerService
This method creates a database entity from a map-representation.- Specified by:
createContainer
in interfaceContentContainerService
- Parameters:
blogAsMap
- map-representation of database entity
-
createContainer
public void createContainer(ContentContainer contentContainer)
Description copied from interface:ContentContainerService
This method creates a database entity.- Specified by:
createContainer
in 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:ContentContainerService
This method save an updates of database entity.- Specified by:
saveContainer
in 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:ContentContainerService
This method save an updates of database entity.- Specified by:
saveContainer
in 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:ContentContainerService
This method removes a list of database entities.- Specified by:
removeArticles
in 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:ContentContainerService
This method retrieves a map, which can be processed in a templates.- Specified by:
getContainerArticles
in 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:ContentContainerService
This method retrieves a map, which can be processed in a templates.- Specified by:
getArticles
in 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:ContentContainerService
This method removes a list of database entities.- Specified by:
removeContainersByIds
in 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:ContentContainerService
This method removes a database entity and clean all relationships from another entities.- Specified by:
removeContainerAndClean
in 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:ContentContainerService
This method does calculation for a pages based on the request.- Specified by:
getContainerPaginationFilter
in 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:ContentContainerService
This method does search requests and returns data as pages.- Specified by:
searchContainerResultsPaged
in 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:ContentContainerService
This method does search requests and returns data as list.- Specified by:
searchContainersResults
in 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:ContentContainerService
This method retrieves a map, which can be processed in a templates.- Specified by:
getContainerTypes
in interfaceContentContainerService
- Returns:
- map-representation of data
-
convertToContentContainer
private ContentContainer convertToContentContainer(java.util.LinkedHashMap<java.lang.String,java.lang.Object> blogAsMap)
-
-