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
FieldsModifier and TypeFieldDescriptionprotected CategoryHelperThe category helperprotected CategoryProviderExtensionPointCategoryProviderExtensionPointprotected CurrentUserProviderThe current user providerprotected ProjectManagerThe project managerprotected ProjectMemberManagerThe project member managerprotected AmetysObjectResolverThe ametys object resolverprotected RightManagerRight managerprotected SiteManagerThe site managerprotected UserHelperThe user helperprotected WorkspaceModuleExtensionPointWorkspaceModuleExtensionPointFields 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 TypeMethodDescriptionfilterProjectsForModule(List<Project> projects, String moduleId) Filter a list of projects to return only those where the module is availablevoidgenerate()getCategories(Request request) Get the category names targeted by the searchprotected ProjectGet the project holding the object.getProjects(Request request, boolean userOnly) Get the project names targeted by the searchprotected voidsaxCategory(Category category) SAX categoryprotected voidsaxCategoryColor(Category category) SAX the category colorprotected abstract voidsaxHit(AmetysObject object, String lang) Sax the content hitprotected abstract voidsaxHits(String siteName, String lang, String textfield, Request request, int offset, int limit, int minLimit) Sax the resultsprotected voidsaxHits(List<? extends AmetysObject> results, String lang, int offset, int limit, int minLimit, long totalCount) Sax the results after searchprotected voidsaxProject(Project project) SAX a projectprotected voidsaxUser(UserIdentity userIdentity, String tagName) SAX a user identityvoidservice(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
-
_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:
servicein interfaceServiceable- Overrides:
servicein 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
-