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
This action creates a filter from the sitemap parameters or request parameter 'filterId' and set the filter in request attributes.
-
Field Summary
Modifier and TypeFieldDescriptionprotected ContentTypeExtensionPoint
The extension point for content typesprotected ContentFilterExtensionPoint
The content filter EPprotected JSONUtils
The JSON utilsprotected AmetysObjectResolver
The Ametys resolverprotected ServiceExtensionPoint
The service EPprotected SiteManager
The site managerprotected TagProviderExtensionPoint
The tag provider EPFields inherited from class org.apache.cocoon.acting.ServiceableAction
manager
Fields inherited from class org.apache.cocoon.acting.AbstractAction
EMPTY_MAP
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected WebContentFilter
_createFilter
(String id, AmetysObjectResolver resolver, ContentTypeExtensionPoint contentTypeExtensionPoint, SiteManager siteManager, TagProviderExtensionPoint tagProviderEP) Create a WebContentFilter.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._getFilterMap
(ModelAwareDataHolder dataHolder) Retrieves the filter map from a data holder (service parameters)_getFilterMap
(Parameters parameters, Map<String, Object> parentContextAttributes) Retrieves the filter map in the parameters or parent context attribute_getSortList
(ModelAwareDataHolder metadata) Retrieves the sort list map from a data holder (service parameters)_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
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.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 Details
-
_resolver
The Ametys resolver -
_contentTypeEP
The extension point for content types -
_filterExtPt
The content filter EP -
_serviceEP
The service EP -
_siteManager
The site manager -
_tagProviderEP
The tag provider EP -
_jsonUtils
The JSON utils
-
-
Constructor Details
-
SetFilterInRequestAttributesAction
public SetFilterInRequestAttributesAction()
-
-
Method Details
-
service
- 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
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
Retrieves the sort list map from a data holder (service parameters)- Parameters:
metadata
- The data holder- Returns:
- The filter map
-
_getFilterFromZoneItem
protected WebContentFilter _getFilterFromZoneItem(Parameters parameters, Map<String, String> result) throws ParameterExceptionGet 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
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
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
Get the search parameters from the search values.- Parameters:
filter
- the filter to configure.searchValues
- the search values.
-
_setSearchContext
Set the search contexts in a filter from a service instance attributes.- Parameters:
filter
- the filter.dataHolder
- the service parameters data holder.
-
_setFilterCriteria
Set the filters's filter expression- Parameters:
contentFilter
- The filter to editfilterBy
- The map of filters. Key are the medataname. Value represents the filter.
-
_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
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
-