Package org.ametys.plugins.survey.dao
Class PageDAO
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.survey.dao.AbstractDAO
-
- org.ametys.plugins.survey.dao.PageDAO
-
- All Implemented Interfaces:
LogEnabled,Component,Contextualizable,Serviceable
public class PageDAO extends AbstractDAO
DAO for manipulating survey pages.
-
-
Field Summary
Fields Modifier and Type Field Description private QuestionDAO_questionDAOThe Question DAOprivate Repository_repositoryThe repositorystatic StringROLEThe Avalon role-
Fields inherited from class org.ametys.plugins.survey.dao.AbstractDAO
_cocoonContext, _context, _currentUserProvider, _jsonUtils, _observationManager, _resolver, _siteManager, _uploadManager
-
-
Constructor Summary
Constructors Constructor Description PageDAO()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void_removeReferencesFromPages(String pageId)private void_removeReferencesFromQuestions(String pageId)private void_setValues(SurveyPage page, Map<String,Object> values)Map<String,Object>addRule(String id, String rule, String page)Adds a a new rule to a page.Map<String,String>copyPage(String surveyId, String pageId)Copies and pastes a survey page.Map<String,String>createPage(Map<String,Object> values)Creates a survey page.Map<String,String>deletePage(String id)Deletes a survey page.Map<String,Object>deleteRule(String id)Deletes a rule to a pageMap<String,String>editPage(Map<String,Object> values)Edits a survey page.Map<String,Object>getBranches(String id)Gets the branches for a survey page.Map<String,Object>getPage(String id)Gets properties of a survey pageMap<String,Object>getPage(SurveyPage page)Gets properties of a survey pageMap<String,Object>getRule(String id)Gets the rule for a survey page.booleanisLastPage(String id)Determines if a page is the last of survey's pages.voidservice(ServiceManager serviceManager)-
Methods inherited from class org.ametys.plugins.survey.dao.AbstractDAO
_getCurrentUser, contextualize, getPictureInfo, getSurveyRootNode, setPicture, updateReferencesAfterCopy, updateReferencesAfterCopy, updateReferencesAfterCopy
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
_repository
private Repository _repository
The repository
-
_questionDAO
private QuestionDAO _questionDAO
The Question DAO
-
-
Constructor Detail
-
PageDAO
public PageDAO()
-
-
Method Detail
-
service
public void service(ServiceManager serviceManager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classAbstractDAO- Throws:
ServiceException
-
getPage
public Map<String,Object> getPage(String id)
Gets properties of a survey page- Parameters:
id- The id of the survey page- Returns:
- The properties
-
getPage
public Map<String,Object> getPage(SurveyPage page)
Gets properties of a survey page- Parameters:
page- The survey page- Returns:
- The properties
-
isLastPage
public boolean isLastPage(String id)
Determines if a page is the last of survey's pages.- Parameters:
id- The page id- Returns:
- True if the page is the last one.
-
createPage
public Map<String,String> createPage(Map<String,Object> values) throws Exception
Creates a survey page.- Parameters:
values- The survey page's values- Returns:
- The id of the created survey page
- Throws:
Exception- if an exception occurs during the page creation process
-
editPage
public Map<String,String> editPage(Map<String,Object> values)
Edits a survey page.- Parameters:
values- The survey page's values- Returns:
- The id of the edited survey page and the id of its survey parent
-
_setValues
private void _setValues(SurveyPage page, Map<String,Object> values)
-
copyPage
public Map<String,String> copyPage(String surveyId, String pageId)
Copies and pastes a survey page.- Parameters:
surveyId- The id of the survey, target of the copypageId- The id of the page to copy- Returns:
- The id of the created page
-
deletePage
public Map<String,String> deletePage(String id)
Deletes a survey page.- Parameters:
id- The id of the survey page to delete- Returns:
- The id of the deleted survey page and the id of its survey parent
-
addRule
public Map<String,Object> addRule(String id, String rule, String page)
Adds a a new rule to a page.- Parameters:
id- The id of the pagerule- The rule typepage- The page to jump or skip- Returns:
- An empty map
-
deleteRule
public Map<String,Object> deleteRule(String id)
Deletes a rule to a page- Parameters:
id- The id of the page- Returns:
- An empty map
-
getRule
public Map<String,Object> getRule(String id)
Gets the rule for a survey page.- Parameters:
id- The id of the survey page.- Returns:
- The rule, or null
-
getBranches
public Map<String,Object> getBranches(String id)
Gets the branches for a survey page.- Parameters:
id- The id of the survey page.- Returns:
- The branches
-
_removeReferencesFromPages
private void _removeReferencesFromPages(String pageId)
-
_removeReferencesFromQuestions
private void _removeReferencesFromQuestions(String pageId)
-
-