Class SetFilterInRequestAttributesAction
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.apache.cocoon.acting.AbstractAction
-
- org.apache.cocoon.acting.ServiceableAction
-
- org.ametys.web.repository.page.actions.SetFilterInRequestAttributesAction
-
- All Implemented Interfaces:
Component
,LogEnabled
,Serviceable
,Action
- Direct Known Subclasses:
SetFilterInRequestAttributesAction
,SetPostFilterInRequestAttributesAction
public class SetFilterInRequestAttributesAction extends ServiceableAction
This action creates a filter from the sitemap parameters or request parameter 'filterId' and set the filter in request attributes.
-
-
Field Summary
-
Fields inherited from class org.apache.cocoon.acting.ServiceableAction
manager
-
Fields inherited from class org.apache.cocoon.acting.AbstractAction
EMPTY_MAP
-
-
Constructor Summary
Constructors Constructor Description SetFilterInRequestAttributesAction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private Expression
_convertToExpression(String metadataName, boolean lowerCase, String metadataCondition, String metadataConditionValue)
protected WebContentFilter
_createFilter(String id, AmetysObjectResolver resolver, ContentTypeExtensionPoint contentTypeExtensionPoint, SiteManager siteManager, TagProviderExtensionPoint tagProviderEP)
Create a WebContentFilter.private List<String>
_getContentTypes(ZoneItem zoneItem)
protected WebContentFilter
_getFilterFromParams(Parameters parameters, ZoneItem zoneItem, Map<String,Object> parentContextAttributes)
Get the filter from the action parameters.protected WebContentFilter
_getFilterFromZoneItem(ZoneItem zoneItem)
Get the content filter from a ZoneItem.protected WebContentFilter
_getFilterFromZoneItem(Parameters parameters, Map<String,String> result)
Get the content filter from a ZoneItem.protected Map<String,Object>
_getFilterMap(ModelAwareDataHolder dataHolder)
Retrieves the filter map from a data holder (service parameters)protected Map<String,Object>
_getFilterMap(Parameters parameters, Map<String,Object> parentContextAttributes)
Retrieves the filter map in the parameters or parent context attributeprotected List<Map<String,String>>
_getSortList(ModelAwareDataHolder metadata)
Retrieves the sort list map from a data holder (service parameters)protected List<Map<String,String>>
_getSortList(Parameters parameters, Map<String,Object> parentContextAttributes)
Retrieves the sort list in the parameters or parent context attributeprotected ContentFilter
_getStaticFilterById(String filterId, String siteName)
Retrieve the content filter with its idprotected boolean
_isValid(ZoneItem zoneItem)
Test if the ZoneItem is valid.protected void
_setFilterCriteria(ContentFilter contentFilter, Map<String,Object> filterBy)
Set the filters's filter expressionprotected void
_setSearchContext(WebContentFilter filter, List<Map<String,Object>> searchValues)
Get the search parameters from the search values.protected void
_setSearchContext(WebContentFilter filter, ModelAwareDataHolder dataHolder)
Set the search contexts in a filter from a service instance attributes.protected void
_setSearchContext(WebContentFilter filter, Parameters parameters)
Get the search parameters from the search values as parameters.protected void
_setSortCriteria(ContentFilter filter, String[] cTypes, List<Map<String,String>> sortBy)
Set the filter's sort criteria.Map
act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters)
void
service(ServiceManager smanager)
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
__FILTERS_EQUAL
private static final String __FILTERS_EQUAL
- See Also:
- Constant Field Values
-
__FILTERS_DIFFERENT
private static final String __FILTERS_DIFFERENT
- See Also:
- Constant Field Values
-
__FILTERS_STARTSWITH
private static final String __FILTERS_STARTSWITH
- See Also:
- Constant Field Values
-
__FILTERS_ENDSWITH
private static final String __FILTERS_ENDSWITH
- See Also:
- Constant Field Values
-
__FILTERS_CONTAINS
private static final String __FILTERS_CONTAINS
- See Also:
- Constant Field Values
-
__FILTERS_NOTCONTAINS
private static final String __FILTERS_NOTCONTAINS
- See Also:
- Constant Field Values
-
__FILTERS_EMPTY
private static final String __FILTERS_EMPTY
- See Also:
- Constant Field Values
-
__FILTERS_NONEMPTY
private static final String __FILTERS_NONEMPTY
- See Also:
- Constant Field Values
-
__FILTERS_LESSTHAN
private static final String __FILTERS_LESSTHAN
- See Also:
- Constant Field Values
-
__FILTERS_GREATERTHAN
private static final String __FILTERS_GREATERTHAN
- See Also:
- Constant Field Values
-
__FILTERS_PAST
private static final String __FILTERS_PAST
- See Also:
- Constant Field Values
-
__FILTERS_FUTURE
private static final String __FILTERS_FUTURE
- See Also:
- Constant Field Values
-
__FILTERS_TRUE
private static final String __FILTERS_TRUE
- See Also:
- Constant Field Values
-
__FILTERS_FALSE
private static final String __FILTERS_FALSE
- See Also:
- Constant Field Values
-
_resolver
protected AmetysObjectResolver _resolver
The Ametys resolver
-
_contentTypeEP
protected ContentTypeExtensionPoint _contentTypeEP
The extension point for content types
-
_filterExtPt
protected ContentFilterExtensionPoint _filterExtPt
The content filter EP
-
_serviceEP
protected ServiceExtensionPoint _serviceEP
The service EP
-
_siteManager
protected SiteManager _siteManager
The site manager
-
_tagProviderEP
protected TagProviderExtensionPoint _tagProviderEP
The tag provider EP
-
_jsonUtils
protected JSONUtils _jsonUtils
The JSON utils
-
-
Constructor Detail
-
SetFilterInRequestAttributesAction
public SetFilterInRequestAttributesAction()
-
-
Method Detail
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classServiceableAction
- Throws:
ServiceException
-
act
public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) throws Exception
- Throws:
Exception
-
_getFilterFromParams
protected WebContentFilter _getFilterFromParams(Parameters parameters, ZoneItem zoneItem, Map<String,Object> parentContextAttributes)
Get the filter from the action parameters.- Parameters:
parameters
- The Action parameters.zoneItem
- the zone itemparentContextAttributes
- The parent context attributes.- Returns:
- the content filter.
-
_getFilterMap
protected Map<String,Object> _getFilterMap(Parameters parameters, Map<String,Object> parentContextAttributes)
Retrieves the filter map in the parameters or parent context attribute- Parameters:
parameters
- The parametersparentContextAttributes
- The parent context attributes- Returns:
- The filter map
-
_getFilterMap
protected Map<String,Object> _getFilterMap(ModelAwareDataHolder dataHolder)
Retrieves the filter map from a data holder (service parameters)- Parameters:
dataHolder
- The data holder- Returns:
- The filter map
-
_getSortList
protected List<Map<String,String>> _getSortList(Parameters parameters, Map<String,Object> parentContextAttributes)
Retrieves the sort list in the parameters or parent context attribute- Parameters:
parameters
- The parametersparentContextAttributes
- The parent context attributes- Returns:
- The sort list
-
_getSortList
protected List<Map<String,String>> _getSortList(ModelAwareDataHolder metadata)
Retrieves the sort list map from a data holder (service parameters)- Parameters:
metadata
- The data holder- Returns:
- The filter map
-
_getContentTypes
private List<String> _getContentTypes(ZoneItem zoneItem) throws ParameterException
- Throws:
ParameterException
-
_getFilterFromZoneItem
protected WebContentFilter _getFilterFromZoneItem(Parameters parameters, Map<String,String> result) throws ParameterException
Get the content filter from a ZoneItem.- Parameters:
parameters
- the action parameters, including the ZoneItem id.result
- the action result.- Returns:
- the content filter.
- Throws:
ParameterException
- if parameters are invalid
-
_getFilterFromZoneItem
protected WebContentFilter _getFilterFromZoneItem(ZoneItem zoneItem) throws ParameterException
Get the content filter from a ZoneItem.- Parameters:
zoneItem
- the ZoneItem.- Returns:
- the content filter.
- Throws:
ParameterException
- if parameters are invalid
-
_createFilter
protected WebContentFilter _createFilter(String id, AmetysObjectResolver resolver, ContentTypeExtensionPoint contentTypeExtensionPoint, SiteManager siteManager, TagProviderExtensionPoint tagProviderEP)
Create a WebContentFilter.- Parameters:
id
- the filter ID.resolver
- the AmetysObjectResolver.contentTypeExtensionPoint
- The extension point for content typessiteManager
- The site managertagProviderEP
- The tag provider extension point- Returns:
- the WebContentFilter.
-
_isValid
protected boolean _isValid(ZoneItem zoneItem)
Test if the ZoneItem is valid.- Parameters:
zoneItem
- the ZoneItem.- Returns:
- true if the ZoneItem is valid, false otherwise.
-
_setSearchContext
protected void _setSearchContext(WebContentFilter filter, Parameters parameters) throws ParameterException
Get the search parameters from the search values as parameters.- Parameters:
filter
- the filter to configure.parameters
- the parameters.- Throws:
ParameterException
- if an error occurs.
-
_setSearchContext
protected void _setSearchContext(WebContentFilter filter, List<Map<String,Object>> searchValues)
Get the search parameters from the search values.- Parameters:
filter
- the filter to configure.searchValues
- the search values.
-
_setSearchContext
protected void _setSearchContext(WebContentFilter filter, ModelAwareDataHolder dataHolder)
Set the search contexts in a filter from a service instance attributes.- Parameters:
filter
- the filter.dataHolder
- the service parameters data holder.
-
_setFilterCriteria
protected void _setFilterCriteria(ContentFilter contentFilter, Map<String,Object> filterBy)
Set the filters's filter expression- Parameters:
contentFilter
- The filter to editfilterBy
- The map of filters. Key are the medataname. Value represents the filter.
-
_convertToExpression
private Expression _convertToExpression(String metadataName, boolean lowerCase, String metadataCondition, String metadataConditionValue)
-
_setSortCriteria
protected void _setSortCriteria(ContentFilter filter, String[] cTypes, List<Map<String,String>> sortBy)
Set the filter's sort criteria.- Parameters:
filter
- The filter to editcTypes
- The content typessortBy
- The sort list. Each entry in the list is a map representing a sort. Map have two keys: name, the name of the metadata, and sort, the name of the sort
-
_getStaticFilterById
protected ContentFilter _getStaticFilterById(String filterId, String siteName)
Retrieve the content filter with its id- Parameters:
filterId
- the id of the filter to retrievesiteName
- The site name- Returns:
- the content filter associated with this id
-
-