Class TableRefSourceType
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.forms.question.sources.AbstractSourceType
org.ametys.plugins.forms.question.sources.TableRefSourceType
- All Implemented Interfaces:
LazyEnumerator<ChoiceOption>
,ChoiceSourceType
,LogEnabled
,PluginAware
,Configurable
,Serviceable
Class for creating users choice list from a population
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ContentHelper
The content helperprotected ContentTypeExtensionPoint
The content types extension pointprotected ContentSearcherFactory
The searcher factoryprotected SearchUIModelExtensionPoint
The search UI model extension pointMap of ModelItems specific to UsersSourceTypestatic final String
Constant for element definition name of the table ref idFields inherited from class org.ametys.plugins.forms.question.sources.AbstractSourceType
_id, _jsonUtils, _label, _pluginName, QUESTION_PARAM_KEY
Fields inherited from interface org.ametys.plugins.forms.enumerators.LazyEnumerator
LANG_PARAMETER_KEY, PATTERN_PARAMETER_KEY, SORT_PARAMETER_KEY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetEntry
(ChoiceOption value, Map<String, Object> contextParams) Retrieves a single label from a value.Get field to disable if form is publishedGet the js converter for the choice listGet the js renderer for the choice listGet the type model itemsgetStorageType
(FormQuestion question) Get the storage type of the source typegetTypedEntries
(Map<String, Object> contextParams) Provides the enumerated values with their optional label.Get the view items for the main tabboolean
true
if the enumerator has remote data and need lazy loadingremoveEmptyOrOtherValue
(Object value) Remove the empty values or values equal to '__interval_other' from received valuesearchEntries
(Map<String, Object> contextParams, int limit, Object paginationData) Provides the enumerated values with their optional label.void
service
(ServiceManager manager) valueToJSONForClient
(Object value, FormQuestion question, FormEntry entry, ModelItem modelItem) Convert the entry value into a JSON object to use client sideMethods inherited from class org.ametys.plugins.forms.question.sources.AbstractSourceType
_getComputedComplexValue, _getComputedStringValue, _getQuestionFromParam, configure, getId, getLabel, setPluginInfo
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ATTRIBUTE_TABLE_REF_ID
Constant for element definition name of the table ref id- See Also:
-
_tableRefSourceItems
Map of ModelItems specific to UsersSourceType -
_cTypesEP
The content types extension point -
_contentHelper
The content helper -
_searcherFactory
The searcher factory -
_searchUIModelExtensionPoint
The search UI model extension point
-
-
Constructor Details
-
TableRefSourceType
public TableRefSourceType()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractSourceType
- Throws:
ServiceException
-
getModelItems
Description copied from interface:ChoiceSourceType
Get the type model items- Returns:
- a map of the model items
-
getViewItems
Description copied from interface:ChoiceSourceType
Get the view items for the main tab- Returns:
- a list of view items
-
getFieldToDisableIfFormPublished
Description copied from interface:ChoiceSourceType
Get field to disable if form is published- Specified by:
getFieldToDisableIfFormPublished
in interfaceChoiceSourceType
- Overrides:
getFieldToDisableIfFormPublished
in classAbstractSourceType
- Returns:
- the list of field name
-
remoteData
Description copied from interface:ChoiceSourceType
true
if the enumerator has remote data and need lazy loading- Returns:
true
if the enumerator has remote data and need lazy loading
-
getEntry
public I18nizableText getEntry(ChoiceOption value, Map<String, Object> contextParams) throws ExceptionDescription copied from interface:LazyEnumerator
Retrieves a single label from a value.- Parameters:
value
- the value.contextParams
- the search contextual parameters- Returns:
- the label or
null
if not found. - Throws:
Exception
- if an error occurs.
-
getTypedEntries
public Map<ChoiceOption,I18nizableText> getTypedEntries(Map<String, Object> contextParams) throws ExceptionDescription copied from interface:LazyEnumerator
Provides the enumerated values with their optional label.- Parameters:
contextParams
- the search contextual parameters- Returns:
- the enumerated values and their label.
- Throws:
Exception
- if an error occurs.
-
searchEntries
public Map<ChoiceOption,I18nizableText> searchEntries(Map<String, Object> contextParams, int limit, Object paginationData) throws ExceptionDescription copied from interface:LazyEnumerator
Provides the enumerated values with their optional label.- Parameters:
contextParams
- the search contextual parameterslimit
- the limit of entriespaginationData
- the data to process pagination- Returns:
- the enumerated values and their label.
- Throws:
Exception
- if an error occurs.
-
getStorageType
Description copied from interface:ChoiceSourceType
Get the storage type of the source type- Specified by:
getStorageType
in interfaceChoiceSourceType
- Overrides:
getStorageType
in classAbstractSourceType
- Parameters:
question
- the question- Returns:
- the storage type
-
getJSRenderer
Description copied from interface:ChoiceSourceType
Get the js renderer for the choice list- Specified by:
getJSRenderer
in interfaceChoiceSourceType
- Overrides:
getJSRenderer
in classAbstractSourceType
- Returns:
- the js renderer
-
getJSConverter
Description copied from interface:ChoiceSourceType
Get the js converter for the choice list- Specified by:
getJSConverter
in interfaceChoiceSourceType
- Overrides:
getJSConverter
in classAbstractSourceType
- Returns:
- the js converter
-
removeEmptyOrOtherValue
Description copied from interface:ChoiceSourceType
Remove the empty values or values equal to '__interval_other' from received value- Specified by:
removeEmptyOrOtherValue
in interfaceChoiceSourceType
- Overrides:
removeEmptyOrOtherValue
in classAbstractSourceType
- Parameters:
value
- the receive value- Returns:
- the value without empty sub-values or without '__interval_other' if the other option is chosen. If the value is empty or equal to the other value, it returns null.
-
valueToJSONForClient
public Object valueToJSONForClient(Object value, FormQuestion question, FormEntry entry, ModelItem modelItem) throws Exception Description copied from interface:ChoiceSourceType
Convert the entry value into a JSON object to use client side- Specified by:
valueToJSONForClient
in interfaceChoiceSourceType
- Overrides:
valueToJSONForClient
in classAbstractSourceType
- Parameters:
value
- the value to convertquestion
- the form questionentry
- the form entrymodelItem
- the model item- Returns:
- The value as JSON
- Throws:
Exception
- if an error occurred
-