@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)
StructuredContentServicefindStructuredContentById in interface StructuredContentServicecontentId - - The id of the content item.public StructuredContentType findStructuredContentTypeById(Long id)
StructuredContentServiceStructuredContentType associated with the passed in id.findStructuredContentTypeById in interface StructuredContentServiceid - - The id of the content type.StructuredContentType.public StructuredContentType findStructuredContentTypeByName(String name)
StructuredContentServiceStructuredContentType associated with the passed in
String value.findStructuredContentTypeByName in interface StructuredContentServicename - - The name of the content type.StructuredContentType.public List<StructuredContentType> retrieveAllStructuredContentTypes()
retrieveAllStructuredContentTypes in interface StructuredContentServiceStructuredContentTypespublic List<StructuredContent> findContentItems(org.hibernate.Criteria c)
StructuredContentServiceSandBoxType of
production is passed in, only those items in that SandBox are returned.
findContentItems in interface StructuredContentServicec - - the criteria used to search for contentpublic List<StructuredContent> findAllContentItems()
StructuredContentServiceSandbox they are a member offindAllContentItems in interface StructuredContentServicepublic Long countContentItems(org.hibernate.Criteria c)
StructuredContentServicefindContentItems.countContentItems in interface StructuredContentServicepublic StructuredContentType saveStructuredContentType(StructuredContentType type)
saveStructuredContentType in interface StructuredContentServicepublic List<StructuredContentDTO> buildStructuredContentDTOList(List<StructuredContent> structuredContentList, boolean secure)
buildStructuredContentDTOList in interface StructuredContentServicestructuredContentList - secure - #buildStructuredContentDTO(StructuredContent, boolean)}public List<StructuredContentDTO> evaluateAndPriortizeContent(List<StructuredContentDTO> structuredContentList, int count, Map<String,Object> ruleDTOs)
evaluateAndPriortizeContent in interface StructuredContentServicepublic List<StructuredContentDTO> lookupStructuredContentItemsByType(StructuredContentType contentType, Locale locale, Integer count, Map<String,Object> ruleDTOs, boolean secure)
StructuredContentServiceSandBoxType of
production is passed in, only those items in that SandBox are returned.
lookupStructuredContentItemsByType in interface StructuredContentServicecontentType - - 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 httpsDisplayContentTagpublic List<StructuredContentDTO> lookupStructuredContentItemsByName(StructuredContentType contentType, String contentName, Locale locale, Integer count, Map<String,Object> ruleDTOs, boolean secure)
StructuredContentServiceSandBoxType of
production is passed in, only those items in that SandBox are returned.
lookupStructuredContentItemsByName in interface StructuredContentServicecontentType - - 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 httpsDisplayContentTagpublic List<StructuredContentDTO> lookupStructuredContentItemsByName(String contentName, Locale locale, Integer count, Map<String,Object> ruleDTOs, boolean secure)
StructuredContentServiceSandBoxType of
production is passed in, only those items in that SandBox are returned.
lookupStructuredContentItemsByName in interface StructuredContentServicecontentName - - 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 httpsDisplayContentTagpublic List<RuleProcessor<StructuredContentDTO>> getContentRuleProcessors()
public void setContentRuleProcessors(List<RuleProcessor<StructuredContentDTO>> contentRuleProcessors)
public void removeStructuredContentFromCache(SandBox sandBox, StructuredContent sc)
removeStructuredContentFromCache in interface StructuredContentServicesc - public Locale findLanguageOnlyLocale(Locale locale)
findLanguageOnlyLocale in interface StructuredContentServicepublic net.sf.ehcache.Cache getStructuredContentCache()
getStructuredContentCache in interface StructuredContentServicepublic void removeItemFromCache(String nameKey, String typeKey)
removeItemFromCache in interface StructuredContentServicenameKey - 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 StructuredContentServiceprotected 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 StructuredContentServicepublic List<StructuredContentDTO> getStructuredContentListFromCache(String key)
getStructuredContentListFromCache in interface StructuredContentServiceCopyright © 2014. All rights reserved.