Package org.ametys.plugins.forms.dao
Class FormDAO
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.forms.dao.FormDAO
- All Implemented Interfaces:
LogEnabled
,Component
,Serviceable
The form DAO
-
Field Summary
Modifier and TypeFieldDescriptionprotected CopyFormUpdaterExtensionPoint
The copy form updater extension pointprotected CurrentUserProvider
The current user provider.protected FormDirectoryDAO
The form directory DAOprotected FormEntryDAO
The form entry DAOprotected FormPageDAO
The form page DAOprotected I18nUtils
I18n Utilsprotected ObservationManager
Observer manager.protected javax.jcr.Repository
The JCR repository.protected AmetysObjectResolver
The Ametys object resolverprotected RightManager
The right managerprotected ScheduleOpeningHelper
The schedule opening helperprotected ServiceExtensionPoint
The service extension pointprotected SiteManager
The site managerprotected UserHelper
The user helperprotected CurrentUserProvider
The current user providerprotected WorkflowHelper
The workflow helperprotected ZoneDAO
The zone DAOstatic final String
The right id to handle formsstatic final String
The Avalon role -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected ZonedDateTime
_getLastSubmissionDate
(List<FormEntry> entries) Get the submission date of the last entry to the form_getPagesInfos
(List<SitemapElement> pages) Get the page names_getUserRights
(Form form) Get user rights for the given formvoid
checkHandleFormRight
(AmetysObject formElement) Check rights for a form element as ametys objectCopies and pastes a form.createForm
(String siteName, String parentId, String name) Creates aForm
.deleteForm
(String id) Deletes aForm
.getAdminDashboardUri
(String siteName) Get the admin dashboard URIgetDashboardUri
(String siteName) Get the dashboard URIgetFormDisplayViews
(String formId, String siteName, String language) Get all the view available for the form display servicegetFormFullPath
(String formId) Get the form full pathgetFormLocale
(Form form) Get the locale to use for a given formgetFormPage
(String formId, String siteName) Get all the page where the form is publishedgetFormProperties
(String formId, boolean full, boolean withRights) Get the form propertiesgetFormProperties
(Form form, boolean full, boolean withRights) Get the form propertiesGet all forms from a sitegetFormTitle
(String formId) Get the form titlegetFormZoneItems
(String formId, String siteName) Get all zone items which contains the formboolean
hasReadRightOnForm
(UserIdentity userIdentity, Form form) Check if a user have read rights on a formboolean
hasRightAffectationRightOnForm
(UserIdentity userIdentity, Form form) Check if a user have write rights on a formboolean
hasWriteRightOnForm
(UserIdentity userIdentity, AmetysObject formElement) Check if a user have write rights on a form elementboolean
isFormConfigured
(Form form) true
if the form is well configuredMoves aForm
renameForm
(String id, String newName) Rename aForm
void
service
(ServiceManager manager) setWorkflow
(String formId, String workflowName) Change workflow of aForm
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
The Avalon role -
HANDLE_FORMS_RIGHT_ID
The right id to handle forms- See Also:
-
_resolver
The Ametys object resolver -
_userProvider
The current user provider -
_i18nUtils
I18n Utils -
_formDirectoryDAO
The form directory DAO -
_formPageDAO
The form page DAO -
_formEntryDAO
The form entry DAO -
_userHelper
The user helper -
_repository
The JCR repository. -
_rightManager
The right manager -
_serviceEP
The service extension point -
_zoneDAO
The zone DAO -
_scheduleOpeningHelper
The schedule opening helper -
_workflowHelper
The workflow helper -
_siteManager
The site manager -
_observationManager
Observer manager. -
_currentUserProvider
The current user provider. -
_copyFormEP
The copy form updater extension point
-
-
Constructor Details
-
FormDAO
public FormDAO()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
hasReadRightOnForm
Check if a user have read rights on a form- Parameters:
userIdentity
- the userform
- the form- Returns:
- true if the user have read rights on a form
-
hasWriteRightOnForm
Check if a user have write rights on a form element- Parameters:
userIdentity
- the userformElement
- the form element- Returns:
- true if the user have write rights on a form element
-
hasRightAffectationRightOnForm
Check if a user have write rights on a form- Parameters:
userIdentity
- the userform
- the form- Returns:
- true if the user have write rights on a form
-
checkHandleFormRight
Check rights for a form element as ametys object- Parameters:
formElement
- the form element as ametys object
-
getForms
Get all forms from a site- Parameters:
siteName
- the site name- Returns:
- the list of form
-
getFormProperties
Get the form properties- Parameters:
formId
- The form's idfull
-true
to get full information on formwithRights
-true
to have rights in the properties- Returns:
- The form properties
-
getFormProperties
Get the form properties- Parameters:
form
- The formfull
-true
to get full information on formwithRights
-true
to have rights in the properties- Returns:
- The form properties
-
getFormTitle
Get the form title- Parameters:
formId
- the form id- Returns:
- the form title
-
getFormFullPath
Get the form full path- Parameters:
formId
- the form id- Returns:
- the form full path
-
_getUserRights
Get user rights for the given form- Parameters:
form
- the form- Returns:
- the set of rights
-
createForm
public Map<String,String> createForm(String siteName, String parentId, String name) throws Exception Creates aForm
. -
renameForm
Rename aForm
- Parameters:
id
- The id of the formnewName
- The new name for the form- Returns:
- A result map
-
copyForm
Copies and pastes a form.- Parameters:
formDirectoryId
- The id of the form directory target of the copyformId
- The id of the form to copy- Returns:
- The results
-
deleteForm
Deletes aForm
.- Parameters:
id
- The id of the form to delete- Returns:
- The id of the form
-
moveForm
Moves aForm
- Parameters:
siteName
- name of the siteid
- The id of the formnewParentId
- The id of the new parent directory of the form.- Returns:
- A result map
-
setWorkflow
Change workflow of aForm
- Parameters:
formId
- The id of the formworkflowName
- The name of new workflow- Returns:
- A result map
-
_getLastSubmissionDate
Get the submission date of the last entry to the form- Parameters:
entries
- A list of form entry ordered by submission date- Returns:
- the date of the last submission
-
getFormZoneItems
Get all zone items which contains the form- Parameters:
formId
- the form idsiteName
- the site name- Returns:
- the zone items
-
getFormLocale
Get the locale to use for a given form- Parameters:
form
- the form- Returns:
- the locale to use, can be null if the form is not published on a page
-
getFormPage
Get all the page where the form is published- Parameters:
formId
- the form idsiteName
- the site name- Returns:
- the list of page
-
_getPagesInfos
Get the page names- Parameters:
pages
- the list of page- Returns:
- the list of page name
-
getFormDisplayViews
public List<Map<String,Object>> getFormDisplayViews(String formId, String siteName, String language) throws Exception Get all the view available for the form display service- Parameters:
formId
- the form identifiersiteName
- the site namelanguage
- the language- Returns:
- the views as json
- Throws:
Exception
- if an error occurred
-
isFormConfigured
true
if the form is well configured- Parameters:
form
- the form- Returns:
true
if the form is well configured
-
getDashboardUri
Get the dashboard URI- Parameters:
siteName
- the site name- Returns:
- the dashboard URI
-
getAdminDashboardUri
Get the admin dashboard URI- Parameters:
siteName
- the site name- Returns:
- the admin dashboard URI
-