Package org.ametys.plugins.forms.helper
Class FormStatisticsHelper
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.forms.helper.FormStatisticsHelper
- All Implemented Interfaces:
LogEnabled
,Component
,Serviceable
The helper to handle admin emails
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final record
Record representing a choice list option -
Field Summary
Modifier and TypeFieldDescriptionprotected FormEntryDAO
The form entry DAOprotected AmetysObjectResolver
The Ametys Object resolverprotected RightManager
The right managerstatic final String
Avalon ROLE. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
_dispatchBooleanStats
(List<FormEntry> entries, FormQuestion question, Map<String, Map<String, Object>> questionValues) Dispatch boolean statsprotected void
_dispatchChoicesStats
(Form form, FormQuestion question, Map<String, Map<String, Object>> questionValues) Dispatch choices list statsprotected void
_dispatchChoicesWithRemoteDataStats
(Form form, FormQuestion question, Map<String, Map<String, Object>> questionValues) Dispatch choices list with remote data statsprotected void
_dispatchMatrixStats
(List<FormEntry> entries, FormQuestion question, Map<String, Map<String, Object>> questionValues) Dispatch matrix statsprotected void
_dispatchStats
(List<FormEntry> entries, FormQuestion question, Map<String, Map<String, Object>> questionValues) Dispatch default stats_getStatistics
(Form form) Compute the statistics for each questions of the formGenerate statistics of a mini-survey No rights will be checked.getStatistics
(String id) Generates statistics on each question of a form.getStatsMap
(Form form) Create a map with count of all answers per questiongetStatsToArray
(Form form) Transforms the statistics map into an array with some info.void
service
(ServiceManager manager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
Avalon ROLE. -
_resolver
The Ametys Object resolver -
_rightManager
The right manager -
_formEntryDAO
The form entry DAO
-
-
Constructor Details
-
FormStatisticsHelper
public FormStatisticsHelper()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getStatistics
Generates statistics on each question of a form.- Parameters:
id
- The form id- Returns:
- A map containing the statistics
-
getMiniSurveyStatistics
Generate statistics of a mini-survey No rights will be checked. Only a check that it is indeed a mini-survey will be done.- Parameters:
id
- the form id- Returns:
- a JSON map of the statistics
-
_getStatistics
Compute the statistics for each questions of the form- Parameters:
form
- the form- Returns:
- A JSON map representing the statistics
-
getStatsMap
Create a map with count of all answers per question- Parameters:
form
- current form- Returns:
- the statsMap
-
getStatsToArray
Transforms the statistics map into an array with some info.- Parameters:
form
- The form- Returns:
- A list of statistics.
-
_dispatchMatrixStats
protected void _dispatchMatrixStats(List<FormEntry> entries, FormQuestion question, Map<String, Map<String, Object>> questionValues) Dispatch matrix stats- Parameters:
entries
- the entriesquestion
- the questionquestionValues
- the values to fill
-
_dispatchChoicesStats
protected void _dispatchChoicesStats(Form form, FormQuestion question, Map<String, Map<String, Object>> questionValues) Dispatch choices list stats- Parameters:
form
- the formquestion
- the questionquestionValues
- the values to fill
-
_dispatchChoicesWithRemoteDataStats
protected void _dispatchChoicesWithRemoteDataStats(Form form, FormQuestion question, Map<String, Map<String, Object>> questionValues) Dispatch choices list with remote data stats- Parameters:
form
- the formquestion
- the questionquestionValues
- the values to fill
-
_dispatchBooleanStats
protected void _dispatchBooleanStats(List<FormEntry> entries, FormQuestion question, Map<String, Map<String, Object>> questionValues) Dispatch boolean stats- Parameters:
entries
- the entriesquestion
- the questionquestionValues
- the values to fill
-
_dispatchStats
protected void _dispatchStats(List<FormEntry> entries, FormQuestion question, Map<String, Map<String, Object>> questionValues) Dispatch default stats- Parameters:
entries
- the entriesquestion
- the questionquestionValues
- the values to fill
-