Class FormQuestion
java.lang.Object
- All Implemented Interfaces:
IndexableAmetysObject,ModifiableIndexableAmetysObject,IndexableDataHolder,ModifiableIndexableDataHolder,IndexableJCRAmetysObject,ACLAmetysObject,AmetysObject,ModelAwareAmetysObject,ModifiableModelAwareAmetysObject,DataHolder,ModelAwareDataHolder,ModifiableDataHolder,ModifiableModelAwareDataHolder,JCRAmetysObject,JCRTraversableAmetysObject,ModelAwareJCRAmetysObject,MetadataAwareAmetysObject,ModifiableMetadataAwareAmetysObject,ModifiableACLAmetysObject,ModifiableAmetysObject,ModifiableTraversableAmetysObject,RemovableAmetysObject,TraversableAmetysObject,SiteAwareAmetysObject
public class FormQuestion
extends DefaultIndexableTraversableAmetysObject<FormQuestionFactory>
implements 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, 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 givenModifiableDataHolder.voiddeletePageRule(String option) Delete a ruleGet 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.cms.repository.DefaultIndexableTraversableAmetysObject
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.cms.repository.SimpleIndexableAmetysObject
getComposite, getComposite, getDataHolder, getExternalComposite, getExternalComposite, getExternalRepeater, getExternalRepeater, getLocalComposite, getLocalComposite, getLocalRepeater, getLocalRepeater, getParentDataHolder, getRepeater, getRepeater, getRootDataHolder, indexDataMethods inherited from class org.ametys.plugins.repository.jcr.SimpleModelAwareAmetysObject
dataToJSON, dataToJSON, dataToJSONForEdition, dataToMap, dataToSAX, dataToSAX, dataToSAXForEdition, getDefinition, getDifferences, getDifferences, getDifferences, getDifferences, getExternalValue, getLocalValue, getModel, getModelItemTypeExtensionPoint, getRepositoryData, getStatus, getType, getValueOfType, getValueOfTypeOrDefault, getValueOrDefault, getValueWithMultiValuedPathSegments, hasDefinition, hasDifferences, hasDifferences, hasDifferences, hasDifferences, hasExternalValue, hasExternalValueOrEmpty, hasLocalValue, hasLocalValueOrEmpty, hasValue, hasValue, hasValueOrEmpty, isMultiple, isMultiple, removeExternalizableMetadataIfExists, removeExternalValue, removeLocalValue, removeValue, setExternalValue, setLocalValue, setStatus, setValue, setValue, synchronizeValues, synchronizeValues, synchronizeValues, synchronizeValuesMethods 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
dataToJSON, dataToSAX, equals, getDataNames, getValue, getValueOrDefault, 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.holder.DataHolder
copyTo, dataToJSON, dataToJSON, dataToSAX, dataToSAX, getValue, getValueOrDefault, hasValue, hasValueOrEmptyMethods inherited from interface org.ametys.cms.data.ametysobject.IndexableAmetysObject
getSystemPropertyExtensionPoint, indexDataMethods inherited from interface org.ametys.plugins.repository.jcr.JCRAmetysObject
getNodeMethods inherited from interface org.ametys.plugins.repository.data.ametysobject.ModelAwareAmetysObject
getModelMethods inherited from interface org.ametys.plugins.repository.data.holder.ModelAwareDataHolder
dataToJSON, dataToJSON, dataToJSON, dataToJSON, dataToJSONForEdition, dataToMap, dataToMap, dataToMap, dataToMap, dataToSAX, dataToSAX, dataToSAX, dataToSAX, dataToSAXForEdition, getDataNames, getDefinition, getDifferences, getDifferences, getDifferences, getDifferences, getExternalValue, getLocalValue, getModelItemTypeExtensionPoint, getStatus, getType, getValueOfType, getValueOfTypeOrDefault, getValueOrDefault, getValueWithMultiValuedPathSegments, hasDefinition, hasDifferences, hasDifferences, hasDifferences, hasDifferences, hasExternalValue, hasExternalValueOrEmpty, hasLocalValue, hasLocalValueOrEmpty, hasValue, isMultiple, isMultipleMethods inherited from interface org.ametys.plugins.repository.ModifiableAmetysObject
needsSave, rename, revertChanges, saveChangesMethods inherited from interface org.ametys.plugins.repository.data.holder.ModifiableDataHolder
getRepositoryData, removeValue, synchronizeValuesMethods inherited from interface org.ametys.plugins.repository.metadata.ModifiableMetadataAwareAmetysObject
getMetadataHolderMethods inherited from interface org.ametys.plugins.repository.data.holder.ModifiableModelAwareDataHolder
removeExternalizableMetadataIfExists, removeExternalValue, removeLocalValue, setExternalValue, setLocalValue, setStatus, setValue, setValue, 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. (If the user has to answer it)- 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 UnknownTypeException, NotUniqueTypeException, BadItemTypeException Description copied from interface:DataHolderCopies the currentDataHolderto the givenModifiableDataHolder.- Specified by:
copyToin interfaceDataHolder- Parameters:
dataHolder- The destination dataHolder. Can not be null.- Throws:
UnknownTypeException- if there is no available type compatible with the copied value for the type extension point of the destinationModifiableDataHolderNotUniqueTypeException- if there is more than one available types compatibles with the copied value for the type extension point of the destinationModifiableDataHolderBadItemTypeException- if type of a data to copy doesn't match the data with same path in the destinationModifiableDataHolder
-
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.
-
isCacheable
Returns true if the question is cacheable.- Returns:
- true if the question is cacheable.
-