Class FormQuestion
java.lang.Object
org.ametys.plugins.repository.AbstractAmetysObject
org.ametys.plugins.repository.jcr.SimpleAmetysObject<F>
org.ametys.plugins.repository.jcr.DefaultTraversableAmetysObject<FormQuestionFactory>
org.ametys.plugins.forms.repository.FormQuestion
- All Implemented Interfaces:
ModelAwareDataAwareAmetysObject,ModifiableModelAwareDataAwareAmetysObject,IndexableDataHolder,ModifiableIndexableDataHolder,ACLAmetysObject,AmetysObject,DataAwareAmetysObject,ModelAwareDataAwareAmetysObject,ModifiableModelAwareDataAwareAmetysObject,DataHolder,ModelAwareDataHolder,ModifiableDataHolder,ModifiableModelAwareDataHolder,JCRAmetysObject,JCRTraversableAmetysObject,MetadataAwareAmetysObject,ModifiableMetadataAwareAmetysObject,ModifiableACLAmetysObject,ModifiableAmetysObject,ModifiableTraversableAmetysObject,RemovableAmetysObject,TraversableAmetysObject,SiteAwareAmetysObject
public class FormQuestion
extends DefaultTraversableAmetysObject<FormQuestionFactory>
implements ModifiableModelAwareDataAwareAmetysObject, SiteAwareAmetysObject
AmetysObject for storing form-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringConstant for default identifier attribute.static final StringConstant for page id attribute.static final StringConstant for rule attribute.static final StringConstant for rules repeater.static final StringConstant for title attribute.static final StringConstant for type attribute.Fields inherited from interface org.ametys.plugins.repository.data.holder.ModelAwareDataHolder
ALTERNATIVE_SUFFIX, COMMENTS_SUFFIX, STATUS_SUFFIXFields inherited from interface org.ametys.web.repository.SiteAwareAmetysObject
METADATA_SITE -
Constructor Summary
ConstructorsConstructorDescriptionFormQuestion(javax.jcr.Node node, String parentPath, FormQuestionFactory factory) Creates aFormQuestion. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPageRules(String option, FormPageRule.PageRuleType ruleType, String pageId) Add a page rule for branchingbooleanDetermines if we can read the question for the current step.booleanDetermines if we can write the question for the current step.voidcopyTo(ModifiableDataHolder dataHolder) Copies the currentDataHolderto the givenModifiableModelAwareDataHolder.voiddeletePageRule(String option) Delete a ruleReturns theDataHolderof thisAmetysObject.Get the first question rulegetForm()Get the form to which this question belongs.Get the page to which this question belongs.Retrieves the name for form.Get the page rulesGet the question rulesgetSite()Returns this object's site.Returns this object's site name.getTitle()Retrieves the title.getType()Retrieves the type.booleanhasPageRule(String option) Determines if a rule with given option existsbooleanReturns true if the question is cacheable.booleanDetermines if the question is mandatory.booleanDetermines if the question is modifiablebooleanDetermines if the question is read restricted.voidsetNameForForm(String name) Set the name for form.voidSet the title.voidSet the type id.voidsetTypeId(FormQuestionType type) Set the type id.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, 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, dataToSAXMethods inherited from interface org.ametys.plugins.repository.jcr.JCRAmetysObject
getNodeMethods inherited from interface org.ametys.cms.data.ametysobject.ModelAwareDataAwareAmetysObject
getSystemPropertyExtensionPoint, indexData, indexDataMethods inherited from interface org.ametys.plugins.repository.data.ametysobject.ModelAwareDataAwareAmetysObject
dataToJSON, dataToJSONForEdition, dataToMap, dataToSAX, dataToSAXForEdition, getComments, getDataNames, getDefinition, getDifferences, getDifferences, getDifferences, getDifferences, getExternalValue, getLocalValue, getModel, getStatus, getValue, getValue, hasComments, hasDefinition, hasDifferences, hasDifferences, hasDifferences, hasDifferences, hasExternalValue, hasExternalValueOrEmpty, hasLocalValue, hasLocalValueOrEmpty, hasValue, hasValueOrEmptyMethods inherited from interface org.ametys.plugins.repository.data.holder.ModelAwareDataHolder
commentsToSAX, dataToJSON, dataToJSON, dataToJSON, dataToMap, dataToMap, dataToMap, dataToSAX, dataToSAX, dataToSAX, getDataNames, getType, getValue, hasValue, hasValueOrEmpty, isMultipleMethods inherited from interface org.ametys.plugins.repository.ModifiableAmetysObject
needsSave, rename, revertChanges, saveChangesMethods inherited from interface org.ametys.plugins.repository.data.holder.ModifiableDataHolder
getRepositoryDataMethods inherited from interface org.ametys.plugins.repository.metadata.ModifiableMetadataAwareAmetysObject
getMetadataHolderMethods inherited from interface org.ametys.cms.data.ametysobject.ModifiableModelAwareDataAwareAmetysObject
getComposite, getComposite, getExternalComposite, getExternalComposite, getExternalRepeater, getExternalRepeater, getLocalComposite, getLocalComposite, getLocalRepeater, getLocalRepeater, getParentDataHolder, getRepeater, getRepeater, getRootDataHolderMethods inherited from interface org.ametys.plugins.repository.data.ametysobject.ModifiableModelAwareDataAwareAmetysObject
getRepositoryData, removeExternalizableMetadataIfExists, removeExternalValue, removeLocalValue, removeValue, setComments, setExternalValue, setLocalValue, setStatus, setValue, synchronizeValues, synchronizeValues, synchronizeValues, synchronizeValuesMethods inherited from interface org.ametys.plugins.repository.RemovableAmetysObject
removeMethods inherited from interface org.ametys.plugins.repository.TraversableAmetysObject
getChildAt, getChildPosition
-
Field Details
-
ATTRIBUTE_PAGE_ID
Constant for page id attribute.- See Also:
-
ATTRIBUTE_TITLE
Constant for title attribute.- See Also:
-
ATTRIBUTE_NAME_FOR_FORM
Constant for default identifier attribute.- See Also:
-
ATTRIBUTE_TYPE
Constant for type attribute.- See Also:
-
ATTRIBUTE_RULES
Constant for rules repeater.- See Also:
-
ATTRIBUTE_RULE
Constant for rule attribute.- See Also:
-
-
Constructor Details
-
FormQuestion
Creates aFormQuestion.- Parameters:
node- the node backing thisAmetysObject.parentPath- the parent path in the Ametys hierarchy.factory- theFormFactorywhich creates the AmetysObject.
-
-
Method Details
-
getFormPage
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 form
-
getForm
Get the form to which this question belongs.- Returns:
- the form to which this question belongs.
- Throws:
AmetysRepositoryException- if a repository error occurs when retrieving a form
-
getType
Retrieves the type.- Returns:
- the type.
-
setTypeId
Set the type id.- Parameters:
typeId- the type id.
-
setTypeId
Set the type id.- Parameters:
type- the type.
-
getNameForForm
Retrieves the name for form.- Returns:
- the name for form.
-
setNameForForm
Set the name for form.- Parameters:
name- the name for form.
-
getTitle
Retrieves the title.- Returns:
- the title.
-
setTitle
Set the title.- Parameters:
title- the title.
-
isMandatory
Determines if the question is mandatory.- Returns:
- true if the question is mandatory.
-
isReadRestricted
Determines if the question is read restricted.- Returns:
- true if the question is read restricted.
-
canRead
Determines if we can read the question for the current step.- Parameters:
currentStep- the current step of the form entry- Returns:
trueif we can read the question for the current step.
-
isModifiable
Determines if the question is modifiable- Returns:
- true if the question is modifiable.
-
canWrite
Determines if we can write the question for the current step.- Parameters:
currentStep- the current step of the form entry- Returns:
trueif we can write the question for the current step.
-
getQuestionRules
Get the question rules- Returns:
- A RuleTypeQuestion's name
-
getFirstQuestionRule
Get the first question rule- Returns:
- A RuleTypeQuestion's name
-
getPageRules
Get the page rules- Returns:
- the page rules
- Throws:
AmetysRepositoryException- if an error occurs.
-
hasPageRule
Determines if a rule with given option exists- Parameters:
option- the option- Returns:
- true if the rule exists
- Throws:
AmetysRepositoryException- if an error occurs.
-
addPageRules
Add a page rule for branching- Parameters:
option- the chosen optionruleType- the page rule typepageId- Id of the page to jump or skip. Can be null.- Throws:
AmetysRepositoryException- if an error occurs.
-
deletePageRule
Delete a rule- Parameters:
option- the option to delete- Throws:
AmetysRepositoryException- if an error occurs.
-
copyTo
public void copyTo(ModifiableDataHolder dataHolder) throws UndefinedItemPathException, BadItemTypeException, UnknownTypeException, NotUniqueTypeException Description copied from interface:DataHolderCopies the currentDataHolderto the givenModifiableModelAwareDataHolder.- Specified by:
copyToin interfaceDataAwareAmetysObject- Specified by:
copyToin interfaceDataHolder- Parameters:
dataHolder- The destination dataHolder. Can not be null.- Throws:
UndefinedItemPathException- if one of the copied data is not defined by the model of the destinationModifiableModelAwareDataHolderBadItemTypeException- if the type defined by the model of the destinationModifiableModelAwareDataHolderdoesn't match the copied valueUnknownTypeException- if there is no available type compatible with the copied value for the type extension point of the destinationModifiableModelLessDataHolderNotUniqueTypeException- if there is more than one available types compatibles with the copied value for the type extension point of the destinationModifiableModelLessDataHolder
-
getSiteName
Description copied from interface:SiteAwareAmetysObjectReturns this object's site name.- Specified by:
getSiteNamein interfaceSiteAwareAmetysObject- Returns:
- this object's site name.
- Throws:
AmetysRepositoryException- if an error occurs.
-
getSite
Description copied from interface:SiteAwareAmetysObjectReturns this object's site.- Specified by:
getSitein interfaceSiteAwareAmetysObject- Returns:
- this object's site
- Throws:
AmetysRepositoryException- if an error occurs.
-
getDataHolder
Description copied from interface:DataAwareAmetysObjectReturns theDataHolderof thisAmetysObject.- Specified by:
getDataHolderin interfaceDataAwareAmetysObject- Specified by:
getDataHolderin interfaceModelAwareDataAwareAmetysObject- Specified by:
getDataHolderin interfaceModelAwareDataAwareAmetysObject- Specified by:
getDataHolderin interfaceModifiableModelAwareDataAwareAmetysObject- Specified by:
getDataHolderin interfaceModifiableModelAwareDataAwareAmetysObject- Returns:
- the
DataHolderof thisAmetysObject
-
isCacheable
Returns true if the question is cacheable.- Returns:
- true if the question is cacheable.
-