Class ExternalSearchGenerator
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.cocoon.xml.AbstractXMLProducer
org.apache.cocoon.generation.AbstractGenerator
org.apache.cocoon.generation.ServiceableGenerator
org.ametys.plugins.externaldata.data.ExternalSearchGenerator
- All Implemented Interfaces:
Poolable,Recyclable,Disposable,Component,LogEnabled,Serviceable,Generator,SitemapModelComponent,XMLProducer
Generator for external data search service
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DataSourceFactoryExtensionPointDatasource factory handlerprotected QueryDaoThe Query DAO.Fields inherited from class org.apache.cocoon.generation.ServiceableGenerator
managerFields inherited from class org.apache.cocoon.generation.AbstractGenerator
objectModel, parameters, resolver, sourceFields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidexecuteQuery(Query query, Map<String, String> parameterValues, int nbResultsPerPage, int page) Execute ldap queryvoidgenerate()protected intgetPageIndex(Request request) Get the page indexgetParameterValues(Request request, Query query) Get the search criteria values from requestprotected voidsaxFormFields(Query query) SAX the form search criteriaprotected voidSAX the search parameters from the request parameters and queryprotected voidsaxFormValues(Request request, Map<String, String> values) SAX the form search criteria valuesprotected voidsaxPagination(int page, int offset, int limit, int nbResult, boolean hasMoreResult) SAX the paginationprotected voidsaxResult(Query query, QueryResult result) Sax a query result.voidservice(ServiceManager smanager) Methods inherited from class org.apache.cocoon.generation.ServiceableGenerator
disposeMethods inherited from class org.apache.cocoon.generation.AbstractGenerator
recycle, setupMethods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandlerMethods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLoggerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
-
Field Details
-
_queryDao
The Query DAO. -
_dataSourceFactoryEP
Datasource factory handler
-
-
Constructor Details
-
ExternalSearchGenerator
public ExternalSearchGenerator()
-
-
Method Details
-
service
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classServiceableGenerator- Throws:
ServiceException
-
generate
-
getParameterValues
Get the search criteria values from request- Parameters:
request- The requestquery- The LDAP query- Returns:
- the values
-
saxFormParameters
protected void saxFormParameters(Request request, Query query, Map<String, String> values) throws SAXExceptionSAX the search parameters from the request parameters and query- Parameters:
request- The requestquery- The LDAP queryvalues- The extracted form values- Throws:
SAXException- If an error occurs while SAXing
-
saxFormFields
SAX the form search criteria- Parameters:
query- The LDAP query- Throws:
SAXException- if an error occurs while SAXing
-
saxFormValues
SAX the form search criteria values- Parameters:
request- The requestvalues- The extracted form values- Throws:
SAXException- if an error occurs while SAXing
-
executeQuery
protected void executeQuery(Query query, Map<String, String> parameterValues, int nbResultsPerPage, int page) throws DataInclusionException, SAXExceptionExecute ldap query- Parameters:
query- the ldap queryparameterValues- the search criterianbResultsPerPage- the number of result per pagepage- the page number- Throws:
DataInclusionException- if an error occurredSAXException- If an error occurred
-
saxPagination
protected void saxPagination(int page, int offset, int limit, int nbResult, boolean hasMoreResult) throws SAXException SAX the pagination- Parameters:
page- the current pageoffset- the offsetlimit- the number of results per pagenbResult- the number result of the pagehasMoreResult- true if there are less one page more- Throws:
SAXException- if an error occurred
-
saxResult
Sax a query result.- Parameters:
query- the query.result- the result to generate.- Throws:
SAXException- if an error occurs while saxing
-
getPageIndex
Get the page index- Parameters:
request- The request- Returns:
- The page index
-