Package org.ametys.plugins.forms.dao
Class FormQuestionDAO
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.forms.dao.FormQuestionDAO
- All Implemented Interfaces:
LogEnabled
,Component
,Contextualizable
,Serviceable
public class FormQuestionDAO
extends AbstractLogEnabled
implements Serviceable, Component, Contextualizable
DAO for manipulating form questions
-
Field Summary
Modifier and TypeFieldDescriptionprotected ChoiceSourceTypeExtensionPoint
The choice source type extension pointprotected Context
The cocoon contextprotected Context
The Avalon contextprotected CurrentUserProvider
The current user provider.protected FormDAO
The form DAOprotected FormQuestionTypeExtensionPoint
The form question type extension pointprotected I18nUtils
I18n Utilsprotected JSONUtils
JSON helperprotected ObservationManager
Observer manager.protected ParametersManager
The parameters managerprotected AmetysObjectResolver
Ametys object resolver.protected RightManager
The right managerprotected UploadManager
Manager for retrieving uploaded filesprotected static final String
The String representing the type of a form question nodestatic final String
The Avalon rolestatic final String
Name for rules root jcr node -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Check rights for a form element as ametys objectprotected UserIdentity
Provides the current user._getPageTitlesWithRule
(FormQuestion question) Get the page titles having rule concerning the given question_getQuestionTitlesWithRule
(FormQuestion question) Get the question titles having rule concerning the given questionaddPageRule
(String id, String option, String rule, String page) Adds a new rule to a question.void
contextualize
(Context context) copyQuestion
(String pageId, String questionId) Copies and pastes a form question.createQuestion
(String pageId, String typeId) Creates aFormQuestion
.deletePageRule
(String id, String option) Deletes a rule to a question.deleteQuestion
(String id) Deletes aFormQuestion
.editQuestion
(String questionId, Map<String, Object> values) Edits aFormQuestion
.getQuestionParametersDefinitions
(String typeID, String formId) Get view for question typegetQuestionParametersValues
(String questionID) Get questions parameters valuesGets properties of a form questiongetQuestionProperties
(FormQuestion question) Gets properties of a form questionGets the page rules for a form question.renameQuestion
(String id, String newName) Rename aFormQuestion
void
service
(ServiceManager serviceManager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
The Avalon role -
RULES_ROOT
Name for rules root jcr node- See Also:
-
FORM_QUESTION_TYPE
The String representing the type of a form question node- See Also:
-
_resolver
Ametys object resolver. -
_observationManager
Observer manager. -
_currentUserProvider
The current user provider. -
_uploadManager
Manager for retrieving uploaded files -
_jsonUtils
JSON helper -
_i18nUtils
I18n Utils -
_formQuestionTypeExtensionPoint
The form question type extension point -
_parametersManager
The parameters manager -
_context
The Avalon context -
_cocoonContext
The cocoon context -
_choiceSourceTypeExtensionPoint
The choice source type extension point -
_formDAO
The form DAO -
_rightManager
The right manager
-
-
Constructor Details
-
FormQuestionDAO
public FormQuestionDAO()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
contextualize
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
_checkRights
Check rights for a form element as ametys object- Parameters:
ao
- the ametys object
-
_getCurrentUser
Provides the current user.- Returns:
- the user which cannot be
null
.
-
getQuestionProperties
Gets properties of a form question- Parameters:
id
- The id of the form question- Returns:
- The properties
-
getQuestionProperties
Gets properties of a form question- Parameters:
question
- The form question- Returns:
- The properties
-
_getQuestionTitlesWithRule
Get the question titles having rule concerning the given question- Parameters:
question
- the question- Returns:
- the list of question titles
-
_getPageTitlesWithRule
Get the page titles having rule concerning the given question- Parameters:
question
- the question- Returns:
- the list of page titles
-
getQuestionParametersDefinitions
public Map<String,Object> getQuestionParametersDefinitions(String typeID, String formId) throws ProcessingException Get view for question type- Parameters:
typeID
- id of the question typeformId
- id of the form- Returns:
- the view parsed in json for configurableFormPanel
- Throws:
ProcessingException
- error while parsing view to json
-
getQuestionParametersValues
Get questions parameters values- Parameters:
questionID
- id of current question- Returns:
- map of question parameters value
-
createQuestion
Creates aFormQuestion
.- Parameters:
pageId
- id of current pagetypeId
- id of FormQuestionType- Returns:
- The id of the created form question, the id of the page and the id of the form
-
renameQuestion
Rename aFormQuestion
- Parameters:
id
- The id of the questionnewName
- The new name of the question- Returns:
- A result map
-
editQuestion
Edits aFormQuestion
.- Parameters:
questionId
- id of current questionvalues
- The question's values- Returns:
- The id of the edited form question, the id of the page and the id of the form
-
deleteQuestion
Deletes aFormQuestion
.- Parameters:
id
- The id of the form question to delete- Returns:
- The id of the form question, the id of the page and the id of the form
-
copyQuestion
Copies and pastes a form question.- Parameters:
pageId
- The id of the page, target of the copyquestionId
- The id of the question to copy- Returns:
- The id of the created question, the id of the page and the id of the form
-
getRules
Gets the page rules for a form question.- Parameters:
id
- The id of the form question.number
- The question number- Returns:
- The rules
- Throws:
Exception
- error while getting choice options
-
addPageRule
Adds a new rule to a question.- Parameters:
id
- The question idoption
- The optionrule
- The rule typepage
- The page to jump or skip- Returns:
- An empty map, or an error
-
deletePageRule
Deletes a rule to a question.- Parameters:
id
- The question idoption
- The option to delete- Returns:
- An empty map
-