Class SurveyEnumerator
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.plugins.survey.repository.SurveyEnumerator
-
- All Implemented Interfaces:
Enumerator<String>
,Contextualizable
,LogEnabled
,Serviceable
public class SurveyEnumerator extends AbstractLogEnabled implements Enumerator<String>, Serviceable, Contextualizable
Enumerates existing surveys.
-
-
Field Summary
Fields Modifier and Type Field Description private Context
_context
protected AmetysObjectResolver
_resolver
The ametys object resolver.protected SiteManager
_siteManager
The site manager.
-
Constructor Summary
Constructors Constructor Description SurveyEnumerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
contextualize(Context context)
I18nizableText
getEntry(String value)
Retrieves a single label from a value.protected ModifiableTraversableAmetysObject
getSurveyRootNode(String siteName, String lang)
Get the root node for surveysMap<String,I18nizableText>
getTypedEntries()
Provides the enumerated values with their optional label.void
service(ServiceManager manager)
-
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.ametys.runtime.model.Enumerator
getConfiguration
-
-
-
-
Field Detail
-
_resolver
protected AmetysObjectResolver _resolver
The ametys object resolver.
-
_siteManager
protected SiteManager _siteManager
The site manager.
-
-
Constructor Detail
-
SurveyEnumerator
public SurveyEnumerator()
-
-
Method Detail
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getTypedEntries
public Map<String,I18nizableText> getTypedEntries() throws Exception
Description copied from interface:Enumerator
Provides the enumerated values with their optional label.- Specified by:
getTypedEntries
in interfaceEnumerator<String>
- Returns:
- the enumerated values and their label.
- Throws:
Exception
- if an error occurs. TODO NEWATTRIBUTEAPI: rename this method whenEnumerator
will be removed
-
getEntry
public I18nizableText getEntry(String value) throws Exception
Description copied from interface:Enumerator
Retrieves a single label from a value.- Specified by:
getEntry
in interfaceEnumerator<String>
- Parameters:
value
- the value.- Returns:
- the label or
null
if not found. - Throws:
Exception
- if an error occurs.
-
getSurveyRootNode
protected ModifiableTraversableAmetysObject getSurveyRootNode(String siteName, String lang) throws RepositoryException
Get the root node for surveys- Parameters:
siteName
- the site namelang
- the language- Returns:
- the root node
- Throws:
RepositoryException
- if an error occurs when retrieving the root node of the survey
-
-