Class Survey
-
- All Implemented Interfaces:
ACLAmetysObject
,AmetysObject
,CopiableAmetysObject
,DataAwareAmetysObject
,ModelLessDataAwareAmetysObject
,ModifiableModelLessDataAwareAmetysObject
,DataHolder
,ModelLessDataHolder
,ModifiableDataHolder
,ModifiableModelLessDataHolder
,JCRAmetysObject
,JCRTraversableAmetysObject
,MetadataAwareAmetysObject
,ModifiableMetadataAwareAmetysObject
,ModifiableACLAmetysObject
,ModifiableAmetysObject
,ModifiableTraversableAmetysObject
,RemovableAmetysObject
,TraversableAmetysObject
,SiteAwareAmetysObject
public class Survey extends AbstractSurveyElement<SurveyFactory> implements SiteAwareAmetysObject
AmetysObject
representing a survey
-
-
Field Summary
-
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 Survey(Node node, String parentPath, SurveyFactory factory)
Creates aSurvey
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Survey
copyTo(ModifiableTraversableAmetysObject parent, String name)
Copy the currentAmetysObject
to the given object.Survey
copyTo(ModifiableTraversableAmetysObject parent, String name, List<String> restrictTo)
Copy the currentAmetysObject
to the given object if it is not in the restriction list.String
findUniqueQuestionName(String originalName)
Returns a unique question name in the surveyString
getDescription()
Retrieves the description.Date
getEndDate()
Get the end dateString
getEndingMessage()
Retrieves the ending message.String
getLabel()
Retrieves the survey label.String
getLanguage()
Get the survey language.List<SurveyPage>
getPages()
Get the survey pages.SurveyQuestion
getQuestion(String name)
Get a question by its name.AmetysObjectIterable<SurveyQuestion>
getQuestions()
Get the survey questions.String
getRedirection()
Retrieves the redirection.ZonedDateTime
getReinitDate()
Get the date of the last re-initialization of the surveySite
getSite()
Returns this object's site.String
getSiteName()
Returns this object's site name.Date
getStartDate()
Get the start dateString
getTitle()
Retrieves the title.Date
getValidationDate()
Get the date of validationboolean
isValidated()
Determines if the survey is validated.void
reinit()
Re-initialize the survey.void
setDescription(String description)
Set the description.void
setEndDate(Date date)
Set the end datevoid
setEndingMessage(String message)
Set the ending message.void
setLabel(String label)
Set the survey label.void
setRedirection(String pageId)
Set the redirection.void
setStartDate(Date date)
Set the start datevoid
setTitle(String title)
Set the title.void
setValidated(boolean validated)
Valid or invalid surveyvoid
setValidationDate(Date date)
Set the date of validation-
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, hasValue, hasValueOrEmpty, isMultiple
-
Methods inherited from interface org.ametys.plugins.repository.data.holder.ModelLessDataHolder
dataToSAX, hasValue, hasValueOrEmpty
-
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
-
-
-
-
Constructor Detail
-
Survey
public Survey(Node node, String parentPath, SurveyFactory factory)
Creates aSurvey
.- Parameters:
node
- the node backing thisAmetysObject
.parentPath
- the parent path in the Ametys hierarchy.factory
- theSurveyFactory
which 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 label.- Returns:
- the the survey label.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setLabel
public void setLabel(String label) throws AmetysRepositoryException
Set the survey label.- Parameters:
label
- the survey label.- 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.
-
getEndingMessage
public String getEndingMessage() throws AmetysRepositoryException
Retrieves the ending message.- Returns:
- the ending message.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setEndingMessage
public void setEndingMessage(String message) throws AmetysRepositoryException
Set the ending message.- Parameters:
message
- the ending message.- Throws:
AmetysRepositoryException
- if an error occurs.
-
isValidated
public boolean isValidated() throws AmetysRepositoryException
Determines if the survey is validated.- Returns:
- true if the survey is validated.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setValidated
public void setValidated(boolean validated) throws AmetysRepositoryException
Valid or invalid survey- Parameters:
validated
- true to validate the survey- Throws:
AmetysRepositoryException
- if an error occurs.
-
setValidationDate
public void setValidationDate(Date date) throws AmetysRepositoryException
Set the date of validation- Parameters:
date
- The date of validation- Throws:
AmetysRepositoryException
- if an error occurs.
-
getValidationDate
public Date getValidationDate() throws AmetysRepositoryException
Get the date of validation- Returns:
- the date of validation
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setStartDate
public void setStartDate(Date date) throws AmetysRepositoryException
Set the start date- Parameters:
date
- The start date- Throws:
AmetysRepositoryException
- if an error occurs.
-
getStartDate
public Date getStartDate() throws AmetysRepositoryException
Get the start date- Returns:
- the start date
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setEndDate
public void setEndDate(Date date) throws AmetysRepositoryException
Set the end date- Parameters:
date
- The end date- Throws:
AmetysRepositoryException
- if an error occurs.
-
getEndDate
public Date getEndDate() throws AmetysRepositoryException
Get the end date- Returns:
- the end date
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getRedirection
public String getRedirection() throws AmetysRepositoryException
Retrieves the redirection.- Returns:
- the page id of redirection or null.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setRedirection
public void setRedirection(String pageId) throws AmetysRepositoryException
Set the redirection.- Parameters:
pageId
- the page id. Can be null to delete redirection- Throws:
AmetysRepositoryException
- if an error occurs.
-
reinit
public void reinit() throws AmetysRepositoryException
Re-initialize the survey. Just set the date of the last re-initialization of the survey.- Throws:
AmetysRepositoryException
- if an error occurs.
-
getReinitDate
public ZonedDateTime getReinitDate() throws AmetysRepositoryException
Get the date of the last re-initialization of the survey- Returns:
- the re-initialization date
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getPages
public List<SurveyPage> getPages() throws AmetysRepositoryException
Get the survey pages.- Returns:
- the survey pages.
- Throws:
AmetysRepositoryException
- if an error occurs when retrieving the pages of the survey
-
getQuestion
public SurveyQuestion getQuestion(String name) throws AmetysRepositoryException
Get a question by its name.- 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 survey questions.- Returns:
- the survey questions.
- Throws:
AmetysRepositoryException
- if an error occurs when retrieving all the questions of a survey
-
getSite
public Site getSite() throws AmetysRepositoryException
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.
-
getSiteName
public String getSiteName() throws AmetysRepositoryException
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.
-
getLanguage
public String getLanguage()
Get the survey language.- Returns:
- the survey language.
-
findUniqueQuestionName
public String findUniqueQuestionName(String originalName)
Returns a unique question name in the survey- Parameters:
originalName
- The original name- Returns:
- a unique question name
-
copyTo
public Survey copyTo(ModifiableTraversableAmetysObject parent, String name) throws AmetysRepositoryException
Description copied from interface:CopiableAmetysObject
Copy the currentAmetysObject
to the given object. Be careful, this method save changes.- Specified by:
copyTo
in interfaceCopiableAmetysObject
- 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 Survey copyTo(ModifiableTraversableAmetysObject parent, String name, List<String> restrictTo) throws AmetysRepositoryException
Description copied from interface:CopiableAmetysObject
Copy the currentAmetysObject
to the given object if it is not in the restriction list. Be careful, this method save changes.- Specified by:
copyTo
in interfaceCopiableAmetysObject
- 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 ofCopiableAmetysObject
authorized to be copied- Returns:
- the created object
- Throws:
AmetysRepositoryException
- if an error occurs.
-
-