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
Modifier and TypeFieldDescriptionstatic final String
Constant for default identifier attribute.static final String
Constant for page id attribute.static final String
Constant for rule attribute.static final String
Constant for rules repeater.static final String
Constant for title attribute.static final String
Constant for type attribute.Fields inherited from interface org.ametys.plugins.repository.data.holder.ModelAwareDataHolder
ALTERNATIVE_SUFFIX, COMMENTS_SUFFIX, STATUS_SUFFIX
Fields inherited from interface org.ametys.web.repository.SiteAwareAmetysObject
METADATA_SITE
-
Constructor Summary
ConstructorDescriptionFormQuestion
(javax.jcr.Node node, String parentPath, FormQuestionFactory factory) Creates aFormQuestion
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPageRules
(String option, FormPageRule.PageRuleType ruleType, String pageId) Add a page rule for branchingboolean
Determines if we can read the question for the current step.boolean
Determines if we can write the question for the current step.void
deletePageRule
(String option) Delete a ruleReturns theDataHolder
of 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.boolean
hasPageRule
(String option) Determines if a rule with given option existsboolean
Returns true if the question is cacheable.boolean
Determines if the question is mandatory.boolean
Determines if the question is modifiableboolean
Determines if the question is read restricted.void
setNameForForm
(String name) Set the name for form.void
Set the title.void
Set the type id.void
setTypeId
(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, 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
Methods inherited from interface org.ametys.plugins.repository.jcr.JCRAmetysObject
getNode
Methods inherited from interface org.ametys.cms.data.ametysobject.ModelAwareDataAwareAmetysObject
getSystemPropertyExtensionPoint, indexData, indexData
Methods inherited from interface org.ametys.plugins.repository.data.ametysobject.ModelAwareDataAwareAmetysObject
dataToJSON, dataToJSONForEdition, dataToMap, dataToSAX, dataToSAXForEdition, getComments, getDataNames, getDefinition, getExternalValue, getLocalValue, getModel, getStatus, getValue, getValue, hasComments, hasDefinition, hasExternalValue, hasExternalValueOrEmpty, hasLocalValue, hasLocalValueOrEmpty, hasValue, hasValueOrEmpty
Methods 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, isMultiple
Methods inherited from interface org.ametys.plugins.repository.ModifiableAmetysObject
needsSave, rename, revertChanges, saveChanges
Methods inherited from interface org.ametys.plugins.repository.data.holder.ModifiableDataHolder
getRepositoryData
Methods inherited from interface org.ametys.plugins.repository.metadata.ModifiableMetadataAwareAmetysObject
getMetadataHolder
Methods inherited from interface org.ametys.cms.data.ametysobject.ModifiableModelAwareDataAwareAmetysObject
getComposite, getComposite, getExternalComposite, getExternalComposite, getExternalRepeater, getExternalRepeater, getLocalComposite, getLocalComposite, getLocalRepeater, getLocalRepeater, getParentDataHolder, getRepeater, getRepeater, getRootDataHolder
Methods inherited from interface org.ametys.plugins.repository.data.ametysobject.ModifiableModelAwareDataAwareAmetysObject
getRepositoryData, removeExternalizableMetadataIfExists, removeExternalValue, removeLocalValue, removeValue, setComments, setExternalValue, setLocalValue, setStatus, setValue, synchronizeValues, synchronizeValues, synchronizeValues, synchronizeValues
Methods inherited from interface org.ametys.plugins.repository.RemovableAmetysObject
remove
Methods 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
- theFormFactory
which 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:
true
if 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:
true
if 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.
-
getSiteName
Description copied from interface:SiteAwareAmetysObject
Returns this object's site name.- Specified by:
getSiteName
in interfaceSiteAwareAmetysObject
- Returns:
- this object's site name.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getSite
Description copied from interface:SiteAwareAmetysObject
Returns this object's site.- Specified by:
getSite
in interfaceSiteAwareAmetysObject
- Returns:
- this object's site
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getDataHolder
Description copied from interface:DataAwareAmetysObject
Returns theDataHolder
of thisAmetysObject
.- Specified by:
getDataHolder
in interfaceDataAwareAmetysObject
- Specified by:
getDataHolder
in interfaceModelAwareDataAwareAmetysObject
- Specified by:
getDataHolder
in interfaceModelAwareDataAwareAmetysObject
- Specified by:
getDataHolder
in interfaceModifiableModelAwareDataAwareAmetysObject
- Specified by:
getDataHolder
in interfaceModifiableModelAwareDataAwareAmetysObject
- Returns:
- the
DataHolder
of thisAmetysObject
-
isCacheable
Returns true if the question is cacheable.- Returns:
- true if the question is cacheable.
-