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
Nested Classes -
Field Summary
FieldsFields inherited from class org.ametys.plugins.survey.repository.AbstractSurveyElement
PROPERTY_PICTURE, PROPERTY_PICTURE_ALTERNATIVE, PROPERTY_PICTURE_ID, PROPERTY_PICTURE_TYPE -
Constructor Summary
ConstructorsConstructorDescriptionSurveyQuestion(javax.jcr.Node node, String parentPath, SurveyQuestionFactory factory) Creates aSurveyQuestion. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRules(String option, SurveyRule.RuleType ruleType, String page) Add a rule for branchingcopyTo(ModifiableTraversableAmetysObject parent, String name) Copy the currentAmetysObjectto the given object.copyTo(ModifiableTraversableAmetysObject parent, String name, List<String> restrictTo) Copy the currentAmetysObjectto the given object if it is not in the restriction list.voiddeleteRule(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.booleanDetermines if the question has a "other" optionbooleanDetermines if a rule with given option existsbooleanDetermines if the question is mandatory.voidsetColumns(Map<String, String> columns) Set columnsvoidSet the label.voidsetMandatory(boolean mandatory) Set the mandatory.voidsetOptions(Map<String, String> options) Set optionsvoidsetOtherOption(boolean other) Set the "other" option.voidsetRegExpType(String regexp) Set the regexp type.voidSet the title.voidSet the type.Methods inherited from class org.ametys.plugins.survey.repository.AbstractSurveyElement
copyPictureTo, getDataHolder, getExternalPicture, getPictureAlternative, getPictureType, getResourcePictureId, removePictureMetas, setExternalPicture, setNoPicture, setPictureAlternative, setPictureType, setResourcePictureMethods 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, removeDeniedUsersMethods inherited from class org.ametys.plugins.repository.jcr.SimpleAmetysObject
_getFactory, _invalidateName, _invalidateParentPath, getId, getMetadataHolder, getName, getNode, getParent, getParentPath, getPath, needsSave, remove, rename, revertChanges, saveChangesMethods inherited from class org.ametys.plugins.repository.AbstractAmetysObject
equals, hashCode, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.ametys.plugins.repository.AmetysObject
equals, getId, getName, getParent, getParentPath, getPath, hashCodeMethods inherited from interface org.ametys.plugins.repository.data.ametysobject.DataAwareAmetysObject
copyTo, dataToJSON, dataToJSON, dataToSAX, dataToSAX, getDataNamesMethods inherited from interface org.ametys.plugins.repository.jcr.JCRAmetysObject
getNodeMethods inherited from interface org.ametys.plugins.repository.data.ametysobject.ModelLessDataAwareAmetysObject
dataToJSON, dataToSAX, getModelItemTypeExtensionPoint, getType, getValue, getValue, getValueOfType, getValueOfType, hasValue, hasValue, hasValueOrEmpty, isMultiple, isMultipleMethods inherited from interface org.ametys.plugins.repository.data.holder.ModelLessDataHolder
dataToJSON, dataToSAX, hasValue, hasValueOrEmptyMethods inherited from interface org.ametys.plugins.repository.ModifiableAmetysObject
needsSave, rename, revertChanges, saveChangesMethods inherited from interface org.ametys.plugins.repository.metadata.ModifiableMetadataAwareAmetysObject
getMetadataHolderMethods inherited from interface org.ametys.plugins.repository.data.ametysobject.ModifiableModelLessDataAwareAmetysObject
getComposite, getComposite, getParentDataHolder, getRepositoryData, getRootDataHolder, removeValue, setValue, setValue, synchronizeValuesMethods inherited from interface org.ametys.plugins.repository.RemovableAmetysObject
removeMethods 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- theSurveyFactorywhich 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:CopiableAmetysObjectCopy the currentAmetysObjectto 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:CopiableAmetysObjectCopy the currentAmetysObjectto 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 ofCopiableAmetysObjectauthorized to be copied- Returns:
- the created object
- Throws:
AmetysRepositoryException- if an error occurs.
-