Package org.ametys.plugins.forms.dao
Class FormPageDAO
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.forms.dao.FormPageDAO
- All Implemented Interfaces:
LogEnabled
,Component
,Serviceable
DAO for manipulating form pages
-
Field Summary
Modifier and TypeFieldDescriptionprotected CurrentUserProvider
The current user provider.protected FormDAO
The form DAOprotected FormQuestionDAO
The form question DAOprotected I18nUtils
I18n Utilsprotected ObservationManager
Observer manager.protected AmetysObjectResolver
The Ametys object resolverprotected RightManager
The right managerstatic final String
The Avalon role -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected UserIdentity
Provides the current user._getUserRights
(FormPage page) Get user rights for the given form pageAdds a a new rule to a page.Copies and pastes a form page.createPage
(String parentId, String name) Creates aFormPage
.deletePage
(String id) Deletes aFormPage
.deleteRule
(String id) Deletes a rule to a pagegetBranches
(String pageId) Gets the branches for a form page.getChildPages
(String formId) Gets all pages for given parentgetIdsOfPath
(String id) Gets the ids of the path elements of a form component, i.e.getPageProperties
(String pageId) Get the page's propertiesgetPageProperties
(FormPage page, boolean withRights) Get the page's propertiesprotected Form
Get the form containing the given object.Gets the rule for a form page.boolean
isLastPage
(String id) Determines if a page is the last of form's pages.moveObject
(String id, String oldParent, String newParent, long index) Moves an element of the form.renamePage
(String id, String newName) Rename aFormPage
void
service
(ServiceManager manager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
The Avalon role -
_observationManager
Observer manager. -
_resolver
The Ametys object resolver -
_currentUserProvider
The current user provider. -
_formQuestionDAO
The form question DAO -
_i18nUtils
I18n Utils -
_formDAO
The form DAO -
_rightManager
The right manager
-
-
Constructor Details
-
FormPageDAO
public FormPageDAO()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
createPage
Creates aFormPage
. -
renamePage
Rename aFormPage
- Parameters:
id
- The id of the pagenewName
- The new name of the page- Returns:
- A result map
-
deletePage
Deletes aFormPage
.- Parameters:
id
- The id of the page to delete- Returns:
- The id of the page
-
copyPage
Copies and pastes a form page.- Parameters:
formId
- The id of the form, target of the copypageId
- The id of the page to copy- Returns:
- The id of the created page
-
moveObject
public Map<String,String> moveObject(String id, String oldParent, String newParent, long index) throws Exception Moves an element of the form.- Parameters:
id
- The id of the element to move.oldParent
- The id of the element's parent.newParent
- The id of the new element's parent.index
- The index where to move. null to place the element at the end.- Returns:
- A map with the ids of the element, the old parent and the new parent
- Throws:
Exception
- if an error occurs when moving an element of the form
-
getPageProperties
Get the page's properties- Parameters:
pageId
- The form page's id- Returns:
- The page properties
-
getPageProperties
Get the page's properties- Parameters:
page
- The form pagewithRights
-true
to have the rights in the properties- Returns:
- The page properties
-
_getUserRights
Get user rights for the given form page- Parameters:
page
- the form page- Returns:
- the set of rights
-
getIdsOfPath
Gets the ids of the path elements of a form component, i.e. the parent ids.
For instance, if the page path is 'a/b/c', then the result list will be ["id-of-a", "id-of-b", "id-of-c"]- Parameters:
id
- The id of the form component- Returns:
- the ids of the path elements of a form
-
getChildPages
Gets all pages for given parent- Parameters:
formId
- The id of theForm
, defining the context from which getting children- Returns:
- all forms for given parent
-
getParentForm
Get the form containing the given object.- Parameters:
obj
- the object.- Returns:
- the parent Form.
-
isLastPage
Determines if a page is the last of form's pages.- Parameters:
id
- The page id- Returns:
- True if the page is the last one.
-
getBranches
Gets the branches for a form page.- Parameters:
pageId
- The id of the form page.- Returns:
- The branches
-
getRule
Gets the rule for a form page.- Parameters:
id
- The id of the form page.- Returns:
- The rule, or null
-
addRule
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
Deletes a rule to a page- Parameters:
id
- The id of the page- Returns:
- An empty map
-
_getCurrentUser
Provides the current user.- Returns:
- the user which cannot be
null
.
-