org.broadleafcommerce.cms.web.processor
Class ContentProcessor
java.lang.Object
org.thymeleaf.processor.AbstractProcessor
org.thymeleaf.processor.element.AbstractElementProcessor
org.broadleafcommerce.common.web.dialect.AbstractModelVariableModifierProcessor
org.broadleafcommerce.cms.web.processor.ContentProcessor
- All Implemented Interfaces:
- Comparable<org.thymeleaf.processor.IProcessor>, org.thymeleaf.processor.IProcessor
public class ContentProcessor
- extends AbstractModelVariableModifierProcessor
Processor used to display structured content that is maintained with the Broadleaf CMS.
Usage based on the following attributes:
- contentType (required *) - only required if an extension manager is not defined to handle content lookup.
If the content type is not found, it will try to retrieve content from any registered
extension handlers.
Specifies the content you are retrieving.
- contentName - if included will retrieve only content that matches the name. When no name is specified,
all matching content items of the passed in type are retrieved.
- maxResults - if specified limits the results to a specified number of items. The content will be returned
according to priority. If content items share the same priority, then they will be returned
randomly. Consider the example with 5 matching items with priorities (1,2,3,3,3) respectively. If
the count is set to 3. Items 1 and 2 will ALWAYS be returned. The third item returned will
randomy rotate through the 3rd, 4th, and 5th item.
- contentListVar - allows you to specify an alternate name for the list of content results. By default,
the results are returned in the page attributed "contentList"
- contentItemVar - since a typical usage is to only return one item, the first item is returned in the
variable "contentItem". This variable can be used to change the attribute name.
- numResultsVar - variable holding the returns the number of results being returned to through the tag-lib.
defaults to "numResults".
- fieldFilters - Thymeleaf key-value pair to filter the resulting StructuredContentDTO by particular field values.
For instance, if you had a field in a piece of structured content called 'featured' and you
wanted to return all of the featured content items, you could do the following:
- sorts - sorts to apply to the resulting list of content. These should be key-value pairs corresponding
where the key is the field to sort and the value is the direction of the sort. If unspecified,
the default sorting is used (by priority). The sort fields must occur in the dynamic fields
for that piece of structured content. For instance:
The list will be sorted first by dynamicFieldA descending and then dynamicFieldB ascending
|
Method Summary |
protected Map<String,Object> |
buildMvelParameters(javax.servlet.http.HttpServletRequest request,
org.thymeleaf.Arguments arguments,
org.thymeleaf.dom.Element element)
MVEL is used to process the content targeting rules. |
protected String |
getAttributeValue(org.thymeleaf.dom.Element element,
String valueName,
String defaultValue)
Returns a default name |
protected List<StructuredContentDTO> |
getContentItems(String contentName,
Integer maxResults,
javax.servlet.http.HttpServletRequest request,
Map<String,Object> mvelParameters,
SandBox currentSandbox,
StructuredContentType structuredContentType,
Locale locale,
org.thymeleaf.Arguments arguments,
org.thymeleaf.dom.Element element)
|
int |
getPrecedence()
|
boolean |
isSecure(javax.servlet.http.HttpServletRequest request)
|
protected void |
modifyModelAttributes(org.thymeleaf.Arguments arguments,
org.thymeleaf.dom.Element element)
|
| Methods inherited from class org.thymeleaf.processor.element.AbstractElementProcessor |
doProcess, getMatcher |
| Methods inherited from class org.thymeleaf.processor.AbstractProcessor |
compareTo, getMessage, getMessageForProcessor, getMessageForTemplate, process |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LOG
protected final org.apache.commons.logging.Log LOG
REQUEST_DTO
public static final String REQUEST_DTO
- See Also:
- Constant Field Values
BLC_RULE_MAP_PARAM
public static final String BLC_RULE_MAP_PARAM
- See Also:
- Constant Field Values
structuredContentService
protected StructuredContentService structuredContentService
staticAssetService
protected StaticAssetService staticAssetService
extensionManager
protected ContentProcessorExtensionManager extensionManager
contentDeepLinkService
protected ContentDeepLinkServiceImpl contentDeepLinkService
ContentProcessor
public ContentProcessor()
- Sets the name of this processor to be used in Thymeleaf template
ContentProcessor
public ContentProcessor(String elementName)
getPrecedence
public int getPrecedence()
- Specified by:
getPrecedence in class org.thymeleaf.processor.AbstractProcessor
getAttributeValue
protected String getAttributeValue(org.thymeleaf.dom.Element element,
String valueName,
String defaultValue)
- Returns a default name
- Parameters:
element - valueName -
- Returns:
modifyModelAttributes
protected void modifyModelAttributes(org.thymeleaf.Arguments arguments,
org.thymeleaf.dom.Element element)
- Specified by:
modifyModelAttributes in class AbstractModelVariableModifierProcessor
getContentItems
protected List<StructuredContentDTO> getContentItems(String contentName,
Integer maxResults,
javax.servlet.http.HttpServletRequest request,
Map<String,Object> mvelParameters,
SandBox currentSandbox,
StructuredContentType structuredContentType,
Locale locale,
org.thymeleaf.Arguments arguments,
org.thymeleaf.dom.Element element)
- Parameters:
contentName - name of the content to be looked up (can be null)maxResults - maximum results to returnrequest - servlet requestmvelParameters - values that should be considered when filtering the content list by rulesstructuredContentType - the type of content that should be returnedlocale - current localearguments - Thymeleaf Arguments passed into the tagelement - element context that this Thymeleaf processor is being executed in
- Returns:
buildMvelParameters
protected Map<String,Object> buildMvelParameters(javax.servlet.http.HttpServletRequest request,
org.thymeleaf.Arguments arguments,
org.thymeleaf.dom.Element element)
- MVEL is used to process the content targeting rules.
- Parameters:
request -
- Returns:
isSecure
public boolean isSecure(javax.servlet.http.HttpServletRequest request)
Copyright © 2013. All Rights Reserved.