Class SurveyPage
- 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<SurveyPageFactory>
-
- org.ametys.plugins.survey.repository.SurveyPage
-
- All Implemented Interfaces:
ACLAmetysObject,AmetysObject,CopiableAmetysObject,DataAwareAmetysObject,ModelLessDataAwareAmetysObject,ModifiableModelLessDataAwareAmetysObject,DataHolder,ModelLessDataHolder,ModifiableDataHolder,ModifiableModelLessDataHolder,JCRAmetysObject,JCRTraversableAmetysObject,MetadataAwareAmetysObject,ModifiableMetadataAwareAmetysObject,ModifiableACLAmetysObject,ModifiableAmetysObject,ModifiableTraversableAmetysObject,RemovableAmetysObject,TraversableAmetysObject
public class SurveyPage extends AbstractSurveyElement<SurveyPageFactory>
AmetysObjectfor storing survey
-
-
Field Summary
Fields Modifier and Type Field Description private static String__PROPERTY_DESCConstants for description metadata.private static String__PROPERTY_LABELConstants for title metadata.private static String__PROPERTY_RULEConstants for rules metadata.private static String__PROPERTY_RULE_PAGEprivate static String__PROPERTY_RULE_TYPEprivate static String__PROPERTY_TITLEConstants for title metadata.-
Fields inherited from class org.ametys.plugins.survey.repository.AbstractSurveyElement
PROPERTY_PICTURE, PROPERTY_PICTURE_ALTERNATIVE, PROPERTY_PICTURE_ID, PROPERTY_PICTURE_TYPE
-
-
Constructor Summary
Constructors Constructor Description SurveyPage(Node node, String parentPath, SurveyPageFactory factory)Creates aSurveyPage.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SurveyPagecopyTo(ModifiableTraversableAmetysObject parent, String name)Copy the currentAmetysObjectto the given object.SurveyPagecopyTo(ModifiableTraversableAmetysObject parent, String name, List<String> restrictTo)Copy the currentAmetysObjectto the given object if it is not in the restriction list.voiddeleteRule()Delete the ruleStringgetDescription()Retrieves the description.StringgetLabel()Retrieves the survey name.SurveyQuestiongetQuestion(String name)Get a question.AmetysObjectIterable<SurveyQuestion>getQuestions()Get the page's questions.SurveyRulegetRule()Get ruleSurveygetSurvey()Get the Survey to which this page belongs.StringgetTitle()Retrieves the title.booleanhasQuestion(String name)Determines if question existsbooleanhasRule()Determines if the page has a rulevoidsetDescription(String description)Set the description.voidsetLabel(String name)Set the survey name.voidsetRule(SurveyRule.RuleType ruleType, String page)Set the rule for branchingvoidsetTitle(String title)Set the title.-
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, 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
dataToSAX, getType, getValue, getValue, getValueOfType, getValueOfType, hasNonEmptyValue, hasValue, isMultiple
-
Methods inherited from interface org.ametys.plugins.repository.data.holder.ModelLessDataHolder
dataToSAX, hasNonEmptyValue, hasValue
-
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 Detail
-
__PROPERTY_LABEL
private static final String __PROPERTY_LABEL
Constants for title metadata.- See Also:
- Constant Field Values
-
__PROPERTY_TITLE
private static final String __PROPERTY_TITLE
Constants for title metadata.- See Also:
- Constant Field Values
-
__PROPERTY_DESC
private static final String __PROPERTY_DESC
Constants for description metadata.- See Also:
- Constant Field Values
-
__PROPERTY_RULE
private static final String __PROPERTY_RULE
Constants for rules metadata.- See Also:
- Constant Field Values
-
__PROPERTY_RULE_TYPE
private static final String __PROPERTY_RULE_TYPE
- See Also:
- Constant Field Values
-
__PROPERTY_RULE_PAGE
private static final String __PROPERTY_RULE_PAGE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SurveyPage
public SurveyPage(Node node, String parentPath, SurveyPageFactory factory)
Creates aSurveyPage.- Parameters:
node- the node backing thisAmetysObject.parentPath- the parent path in the Ametys hierarchy.factory- theSurveyFactorywhich creates the AmetysObject.
-
-
Method Detail
-
getTitle
public String getTitle() throws AmetysRepositoryException
Retrieves the title.- Returns:
- the title.
- Throws:
AmetysRepositoryException- if an error occurs.
-
setTitle
public void setTitle(String title) throws AmetysRepositoryException
Set the title.- Parameters:
title- the title.- Throws:
AmetysRepositoryException- if an error occurs.
-
getLabel
public String getLabel() throws AmetysRepositoryException
Retrieves the survey name.- Returns:
- the the survey name.
- Throws:
AmetysRepositoryException- if an error occurs.
-
setLabel
public void setLabel(String name) throws AmetysRepositoryException
Set the survey name.- Parameters:
name- the survey name.- Throws:
AmetysRepositoryException- if an error occurs.
-
getDescription
public String getDescription() throws AmetysRepositoryException
Retrieves the description.- Returns:
- the description.
- Throws:
AmetysRepositoryException- if an error occurs.
-
setDescription
public void setDescription(String description) throws AmetysRepositoryException
Set the description.- Parameters:
description- the description.- Throws:
AmetysRepositoryException- if an error occurs.
-
setRule
public void setRule(SurveyRule.RuleType ruleType, String page) throws AmetysRepositoryException
Set the rule for branching- Parameters:
ruleType- the rule typepage- the page to jump or skip. Can be null.- Throws:
AmetysRepositoryException- if an error occurs.
-
deleteRule
public void deleteRule() throws AmetysRepositoryException
Delete the rule- Throws:
AmetysRepositoryException- if an error occurs.
-
hasRule
public boolean hasRule() throws AmetysRepositoryException
Determines if the page has a rule- Returns:
- true if the page has a rule
- Throws:
AmetysRepositoryException- if an error occurs.
-
getRule
public SurveyRule getRule() throws AmetysRepositoryException
Get rule- Returns:
- the rules
- Throws:
AmetysRepositoryException- if an error occurs.
-
getSurvey
public Survey getSurvey() throws AmetysRepositoryException
Get the Survey to which this page belongs.- Returns:
- the Survey to which this page belongs.
- Throws:
AmetysRepositoryException- if an error occurs when retrieving the survey of a page
-
hasQuestion
public boolean hasQuestion(String name) throws AmetysRepositoryException
Determines if question exists- Parameters:
name- The question name- Returns:
- <code>true</code> true if the question exists
- Throws:
AmetysRepositoryException- if an error occurs when looking for a survey question
-
getQuestion
public SurveyQuestion getQuestion(String name) throws AmetysRepositoryException
Get a question.- Parameters:
name- the question name.- Returns:
- the question.
- Throws:
AmetysRepositoryException- if an error occurs when retrieving a question of a survey
-
getQuestions
public AmetysObjectIterable<SurveyQuestion> getQuestions() throws AmetysRepositoryException
Get the page's questions.- Returns:
- the page's questions.
- Throws:
AmetysRepositoryException- if an error occurs when retrieving all the questions of a survey
-
copyTo
public SurveyPage 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 SurveyPage 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.
-
-