Package org.ametys.plugins.ai.rest
Class AbstractSearchAction
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.cocoon.acting.AbstractAction
org.apache.cocoon.acting.ServiceableAction
org.ametys.plugins.ai.rest.AbstractSearchAction
- All Implemented Interfaces:
Component,LogEnabled,Serviceable,Action
- Direct Known Subclasses:
GetSearchModelConfigurationAction,GetSolrSearchAction
Action that handle operation related to search
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected LocaleHelperThe locale helperprotected SearchUIModelExtensionPointThe search model extension pointFields inherited from class org.apache.cocoon.acting.ServiceableAction
managerFields inherited from class org.apache.cocoon.acting.AbstractAction
EMPTY_MAP -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean_canBeFlattened(ViewItemAccessor accessor, ViewItemAccessor parent) Determine if an accessor can be flatened inside a parent accessor ie, the accessor contains a single item that is a leaf with a name not already present in the parentprotected Object_elementToJson(ModelAwareDataHolder dataHolder, ElementDefinition definition, DataContext dataContext, Map<String, Object> contextualParameters) Serialize as JSON the value of a data holder elementact(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) protected abstract MapActual operationprotected List<SearchModelCriterionViewItem> getCriteria(SearchModel searchModel, Map<String, Object> contextualParameters) Get the criteria as a list instead of treevoidservice(ServiceManager serviceManager) Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
_localeHelper
The locale helper -
_searchModelEP
The search model extension point
-
-
Constructor Details
-
AbstractSearchAction
public AbstractSearchAction()
-
-
Method Details
-
service
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classServiceableAction- Throws:
ServiceException
-
act
public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) throws Exception - Throws:
Exception
-
doAct
protected abstract Map doAct(Request request, SearchUIModel searchModel, Map<String, Object> contextualParameters) throws ExceptionActual operation- Parameters:
request- the requestsearchModel- the requested search modelcontextualParameters- a map of contextual parameters- Returns:
- the action result
- Throws:
Exception- if an error occurs
-
_canBeFlattened
Determine if an accessor can be flatened inside a parent accessor ie, the accessor contains a single item that is a leaf with a name not already present in the parent- Parameters:
accessor- the accessor to testparent- the parent of the accessor- Returns:
- true if the hierarchy of this accessor can be flatened in the parent
-
getCriteria
protected List<SearchModelCriterionViewItem> getCriteria(SearchModel searchModel, Map<String, Object> contextualParameters) Get the criteria as a list instead of tree- Parameters:
searchModel- the search modelcontextualParameters- the contextual parameters- Returns:
- the list of criteria
-
_elementToJson
protected Object _elementToJson(ModelAwareDataHolder dataHolder, ElementDefinition definition, DataContext dataContext, Map<String, Object> contextualParameters) Serialize as JSON the value of a data holder element- Parameters:
dataHolder- the data holder containing the datadefinition- the definition of the element to serializedataContext- the data context of the data holdercontextualParameters- the contextual parameters- Returns:
- the JSON value
-