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
public abstract class AbstractSearchModuleGenerator extends ServiceableGenerator
Abstract generator for search modules
-
-
Field Summary
Fields Modifier and Type Field Description protected CategoryHelper
_categoryHelper
The category helperprotected CategoryProviderExtensionPoint
_categoryProviderEP
CategoryProviderExtensionPointprotected CurrentUserProvider
_currentUserProvider
The current user providerprotected ProjectManager
_projectManager
The project managerprotected ProjectMemberManager
_projectMembers
The project member managerprotected AmetysObjectResolver
_resolver
The ametys object resolverprotected RightManager
_rightManager
Right managerprotected SiteManager
_siteManager
The site managerprotected UserHelper
_userHelper
The user helperprotected WorkspaceModuleExtensionPoint
_workspaceModuleEP
WorkspaceModuleExtensionPoint-
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 AbstractSearchModuleGenerator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected List<Project>
filterProjectsForModule(List<Project> projects, String moduleId)
Filter a list of projects to return only those where the module is availablevoid
generate()
protected List<String>
getCategories(Request request)
Get the category names targeted by the searchprotected Project
getProject(AmetysObject ao)
Get the project holding the object.List<Project>
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 Detail
-
_resolver
protected AmetysObjectResolver _resolver
The ametys object resolver
-
_projectManager
protected ProjectManager _projectManager
The project manager
-
_currentUserProvider
protected CurrentUserProvider _currentUserProvider
The current user provider
-
_projectMembers
protected ProjectMemberManager _projectMembers
The project member manager
-
_categoryProviderEP
protected CategoryProviderExtensionPoint _categoryProviderEP
CategoryProviderExtensionPoint
-
_categoryHelper
protected CategoryHelper _categoryHelper
The category helper
-
_userHelper
protected UserHelper _userHelper
The user helper
-
_siteManager
protected SiteManager _siteManager
The site manager
-
_workspaceModuleEP
protected WorkspaceModuleExtensionPoint _workspaceModuleEP
WorkspaceModuleExtensionPoint
-
_rightManager
protected RightManager _rightManager
Right manager
-
-
Constructor Detail
-
AbstractSearchModuleGenerator
public AbstractSearchModuleGenerator()
-
-
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
-
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
protected Project getProject(AmetysObject ao)
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
protected void saxProject(Project project) throws SAXException
SAX a project- Parameters:
project
- the project- Throws:
SAXException
- if an error occurred while saxing
-
saxCategory
protected void saxCategory(Category category) throws SAXException
SAX category- Parameters:
category
- the category- Throws:
SAXException
- if an error occured while saxing
-
saxCategoryColor
protected void saxCategoryColor(Category category) throws SAXException
SAX the category color- Parameters:
category
- the category- Throws:
SAXException
- if an error occured while saxing
-
getProjects
public List<Project> getProjects(Request request, boolean userOnly)
Get the project names targeted by the search- Parameters:
request
- the requestuserOnly
- true to get user's projects only- Returns:
- the project names
-
filterProjectsForModule
protected List<Project> filterProjectsForModule(List<Project> projects, String moduleId)
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
protected List<String> getCategories(Request request)
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
protected abstract void saxHit(AmetysObject object, String lang) throws Exception
Sax the content hit- Parameters:
object
- the AmetysObjectlang
- the language- Throws:
Exception
- if an error occurred while saxing result
-
saxUser
protected void saxUser(UserIdentity userIdentity, String tagName) throws SAXException
SAX a user identity- Parameters:
userIdentity
- the user identitytagName
- the tag name- Throws:
SAXException
- if an error occurred while saxing
-
-