Interface StructuredContentService
- All Known Implementing Classes:
StructuredContentServiceImpl
public interface StructuredContentService
Provides services to manage
StructuredContent
items.- Author:
- bpolster
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addStructuredContentListToCache
(String key, List<StructuredContentDTO> scDTOList) buildStructuredContentDTO
(StructuredContent sc, boolean secure) Converts a StructuredContent into a StructuredContentDTO.buildStructuredContentDTOList
(List<StructuredContent> structuredContentList, boolean secure) buildTypeKey
(SandBox currentSandbox, Long site, Locale locale, String contentType) Deprecated.buildTypeKeyWithSecure
(SandBox currentSandbox, Long site, Locale locale, String contentType, Boolean secure) Builds the cache key for DTOLists based on the SC Type.convertToDtos
(List<StructuredContent> scs, boolean isSecure) Converts a list of StructuredContent objects into their correspondingStructuredContentDTO
s.evaluateAndPriortizeContent
(List<StructuredContentDTO> structuredContentList, int count, Map<String, Object> ruleDTOs) Finds all content items regardless of theSandbox
they are a member offindLanguageOnlyLocale
(Locale locale) findStructuredContentById
(Long contentId) Returns the StructuredContent item associated with the passed in id.Returns theStructuredContentType
associated with the passed in id.Returns theStructuredContentType
associated with the passed in String value.javax.cache.Cache
getStructuredContentItemsByContentName
(String contentName, Locale locale, boolean isSecure) First attempts to retrieveStructuredContentDTO
from cache before making calls to databaselookupStructuredContentItemsByName
(String contentName, Locale locale, Integer count, Map<String, Object> ruleDTOs, boolean secure) This method returns content by name only.lookupStructuredContentItemsByName
(StructuredContentType contentType, String contentName, Locale locale, Integer count, Map<String, Object> ruleDTOs, boolean secure) This method returns content by name and type.lookupStructuredContentItemsByType
(StructuredContentType contentType, Locale locale, Integer count, Map<String, Object> ruleDTOs, boolean secure) This method returns content
Returns active content items for the passed in sandbox that match the passed in type.void
removeItemFromCache
(String nameKey, String typeKey) Deprecated.boolean
Call to evict both secure and non-secure SC items matching the passed in key.void
removeStructuredContentFromCache
(SandBox sandBox, StructuredContent sc) Call to evict an item from the cache.Saves the given type and returns the merged instance
-
Method Details
-
findStructuredContentById
Returns the StructuredContent item associated with the passed in id.- Parameters:
contentId
- - The id of the content item.- Returns:
- The associated structured content item.
-
findStructuredContentTypeById
Returns theStructuredContentType
associated with the passed in id.- Parameters:
id
- - The id of the content type.- Returns:
- The associated
StructuredContentType
.
-
findStructuredContentTypeByName
Returns theStructuredContentType
associated with the passed in String value.- Parameters:
name
- - The name of the content type.- Returns:
- The associated
StructuredContentType
.
-
retrieveAllStructuredContentTypes
List<StructuredContentType> retrieveAllStructuredContentTypes()- Returns:
- a list of all
StructuredContentType
s
-
findAllContentItems
List<StructuredContent> findAllContentItems()Finds all content items regardless of theSandbox
they are a member of- Returns:
-
saveStructuredContentType
Saves the given type and returns the merged instance -
lookupStructuredContentItemsByType
List<StructuredContentDTO> lookupStructuredContentItemsByType(StructuredContentType contentType, Locale locale, Integer count, Map<String, Object> ruleDTOs, boolean secure) This method returns content
Returns active content items for the passed in sandbox that match the passed in type.
The SandBox parameter impacts the results as follows. If aSandBoxType
of production is passed in, only those items in that SandBox are returned.
If a non-production SandBox is passed in, then the method will return the items associatd with the related production SandBox and then merge in the results of the passed in SandBox.
The secure item is used in cases where the structured content item contains an image path that needs to be rewritten to use https.- Parameters:
sandBox
- - the sandbox to find structured content items (null indicates items that are in production for sites that are single tenant.contentType
- - the type of content to returncount
- - the max number of content items to returnruleDTOs
- - a Map of objects that will be used in MVEL processing.secure
- - set to true if the request is being served over https- Returns:
- - The matching items
- See Also:
-
org.broadleafcommerce.cms.web.structure.DisplayContentTag
-
lookupStructuredContentItemsByName
List<StructuredContentDTO> lookupStructuredContentItemsByName(String contentName, Locale locale, Integer count, Map<String, Object> ruleDTOs, boolean secure) This method returns content by name only.
Returns active content items for the passed in sandbox that match the passed in type.
The SandBox parameter impacts the results as follows. If aSandBoxType
of production is passed in, only those items in that SandBox are returned.
If a non-production SandBox is passed in, then the method will return the items associatd with the related production SandBox and then merge in the results of the passed in SandBox.- Parameters:
sandBox
- - the sandbox to find structured content items (null indicates items that are in production for sites that are single tenant.contentName
- - the name of content to returncount
- - the max number of content items to returnruleDTOs
- - a Map of objects that will be used in MVEL processing.secure
- - set to true if the request is being served over https- Returns:
- - The matching items
- See Also:
-
org.broadleafcommerce.cms.web.structure.DisplayContentTag
-
lookupStructuredContentItemsByName
List<StructuredContentDTO> lookupStructuredContentItemsByName(StructuredContentType contentType, String contentName, Locale locale, Integer count, Map<String, Object> ruleDTOs, boolean secure) This method returns content by name and type.
Returns active content items for the passed in sandbox that match the passed in type.
The SandBox parameter impacts the results as follows. If aSandBoxType
of production is passed in, only those items in that SandBox are returned.
If a non-production SandBox is passed in, then the method will return the items associatd with the related production SandBox and then merge in the results of the passed in SandBox.- Parameters:
sandBox
- - the sandbox to find structured content items (null indicates items that are in production for sites that are single tenant.contentType
- - the type of content to returncontentName
- - the name of content to returncount
- - the max number of content items to returnruleDTOs
- - a Map of objects that will be used in MVEL processing.secure
- - set to true if the request is being served over https- Returns:
- - The matching items
- See Also:
-
org.broadleafcommerce.cms.web.structure.DisplayContentTag
-
findLanguageOnlyLocale
-
buildStructuredContentDTOList
List<StructuredContentDTO> buildStructuredContentDTOList(List<StructuredContent> structuredContentList, boolean secure) -
evaluateAndPriortizeContent
List<StructuredContentDTO> evaluateAndPriortizeContent(List<StructuredContentDTO> structuredContentList, int count, Map<String, Object> ruleDTOs) -
getStructuredContentCache
javax.cache.Cache getStructuredContentCache() -
buildStructuredContentDTO
Converts a StructuredContent into a StructuredContentDTO. If the item contains fields with broadleaf cms urls, the urls are converted to utilize the domain.The StructuredContentDTO is built via the
EntityConfiguration
. To override the actual type that is returned, include an override in an applicationContext like any other entity override.- Parameters:
sc
-secure
-- Returns:
-
addStructuredContentListToCache
-
buildTypeKey
@Deprecated String buildTypeKey(SandBox currentSandbox, Long site, Locale locale, String contentType) Deprecated.Builds the cache key for DTOLists based on the SC Type.- Parameters:
currentSandbox
-site
-locale
-contentType
-- Returns:
- cache key for DTOList
-
buildTypeKeyWithSecure
String buildTypeKeyWithSecure(SandBox currentSandbox, Long site, Locale locale, String contentType, Boolean secure) Builds the cache key for DTOLists based on the SC Type.- Parameters:
currentSandbox
-site
-locale
-contentType
-secure
-- Returns:
- cache key for DTOList
-
getStructuredContentListFromCache
-
removeStructuredContentFromCache
Call to evict an item from the cache.- Parameters:
sandBox
-sc
-
-
removeItemFromCache
Deprecated.Call to evict both secure and non-secure SC items matching the passed in keys.- Parameters:
nameKey
-typeKey
-
-
removeItemFromCacheByKey
Call to evict both secure and non-secure SC items matching the passed in key.- Parameters:
key
-- Returns:
-
convertToDtos
Converts a list of StructuredContent objects into their correspondingStructuredContentDTO
s. This method will utilize a cache in production mode, and it will additionally hydrate the returnedStructuredContentDTO
objects via the#hydrateForeignLookups(List)
method.- Parameters:
scs
-- Returns:
- the list of
StructuredContentDTO
s
-
getStructuredContentItemsByContentName
List<StructuredContentDTO> getStructuredContentItemsByContentName(String contentName, Locale locale, boolean isSecure) First attempts to retrieveStructuredContentDTO
from cache before making calls to database- Parameters:
contentName
- (Name of ContentItemlocale
-isSecure
-- Returns:
-
buildTypeKeyWithSecure(SandBox, Long, Locale, String, Boolean)