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
Modifier and TypeFieldDescriptionprotected DataSourceFactoryExtensionPoint
Datasource factory handlerprotected QueryDao
The Query DAO.Fields inherited from class org.apache.cocoon.generation.ServiceableGenerator
manager
Fields inherited from class org.apache.cocoon.generation.AbstractGenerator
objectModel, parameters, resolver, source
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
executeQuery
(Query query, Map<String, String> parameterValues, int nbResultsPerPage, int page) Execute ldap queryvoid
generate()
protected int
getPageIndex
(Request request) Get the page indexgetParameterValues
(Request request, Query query) Get the search criteria values from requestprotected void
saxFormFields
(Query query) SAX the form search criteriaprotected void
SAX the search parameters from the request parameters and queryprotected void
saxFormValues
(Request request, Map<String, String> values) SAX the form search criteria valuesprotected void
saxPagination
(int page, int offset, int limit, int nbResult, boolean hasMoreResult) SAX the paginationprotected void
saxResult
(Query query, QueryResult result) Sax a query result.void
service
(ServiceManager smanager) Methods inherited from class org.apache.cocoon.generation.ServiceableGenerator
dispose
Methods inherited from class org.apache.cocoon.generation.AbstractGenerator
recycle, setup
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandler
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:
service
in interfaceServiceable
- Overrides:
service
in 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
-