Class AbstractSearchModuleGenerator
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.workspaces.search.module.AbstractSearchModuleGenerator
- All Implemented Interfaces:
Poolable
,Recyclable
,Disposable
,Component
,LogEnabled
,Serviceable
,Generator
,SitemapModelComponent
,XMLProducer
- Direct Known Subclasses:
AbstractSolrSearchModuleGenerator
,AbstractXpathSearchModuleGenerator
Abstract generator for search modules
-
Field Summary
Modifier and TypeFieldDescriptionprotected CategoryHelper
The category helperprotected CategoryProviderExtensionPoint
CategoryProviderExtensionPointprotected CurrentUserProvider
The current user providerprotected ProjectManager
The project managerprotected ProjectMemberManager
The project member managerprotected AmetysObjectResolver
The ametys object resolverprotected RightManager
Right managerprotected SiteManager
The site managerprotected UserHelper
The user helperprotected WorkspaceModuleExtensionPoint
WorkspaceModuleExtensionPointFields 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 TypeMethodDescriptionfilterProjectsForModule
(List<Project> projects, String moduleId) Filter a list of projects to return only those where the module is availablevoid
generate()
getCategories
(Request request) Get the category names targeted by the searchprotected Project
Get the project holding the object.getProjects
(Request request, boolean userOnly) Get the project names targeted by the searchprotected void
saxCategory
(Category category) SAX categoryprotected void
saxCategoryColor
(Category category) SAX the category colorprotected abstract void
saxHit
(AmetysObject object, String lang) Sax the content hitprotected abstract void
saxHits
(String siteName, String lang, String textfield, Request request, int offset, int limit, int minLimit) Sax the resultsprotected void
saxHits
(List<? extends AmetysObject> results, String lang, int offset, int limit, int minLimit, long totalCount) Sax the results after searchprotected void
saxProject
(Project project) SAX a projectprotected void
saxUser
(UserIdentity userIdentity, String tagName) SAX a user identityvoid
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
-
_resolver
The ametys object resolver -
_projectManager
The project manager -
_currentUserProvider
The current user provider -
_projectMembers
The project member manager -
_categoryProviderEP
CategoryProviderExtensionPoint -
_categoryHelper
The category helper -
_userHelper
The user helper -
_siteManager
The site manager -
_workspaceModuleEP
WorkspaceModuleExtensionPoint -
_rightManager
Right manager
-
-
Constructor Details
-
AbstractSearchModuleGenerator
public AbstractSearchModuleGenerator()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classServiceableGenerator
- Throws:
ServiceException
-
generate
-
saxHits
protected void saxHits(List<? extends AmetysObject> results, String lang, int offset, int limit, int minLimit, long totalCount) throws SAXException Sax the results after search- Parameters:
results
- list of resultslang
- the current languageoffset
- the start of searchlimit
- the max number of resultsminLimit
- the min number of resultstotalCount
- total count available- Throws:
SAXException
- if an error occurred while saxing
-
getProject
Get the project holding the object. Be careful, use only for objects that belongs to a project (thread, task, event, ...)- Parameters:
ao
- the Ametys object- Returns:
- the project or null if nor found
-
saxProject
SAX a project- Parameters:
project
- the project- Throws:
SAXException
- if an error occurred while saxing
-
saxCategory
SAX category- Parameters:
category
- the category- Throws:
SAXException
- if an error occured while saxing
-
saxCategoryColor
SAX the category color- Parameters:
category
- the category- Throws:
SAXException
- if an error occured while saxing
-
getProjects
Get the project names targeted by the search- Parameters:
request
- the requestuserOnly
- true to get user's projects only- Returns:
- the project names
-
filterProjectsForModule
Filter a list of projects to return only those where the module is available- Parameters:
projects
- list of projectsmoduleId
- id of the module to search for read access- Returns:
- a filtered list of projects
-
getCategories
Get the category names targeted by the search- Parameters:
request
- the request- Returns:
- the category names
-
saxHits
protected abstract void saxHits(String siteName, String lang, String textfield, Request request, int offset, int limit, int minLimit) throws SAXException, ProcessingException Sax the results- Parameters:
siteName
- the current site namelang
- the current languagetextfield
- the search inputsrequest
- the requestoffset
- the start of searchlimit
- the max number of resultsminLimit
- the min number of results- Throws:
SAXException
- if an error occurred while saxingProcessingException
- if the search failed
-
saxHit
Sax the content hit- Parameters:
object
- the AmetysObjectlang
- the language- Throws:
Exception
- if an error occurred while saxing result
-
saxUser
SAX a user identity- Parameters:
userIdentity
- the user identitytagName
- the tag name- Throws:
SAXException
- if an error occurred while saxing
-