@Service(value="blStructuredContentService") public class StructuredContentServiceImpl extends Object implements StructuredContentService
Modifier and Type | Field and Description |
---|---|
protected static String |
AND |
protected List<RuleProcessor<StructuredContentDTO>> |
contentRuleProcessors |
protected EntityConfiguration |
entityConfiguration |
protected StructuredContentServiceExtensionManager |
extensionManager |
protected LocaleService |
localeService |
protected static org.apache.commons.logging.Log |
LOG |
protected StaticAssetPathService |
staticAssetPathService |
protected StaticAssetService |
staticAssetService |
protected StatisticsService |
statisticsService |
protected net.sf.ehcache.Cache |
structuredContentCache |
protected StructuredContentDao |
structuredContentDao |
Constructor and Description |
---|
StructuredContentServiceImpl() |
Modifier and Type | Method and Description |
---|---|
void |
addStructuredContentListToCache(String key,
List<StructuredContentDTO> scDTOList) |
protected void |
buildFieldValues(StructuredContent sc,
StructuredContentDTO scDTO,
boolean secure)
Parses the given
StructuredContent into its StructuredContentDTO representation. |
protected List<ItemCriteriaDTO> |
buildItemCriteriaDTOList(StructuredContent sc) |
protected String |
buildNameKey(SandBox currentSandbox,
Locale locale,
String contentType,
String contentName) |
protected String |
buildNameKey(SandBox sandBox,
StructuredContent sc) |
protected String |
buildRuleExpression(StructuredContent sc) |
protected StructuredContentDTO |
buildStructuredContentDTO(StructuredContent sc,
boolean secure)
Converts a StructuredContent into a StructuredContentDTO.
|
List<StructuredContentDTO> |
buildStructuredContentDTOList(List<StructuredContent> structuredContentList,
boolean secure)
Converts a list of structured content items to a list of structured content DTOs.
Internally calls buildStructuredContentDTO(...). |
String |
buildTypeKey(SandBox currentSandbox,
Locale locale,
String contentType) |
protected String |
buildTypeKey(SandBox sandBox,
StructuredContent sc) |
Long |
countContentItems(org.hibernate.Criteria c)
Follows the same rules as
findContentItems . |
List<StructuredContentDTO> |
evaluateAndPriortizeContent(List<StructuredContentDTO> structuredContentList,
int count,
Map<String,Object> ruleDTOs) |
List<StructuredContent> |
findAllContentItems()
Finds all content items regardless of the
Sandbox they are a member of |
List<StructuredContent> |
findContentItems(org.hibernate.Criteria c)
This method is intended to be called solely from the CMS admin.
|
Locale |
findLanguageOnlyLocale(Locale locale) |
StructuredContent |
findStructuredContentById(Long contentId)
Returns the StructuredContent item associated with the passed in id.
|
StructuredContentType |
findStructuredContentTypeById(Long id)
Returns the
StructuredContentType associated with the passed in id. |
StructuredContentType |
findStructuredContentTypeByName(String name)
Returns the
StructuredContentType associated with the passed in
String value. |
List<RuleProcessor<StructuredContentDTO>> |
getContentRuleProcessors() |
net.sf.ehcache.Cache |
getStructuredContentCache() |
List<StructuredContentDTO> |
getStructuredContentListFromCache(String key) |
List<StructuredContentDTO> |
lookupStructuredContentItemsByName(String contentName,
Locale locale,
Integer count,
Map<String,Object> ruleDTOs,
boolean secure)
This method returns content by name only.
|
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.
|
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. |
protected boolean |
processContentRules(StructuredContentDTO sc,
Map<String,Object> ruleDTOs) |
void |
removeItemFromCache(String nameKey,
String typeKey)
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.
|
List<StructuredContentType> |
retrieveAllStructuredContentTypes() |
StructuredContentType |
saveStructuredContentType(StructuredContentType type)
Saves the given type and returns the merged instance
|
void |
setContentRuleProcessors(List<RuleProcessor<StructuredContentDTO>> contentRuleProcessors) |
protected static final org.apache.commons.logging.Log LOG
protected static String AND
protected StructuredContentDao structuredContentDao
protected StaticAssetService staticAssetService
protected StaticAssetPathService staticAssetPathService
protected LocaleService localeService
protected List<RuleProcessor<StructuredContentDTO>> contentRuleProcessors
protected EntityConfiguration entityConfiguration
protected StructuredContentServiceExtensionManager extensionManager
protected StatisticsService statisticsService
protected net.sf.ehcache.Cache structuredContentCache
public StructuredContent findStructuredContentById(Long contentId)
StructuredContentService
findStructuredContentById
in interface StructuredContentService
contentId
- - The id of the content item.public StructuredContentType findStructuredContentTypeById(Long id)
StructuredContentService
StructuredContentType
associated with the passed in id.findStructuredContentTypeById
in interface StructuredContentService
id
- - The id of the content type.StructuredContentType
.public StructuredContentType findStructuredContentTypeByName(String name)
StructuredContentService
StructuredContentType
associated with the passed in
String value.findStructuredContentTypeByName
in interface StructuredContentService
name
- - The name of the content type.StructuredContentType
.public List<StructuredContentType> retrieveAllStructuredContentTypes()
retrieveAllStructuredContentTypes
in interface StructuredContentService
StructuredContentType
spublic List<StructuredContent> findContentItems(org.hibernate.Criteria c)
StructuredContentService
SandBoxType
of
production is passed in, only those items in that SandBox are returned.
findContentItems
in interface StructuredContentService
c
- - the criteria used to search for contentpublic List<StructuredContent> findAllContentItems()
StructuredContentService
Sandbox
they are a member offindAllContentItems
in interface StructuredContentService
public Long countContentItems(org.hibernate.Criteria c)
StructuredContentService
findContentItems
.countContentItems
in interface StructuredContentService
public StructuredContentType saveStructuredContentType(StructuredContentType type)
saveStructuredContentType
in interface StructuredContentService
public List<StructuredContentDTO> buildStructuredContentDTOList(List<StructuredContent> structuredContentList, boolean secure)
buildStructuredContentDTOList
in interface StructuredContentService
structuredContentList
- secure
- #buildStructuredContentDTO(StructuredContent, boolean)}
public List<StructuredContentDTO> evaluateAndPriortizeContent(List<StructuredContentDTO> structuredContentList, int count, Map<String,Object> ruleDTOs)
evaluateAndPriortizeContent
in interface StructuredContentService
public List<StructuredContentDTO> lookupStructuredContentItemsByType(StructuredContentType contentType, Locale locale, Integer count, Map<String,Object> ruleDTOs, boolean secure)
StructuredContentService
SandBoxType
of
production is passed in, only those items in that SandBox are returned.
lookupStructuredContentItemsByType
in interface StructuredContentService
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 httpsDisplayContentTag
public List<StructuredContentDTO> lookupStructuredContentItemsByName(StructuredContentType contentType, String contentName, Locale locale, Integer count, Map<String,Object> ruleDTOs, boolean secure)
StructuredContentService
SandBoxType
of
production is passed in, only those items in that SandBox are returned.
lookupStructuredContentItemsByName
in interface StructuredContentService
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 httpsDisplayContentTag
public List<StructuredContentDTO> lookupStructuredContentItemsByName(String contentName, Locale locale, Integer count, Map<String,Object> ruleDTOs, boolean secure)
StructuredContentService
SandBoxType
of
production is passed in, only those items in that SandBox are returned.
lookupStructuredContentItemsByName
in interface StructuredContentService
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 httpsDisplayContentTag
public List<RuleProcessor<StructuredContentDTO>> getContentRuleProcessors()
public void setContentRuleProcessors(List<RuleProcessor<StructuredContentDTO>> contentRuleProcessors)
public void removeStructuredContentFromCache(SandBox sandBox, StructuredContent sc)
removeStructuredContentFromCache
in interface StructuredContentService
sc
- public Locale findLanguageOnlyLocale(Locale locale)
findLanguageOnlyLocale
in interface StructuredContentService
public net.sf.ehcache.Cache getStructuredContentCache()
getStructuredContentCache
in interface StructuredContentService
public void removeItemFromCache(String nameKey, String typeKey)
removeItemFromCache
in interface StructuredContentService
nameKey
- protected String buildRuleExpression(StructuredContent sc)
protected List<ItemCriteriaDTO> buildItemCriteriaDTOList(StructuredContent sc)
protected void buildFieldValues(StructuredContent sc, StructuredContentDTO scDTO, boolean secure)
StructuredContent
into its StructuredContentDTO
representation. This will also
format the values from StructuredContentDTO.getValues()
into their actual data types. For instance, if the
given StructuredContent
has a DATE field, then this method will ensure that the resulting object in the values
map of the DTO is a Date
rather than just a String representing a date.
Current support of parsing field types is:
DATE - Date
BOOLEAN - Boolean
DECIMAL - BigDecimal
INTEGER - Integer
MONEY - Money
All other fields are treated as strings. This will also fix URL strings that have the CMS prefix (like images) by
prepending the standard CMS prefix with the particular environment prefixsc
- scDTO
- secure
- StaticAssetService#getStaticAssetEnvironmentUrlPrefix()}
protected StructuredContentDTO buildStructuredContentDTO(StructuredContent sc, boolean secure)
EntityConfiguration
. To override the actual type that is returned,
include an override in an applicationContext like any other entity override.sc
- secure
- protected boolean processContentRules(StructuredContentDTO sc, Map<String,Object> ruleDTOs)
public String buildTypeKey(SandBox currentSandbox, Locale locale, String contentType)
buildTypeKey
in interface StructuredContentService
protected String buildNameKey(SandBox sandBox, StructuredContent sc)
protected String buildTypeKey(SandBox sandBox, StructuredContent sc)
protected String buildNameKey(SandBox currentSandbox, Locale locale, String contentType, String contentName)
public void addStructuredContentListToCache(String key, List<StructuredContentDTO> scDTOList)
addStructuredContentListToCache
in interface StructuredContentService
public List<StructuredContentDTO> getStructuredContentListFromCache(String key)
getStructuredContentListFromCache
in interface StructuredContentService
Copyright © 2014. All rights reserved.