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
public class ExternalSearchGenerator extends ServiceableGenerator
Generator for external data search service
-
-
Field Summary
Fields Modifier and Type Field Description protected DataSourceFactoryExtensionPoint
_dataSourceFactoryEP
Datasource factory handlerprotected QueryDao
_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
Constructors Constructor Description ExternalSearchGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
executeQuery(Query query, Map<String,String> parameterValues, int nbResultsPerPage, int page)
Execute ldap queryvoid
generate()
protected int
getPageIndex(Request request)
Get the page indexprotected Map<String,String>
getParameterValues(Request request, Query query)
Get the search criteria values from requestprotected void
saxFormFields(Query query)
SAX the form search criteriaprotected void
saxFormParameters(Request request, Query query, Map<String,String> values)
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 Detail
-
_dataSourceFactoryEP
protected DataSourceFactoryExtensionPoint _dataSourceFactoryEP
Datasource factory handler
-
-
Constructor Detail
-
ExternalSearchGenerator
public ExternalSearchGenerator()
-
-
Method Detail
-
service
public void service(ServiceManager smanager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classServiceableGenerator
- Throws:
ServiceException
-
generate
public void generate() throws IOException, SAXException, ProcessingException
-
getParameterValues
protected Map<String,String> getParameterValues(Request request, Query query)
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 SAXException
SAX 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
protected void saxFormFields(Query query) throws SAXException
SAX the form search criteria- Parameters:
query
- The LDAP query- Throws:
SAXException
- if an error occurs while SAXing
-
saxFormValues
protected void saxFormValues(Request request, Map<String,String> values) throws SAXException
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, SAXException
Execute 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
protected void saxResult(Query query, QueryResult result) throws SAXException
Sax a query result.- Parameters:
query
- the query.result
- the result to generate.- Throws:
SAXException
- if an error occurs while saxing
-
getPageIndex
protected int getPageIndex(Request request)
Get the page index- Parameters:
request
- The request- Returns:
- The page index
-
-