Class SurveyQuestion
java.lang.Object
org.ametys.plugins.repository.AbstractAmetysObject
org.ametys.plugins.repository.jcr.SimpleAmetysObject<F>
org.ametys.plugins.repository.jcr.DefaultTraversableAmetysObject<F>
org.ametys.plugins.survey.repository.AbstractSurveyElement<SurveyQuestionFactory>
org.ametys.plugins.survey.repository.SurveyQuestion
- All Implemented Interfaces:
ACLAmetysObject
,AmetysObject
,CopiableAmetysObject
,DataAwareAmetysObject
,ModelLessDataAwareAmetysObject
,ModifiableModelLessDataAwareAmetysObject
,DataHolder
,ModelLessDataHolder
,ModifiableDataHolder
,ModifiableModelLessDataHolder
,JCRAmetysObject
,JCRTraversableAmetysObject
,MetadataAwareAmetysObject
,ModifiableMetadataAwareAmetysObject
,ModifiableACLAmetysObject
,ModifiableAmetysObject
,ModifiableTraversableAmetysObject
,RemovableAmetysObject
,TraversableAmetysObject
AmetysObject
for storing survey-
Nested Class Summary
-
Field Summary
Fields inherited from class org.ametys.plugins.survey.repository.AbstractSurveyElement
PROPERTY_PICTURE, PROPERTY_PICTURE_ALTERNATIVE, PROPERTY_PICTURE_ID, PROPERTY_PICTURE_TYPE
-
Constructor Summary
ConstructorDescriptionSurveyQuestion
(javax.jcr.Node node, String parentPath, SurveyQuestionFactory factory) Creates aSurveyQuestion
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addRules
(String option, SurveyRule.RuleType ruleType, String page) Add a rule for branchingcopyTo
(ModifiableTraversableAmetysObject parent, String name) Copy the currentAmetysObject
to the given object.copyTo
(ModifiableTraversableAmetysObject parent, String name, List<String> restrictTo) Copy the currentAmetysObject
to the given object if it is not in the restriction list.void
deleteRule
(String option) Delete a ruleGet columnsgetLabel()
Retrieves the label.Get optionsGet the validation pattern.Retrieves the regexp type.getRules()
Get the rulesGet the survey to which this question belongs.Get the page to which this question belongs.getTitle()
Retrieves the title.getType()
Retrieves the type.boolean
Determines if the question has a "other" optionboolean
Determines if a rule with given option existsboolean
Determines if the question is mandatory.void
setColumns
(Map<String, String> columns) Set columnsvoid
Set the label.void
setMandatory
(boolean mandatory) Set the mandatory.void
setOptions
(Map<String, String> options) Set optionsvoid
setOtherOption
(boolean other) Set the "other" option.void
setRegExpType
(String regexp) Set the regexp type.void
Set the title.void
Set the type.Methods inherited from class org.ametys.plugins.survey.repository.AbstractSurveyElement
copyPictureTo, getDataHolder, getExternalPicture, getPictureAlternative, getPictureType, getResourcePictureId, removePictureMetas, setExternalPicture, setNoPicture, setPictureAlternative, setPictureType, setResourcePicture
Methods inherited from class org.ametys.plugins.repository.jcr.DefaultTraversableAmetysObject
addAllowedGroups, addAllowedProfilesForAnonymous, addAllowedProfilesForAnyConnectedUser, addAllowedUsers, addDeniedGroups, addDeniedProfilesForAnonymous, addDeniedProfilesForAnyConnectedUser, addDeniedUsers, createChild, disallowInheritance, getChild, getChildren, getProfilesForAnonymousAndAnyConnectedUser, getProfilesForGroups, getProfilesForUsers, hasChild, isInheritanceDisallowed, removeAllowedGroups, removeAllowedGroups, removeAllowedProfilesForAnonymous, removeAllowedProfilesForAnyConnectedUser, removeAllowedUsers, removeAllowedUsers, removeDeniedGroups, removeDeniedGroups, removeDeniedProfilesForAnonymous, removeDeniedProfilesForAnyConnectedUser, removeDeniedUsers, removeDeniedUsers
Methods inherited from class org.ametys.plugins.repository.jcr.SimpleAmetysObject
_getFactory, _invalidateName, _invalidateParentPath, getId, getMetadataHolder, getName, getNode, getParent, getParentPath, getPath, needsSave, remove, rename, revertChanges, saveChanges
Methods inherited from class org.ametys.plugins.repository.AbstractAmetysObject
equals, hashCode, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.ametys.plugins.repository.AmetysObject
equals, getId, getName, getParent, getParentPath, getPath, hashCode
Methods inherited from interface org.ametys.plugins.repository.data.ametysobject.DataAwareAmetysObject
copyTo, dataToJSON, dataToJSON, dataToSAX, dataToSAX, getDataNames
Methods inherited from interface org.ametys.plugins.repository.jcr.JCRAmetysObject
getNode
Methods inherited from interface org.ametys.plugins.repository.data.ametysobject.ModelLessDataAwareAmetysObject
dataToJSON, dataToSAX, getModelItemTypeExtensionPoint, getType, getValue, getValue, getValueOfType, getValueOfType, hasValue, hasValue, hasValueOrEmpty, isMultiple, isMultiple
Methods inherited from interface org.ametys.plugins.repository.data.holder.ModelLessDataHolder
dataToJSON, dataToSAX, hasValue, hasValueOrEmpty
Methods inherited from interface org.ametys.plugins.repository.ModifiableAmetysObject
needsSave, rename, revertChanges, saveChanges
Methods inherited from interface org.ametys.plugins.repository.metadata.ModifiableMetadataAwareAmetysObject
getMetadataHolder
Methods inherited from interface org.ametys.plugins.repository.data.ametysobject.ModifiableModelLessDataAwareAmetysObject
getComposite, getComposite, getParentDataHolder, getRepositoryData, getRootDataHolder, removeValue, setValue, setValue, synchronizeValues
Methods inherited from interface org.ametys.plugins.repository.RemovableAmetysObject
remove
Methods inherited from interface org.ametys.plugins.repository.TraversableAmetysObject
getChildAt, getChildPosition
-
Field Details
-
OPTION_NAME_PREFIX
Prefix for options- See Also:
-
-
Constructor Details
-
SurveyQuestion
Creates aSurveyQuestion
.- Parameters:
node
- the node backing thisAmetysObject
.parentPath
- the parent path in the Ametys hierarchy.factory
- theSurveyFactory
which creates the AmetysObject.
-
-
Method Details
-
getLabel
Retrieves the label.- Returns:
- the label.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setLabel
Set the label.- Parameters:
label
- the label.- Throws:
AmetysRepositoryException
- if an error occurs.
-
getTitle
Retrieves the title.- Returns:
- the title.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setTitle
Set the title.- Parameters:
title
- the title.- Throws:
AmetysRepositoryException
- if an error occurs.
-
getType
Retrieves the type.- Returns:
- the type.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setType
Set the type.- Parameters:
type
- the type.- Throws:
AmetysRepositoryException
- if an error occurs.
-
getRegExpType
Retrieves the regexp type.- Returns:
- the regexp type.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setRegExpType
Set the regexp type.- Parameters:
regexp
- the regexp type.- Throws:
AmetysRepositoryException
- if an error occurs.
-
getRegExpPattern
Get the validation pattern.- Returns:
- the validation pattern.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
isMandatory
Determines if the question is mandatory.- Returns:
- true if the question is mandatory.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setMandatory
Set the mandatory.- Parameters:
mandatory
- true for mandatory- Throws:
AmetysRepositoryException
- if an error occurs.
-
hasOtherOption
Determines if the question has a "other" option- Returns:
- true if the question has a "other" option
-
setOtherOption
Set the "other" option. To be used only for single or multiple choice question- Parameters:
other
- true to add the "other" option
-
setOptions
Set options- Parameters:
options
- the options as a Map of key, value- Throws:
AmetysRepositoryException
- if an error occurs.
-
getOptions
Get options- Returns:
- the options as a Map of key, value
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setColumns
Set columns- Parameters:
columns
- the columns as a Map of key, value- Throws:
AmetysRepositoryException
- if an error occurs.
-
getColumns
Get columns- Returns:
- the columns as a Map of key, value
- Throws:
AmetysRepositoryException
- if an error occurs.
-
addRules
public void addRules(String option, SurveyRule.RuleType ruleType, String page) throws AmetysRepositoryException Add a rule for branching- Parameters:
option
- the chosen optionruleType
- the rule typepage
- the page to jump or skip. Can be null.- Throws:
AmetysRepositoryException
- if an error occurs.
-
hasRule
Determines if a rule with given option exists- Parameters:
option
- the option- Returns:
- true if teh rule exists
- Throws:
AmetysRepositoryException
- if an error occurs.
-
deleteRule
Delete a rule- Parameters:
option
- the option to delete- Throws:
AmetysRepositoryException
- if an error occurs.
-
getRules
Get the rules- Returns:
- the rules
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getSurveyPage
Get the page to which this question belongs.- Returns:
- the page to which this question belongs.
- Throws:
AmetysRepositoryException
- if a repository error occurs when retrieving the page attached to a survey
-
getSurvey
Get the survey to which this question belongs.- Returns:
- the survey to which this question belongs.
- Throws:
AmetysRepositoryException
- if a repository error occurs when retrieving a survey
-
copyTo
public SurveyQuestion copyTo(ModifiableTraversableAmetysObject parent, String name) throws AmetysRepositoryException Description copied from interface:CopiableAmetysObject
Copy the currentAmetysObject
to the given object. Be careful, this method save changes.- Parameters:
parent
- The parent of the new object. Can not be null.name
- Name of the new object. Can be null. If null, the new name will be get from the copied object- Returns:
- the created object
- Throws:
AmetysRepositoryException
- if an error occurs.
-
copyTo
public SurveyQuestion copyTo(ModifiableTraversableAmetysObject parent, String name, List<String> restrictTo) throws AmetysRepositoryException Description copied from interface:CopiableAmetysObject
Copy the currentAmetysObject
to the given object if it is not in the restriction list. Be careful, this method save changes.- Parameters:
parent
- The parent of the new object. Can not be null.name
- Name of the new object. Can be null. If null, the new name will be get from the copied objectrestrictTo
- A restrict list ofCopiableAmetysObject
authorized to be copied- Returns:
- the created object
- Throws:
AmetysRepositoryException
- if an error occurs.
-