public class Survey extends AbstractSurveyElement<SurveyFactory> implements SiteAwareAmetysObject
AmetysObject
representing a surveyModifier and Type | Field and Description |
---|---|
private static String |
__PROPERTY_DESC
Constants for description metadata.
|
private static String |
__PROPERTY_END_DATE
Constants for end date metadata.
|
private static String |
__PROPERTY_ENDING_MSG
Constants for description metadata.
|
private static String |
__PROPERTY_LABEL
Constants for header metadata.
|
private static String |
__PROPERTY_REDIRECTION
Constants for private metadata.
|
private static String |
__PROPERTY_START_DATE
Constants for start date metadata.
|
private static String |
__PROPERTY_TITLE
Constants for title metadata.
|
private static String |
__PROPERTY_VALIDATED
Constants for private metadata.
|
private static String |
__PROPERTY_VALIDATION_DATE
Constants for private metadata.
|
PROPERTY_PICTURE, PROPERTY_PICTURE_ALTERNATIVE, PROPERTY_PICTURE_ID, PROPERTY_PICTURE_TYPE
Constructor and Description |
---|
Survey(Node node,
String parentPath,
SurveyFactory factory)
Creates a
Survey . |
Modifier and Type | Method and Description |
---|---|
private boolean |
_hasQuestionName(String name) |
Survey |
copyTo(ModifiableTraversableAmetysObject parent,
String name)
Copy the current
AmetysObject to the given object. |
Survey |
copyTo(ModifiableTraversableAmetysObject parent,
String name,
List<String> restrictTo)
Copy the current
AmetysObject to the given object if it is not in the restriction list. |
String |
findUniqueQuestionName(String originalName)
Returns a unique question name in the survey
|
String |
getDescription()
Retrieves the description.
|
Date |
getEndDate()
Get the end date
|
String |
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.
|
Site |
getSite()
Returns this object's site.
|
String |
getSiteName()
Returns this object's site name.
|
Date |
getStartDate()
Get the start date
|
String |
getTitle()
Retrieves the title.
|
Date |
getValidationDate()
Get the date of validation
|
boolean |
isValidated()
Determines if the survey is validated.
|
void |
setDescription(String description)
Set the description.
|
void |
setEndDate(Date date)
Set the end date
|
void |
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 date
|
void |
setTitle(String title)
Set the title.
|
void |
setValidated(boolean validated)
Valid or invalid survey
|
void |
setValidationDate(Date date)
Set the date of validation
|
copyPictureTo, getExternalPicture, getPictureAlternative, getPictureType, getResourcePictureId, removePictureMetas, setExternalPicture, setNoPicture, setPictureAlternative, setPictureType, setResourcePicture
addAllowedGroups, addAllowedProfilesForAnonymous, addAllowedProfilesForAnyConnectedUser, addAllowedUsers, addDeniedGroups, addDeniedProfilesForAnonymous, addDeniedProfilesForAnyConnectedUser, addDeniedUsers, createChild, getAllowedGroups, getAllowedProfilesForAnonymous, getAllowedProfilesForAnyConnectedUser, getAllowedProfilesForGroups, getAllowedProfilesForUser, getAllowedProfilesForUsers, getAllowedUsers, getChild, getChildren, getDeniedGroups, getDeniedProfilesForAnonymous, getDeniedProfilesForAnyConnectedUser, getDeniedProfilesForGroups, getDeniedProfilesForUser, getDeniedProfilesForUsers, getDeniedUsers, hasChild, removeAllowedGroups, removeAllowedGroups, removeAllowedProfilesForAnonymous, removeAllowedProfilesForAnyConnectedUser, removeAllowedUsers, removeAllowedUsers, removeDeniedGroups, removeDeniedGroups, removeDeniedProfilesForAnonymous, removeDeniedProfilesForAnyConnectedUser, removeDeniedUsers, removeDeniedUsers
_getFactory, _invalidateName, _invalidateParentPath, getId, getMetadataHolder, getName, getNode, getParent, getParentPath, getPath, needsSave, remove, rename, revertChanges, saveChanges
equals, hashCode, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
equals, getId, getName, getParent, getParentPath, getPath, hashCode
getNode
getMetadataHolder
needsSave, rename, revertChanges, saveChanges
remove
getChildAt, getChildPosition
private static final String __PROPERTY_TITLE
private static final String __PROPERTY_LABEL
private static final String __PROPERTY_DESC
private static final String __PROPERTY_ENDING_MSG
private static final String __PROPERTY_VALIDATED
private static final String __PROPERTY_VALIDATION_DATE
private static final String __PROPERTY_START_DATE
private static final String __PROPERTY_END_DATE
private static final String __PROPERTY_REDIRECTION
public Survey(Node node, String parentPath, SurveyFactory factory)
Survey
.node
- the node backing this AmetysObject
.parentPath
- the parent path in the Ametys hierarchy.factory
- the SurveyFactory
which creates the AmetysObject.public String getTitle() throws AmetysRepositoryException
AmetysRepositoryException
- if an error occurs.public void setTitle(String title) throws AmetysRepositoryException
title
- the title.AmetysRepositoryException
- if an error occurs.public String getLabel() throws AmetysRepositoryException
AmetysRepositoryException
- if an error occurs.public void setLabel(String label) throws AmetysRepositoryException
label
- the survey label.AmetysRepositoryException
- if an error occurs.public String getDescription() throws AmetysRepositoryException
AmetysRepositoryException
- if an error occurs.public void setDescription(String description) throws AmetysRepositoryException
description
- the description.AmetysRepositoryException
- if an error occurs.public String getEndingMessage() throws AmetysRepositoryException
AmetysRepositoryException
- if an error occurs.public void setEndingMessage(String message) throws AmetysRepositoryException
message
- the ending message.AmetysRepositoryException
- if an error occurs.public boolean isValidated() throws AmetysRepositoryException
AmetysRepositoryException
- if an error occurs.public void setValidated(boolean validated) throws AmetysRepositoryException
validated
- true to validate the surveyAmetysRepositoryException
- if an error occurs.public void setValidationDate(Date date) throws AmetysRepositoryException
date
- The date of validationAmetysRepositoryException
- if an error occurs.public Date getValidationDate() throws AmetysRepositoryException
AmetysRepositoryException
- if an error occurs.public void setStartDate(Date date) throws AmetysRepositoryException
date
- The start dateAmetysRepositoryException
- if an error occurs.public Date getStartDate() throws AmetysRepositoryException
AmetysRepositoryException
- if an error occurs.public void setEndDate(Date date) throws AmetysRepositoryException
date
- The end dateAmetysRepositoryException
- if an error occurs.public Date getEndDate() throws AmetysRepositoryException
AmetysRepositoryException
- if an error occurs.public String getRedirection() throws AmetysRepositoryException
AmetysRepositoryException
- if an error occurs.public void setRedirection(String pageId) throws AmetysRepositoryException
pageId
- the page id. Can be null to delete redirectionAmetysRepositoryException
- if an error occurs.public List<SurveyPage> getPages() throws AmetysRepositoryException
AmetysRepositoryException
- if an error occurs when retrieving the pages of the surveypublic SurveyQuestion getQuestion(String name) throws AmetysRepositoryException
name
- the question name.AmetysRepositoryException
- if an error occurs when retrieving a question of a surveypublic AmetysObjectIterable<SurveyQuestion> getQuestions() throws AmetysRepositoryException
AmetysRepositoryException
- if an error occurs when retrieving all the questions of a surveypublic Site getSite() throws AmetysRepositoryException
SiteAwareAmetysObject
getSite
in interface SiteAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public String getSiteName() throws AmetysRepositoryException
SiteAwareAmetysObject
getSiteName
in interface SiteAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public String getLanguage()
public String findUniqueQuestionName(String originalName)
originalName
- The original nameprivate boolean _hasQuestionName(String name)
public Survey copyTo(ModifiableTraversableAmetysObject parent, String name) throws AmetysRepositoryException
CopiableAmetysObject
AmetysObject
to the given object. Be careful, this method save changes.copyTo
in interface CopiableAmetysObject
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 objectAmetysRepositoryException
- if an error occurs.public Survey copyTo(ModifiableTraversableAmetysObject parent, String name, List<String> restrictTo) throws AmetysRepositoryException
CopiableAmetysObject
AmetysObject
to the given object if it is not in the restriction list. Be careful, this method save changes.copyTo
in interface CopiableAmetysObject
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 of CopiableAmetysObject
authorized to be copiedAmetysRepositoryException
- if an error occurs.