@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 static String |
FOREIGN_LOOKUP |
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 |
|---|---|
protected void |
addSingleStructuredContentToCache(String key,
StructuredContentDTO scDTO) |
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 void |
buildFieldValueWithCmsPrefix(String originalValue,
StructuredContentDTO scDTO,
boolean secure,
String fieldKey) |
protected List<ItemCriteriaDTO> |
buildItemCriteriaDTOList(StructuredContent sc) |
protected String |
buildNameKey(SandBox currentSandbox,
Long site,
Locale locale,
String contentType,
String contentName) |
protected String |
buildNameKey(SandBox currentSandbox,
Long site,
Locale locale,
String contentType,
String contentName,
Boolean secure)
Builds the DTO cache key based on the single SC item name.
|
protected String |
buildNameKey(SandBox sandBox,
StructuredContent sc) |
protected String |
buildNameKey(SandBox sandBox,
StructuredContent sc,
Boolean secure) |
protected String |
buildRuleExpression(StructuredContent sc) |
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,
Long site,
Locale locale,
String contentType)
Builds the cache key for DTOLists based on the SC Type.
|
protected String |
buildTypeKey(SandBox sandBox,
StructuredContent sc) |
String |
buildTypeKeyWithSecure(SandBox currentSandbox,
Long site,
Locale locale,
String contentType,
Boolean secure)
Builds the cache key for DTOLists based on the SC Type.
|
List<StructuredContentDTO> |
convertToDtos(List<StructuredContent> scs,
boolean isSecure)
Converts a list of StructuredContent objects into their corresponding
StructuredContentDTOs. |
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() |
protected StructuredContentDTO |
getSingleStructuredContentFromCache(String key) |
net.sf.ehcache.Cache |
getStructuredContentCache() |
List<StructuredContentDTO> |
getStructuredContentListFromCache(String key) |
protected boolean |
hasCmsPrefix(String originalValue,
String cmsPrefix) |
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 List<StructuredContentDTO> |
modifyStructuredContentDtoList(List<StructuredContentDTO> structuredContentList) |
protected boolean |
processContentRules(StructuredContentDTO sc,
Map<String,Object> ruleDTOs) |
protected List<StructuredContentDTO> |
processUnprioritizedContent(List<StructuredContentDTO> structuredContentList,
Map<String,Object> ruleDTOs) |
void |
removeItemFromCache(String nameKey,
String typeKey)
Call to evict both secure and non-secure SC items matching
the passed in keys.
|
boolean |
removeItemFromCacheByKey(String key)
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 static final String FOREIGN_LOOKUP
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 StructuredContentServiceprotected List<StructuredContentDTO> processUnprioritizedContent(List<StructuredContentDTO> structuredContentList, Map<String,Object> ruleDTOs)
protected boolean processContentRules(StructuredContentDTO sc, Map<String,Object> ruleDTOs)
protected List<StructuredContentDTO> modifyStructuredContentDtoList(List<StructuredContentDTO> structuredContentList)
public 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> convertToDtos(List<StructuredContent> scs, boolean isSecure)
StructuredContentServiceStructuredContentDTOs. This method
will utilize a cache in production mode, and it will additionally hydrate the returned StructuredContentDTO
objects via the #hydrateForeignLookups(List) method.convertToDtos in interface StructuredContentServiceStructuredContentDTOspublic 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)
StructuredContentServiceremoveStructuredContentFromCache in interface StructuredContentServicepublic boolean removeItemFromCacheByKey(String key)
StructuredContentServiceremoveItemFromCacheByKey in interface StructuredContentServicepublic void removeItemFromCache(String nameKey, String typeKey)
StructuredContentServiceremoveItemFromCache in interface StructuredContentServicepublic Locale findLanguageOnlyLocale(Locale locale)
findLanguageOnlyLocale in interface StructuredContentServicepublic net.sf.ehcache.Cache getStructuredContentCache()
getStructuredContentCache in interface StructuredContentServiceprotected 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 void buildFieldValueWithCmsPrefix(String originalValue, StructuredContentDTO scDTO, boolean secure, String fieldKey)
public 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.buildStructuredContentDTO in interface StructuredContentServicesc - secure - protected String buildNameKey(SandBox sandBox, StructuredContent sc)
protected String buildNameKey(SandBox sandBox, StructuredContent sc, Boolean secure)
protected String buildNameKey(SandBox currentSandbox, Long site, Locale locale, String contentType, String contentName)
protected String buildNameKey(SandBox currentSandbox, Long site, Locale locale, String contentType, String contentName, Boolean secure)
currentSandbox - site - locale - contentType - contentName - secure - protected String buildTypeKey(SandBox sandBox, StructuredContent sc)
public String buildTypeKey(SandBox currentSandbox, Long site, Locale locale, String contentType)
StructuredContentServicebuildTypeKey in interface StructuredContentServicepublic String buildTypeKeyWithSecure(SandBox currentSandbox, Long site, Locale locale, String contentType, Boolean secure)
StructuredContentServicebuildTypeKeyWithSecure in interface StructuredContentServicepublic void addStructuredContentListToCache(String key, List<StructuredContentDTO> scDTOList)
addStructuredContentListToCache in interface StructuredContentServiceprotected void addSingleStructuredContentToCache(String key, StructuredContentDTO scDTO)
protected StructuredContentDTO getSingleStructuredContentFromCache(String key)
public List<StructuredContentDTO> getStructuredContentListFromCache(String key)
getStructuredContentListFromCache in interface StructuredContentServiceCopyright © 2017. All rights reserved.