Package org.ametys.plugins.forms.dao
Class FormEntryDAO
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.forms.dao.FormEntryDAO
- All Implemented Interfaces:
LogEnabled,Component,Serviceable
Form entry DAO.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordRecord representing a sort with form attribute name and direction -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CurrentUserProviderThe current user provider.protected FormElementDefinitionHelperThe form element definition helperprotected FormEntriesSearchHelperThe form entries search helperprotected FormEntryDAOThe form entry DAOprotected FormEntrySystemPropertyExtensionPointThe system property extension pointprotected FormWorkflowHelperThe form workflow helperprotected LimitedEntriesHelperThe handling limited entries helperprotected ObservationManagerObserver manager.protected ParametersManagerThe parameters managerprotected AmetysObjectResolverAmetys object resolver.protected RightManagerThe rights managerprotected SearcherFactoryThe searcher factoryprotected UserManagerThe user managerprotected WorkflowProviderThe current user providerstatic final StringThe right id to delete form entriesstatic final StringName for entries root jcr nodestatic final StringThe right id to consult form entriesstatic final StringThe Avalon role name. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription_getColumns(Form form) Get the columns for search form entries_getCriteria(Form form) Get criteria to search form entries_getUserRights(FormEntry entry) Get user rights for the given form entryprotected void_handleComputedValues(List<FormQuestion> questions, FormEntry entry, boolean forEdition) Handle computed valuesvoidcheckHandleDataRight(AmetysObject formElement) Check handle data right for a form element as ametys objectclearEntries(String id) Delete all entries of a formcreateEntry(Form form, String clientIP) Creates aFormEntry.deleteEntry(String id) Deletes aFormEntry.voidEdit a form entrygetAllFormEntries(Site site) Get all form entriesgetCurrentStepId(FormEntry entry) Retrieves the current step id of the form entrygetFormEntries(Form form, boolean onlyActiveEntries, List<FormEntryDAO.Sort> sorts) Get the form entriesgetFormEntries(Form form, boolean onlyActiveEntries, Expression additionalEntryFilterExpr, List<FormEntryDAO.Sort> sorts) Get the form entriesgetFormEntriesUsers(String formId) Get all users who answer to the form as JSONgetFormEntryModel(Form form) Get the form entry modelGets properties of a form entrygetFormEntryProperties(FormEntry entry) Gets properties of a form entrygetSearchModelConfiguration(String formId) Get the search model configuration to search form entriesbooleanhasHandleDataRightOnForm(UserIdentity userIdentity, AmetysObject formElement) Check if a user have handle data right on a form element as ametys objectsearchFormEntries(String siteName, Form form, boolean onlyActiveEntries, boolean actionableOnly, boolean checkRights, Query additionalEntryFilterQuery, List<SearcherFactory.FacetDefinition> facets, List<SearcherFactory.SortDefinition> sorts, int offset, int length) Search the form entriesvoidservice(ServiceManager serviceManager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
The Avalon role name. -
ENTRIES_ROOT
Name for entries root jcr node- See Also:
-
HANDLE_FORMS_ENTRIES_RIGHT_ID
The right id to consult form entries- See Also:
-
DELETE_FORMS_ENTRIES_RIGHT_ID
The right id to delete form entries- See Also:
-
_resolver
Ametys object resolver. -
_parametersManager
The parameters manager -
_observationManager
Observer manager. -
_currentUserProvider
The current user provider. -
_handleLimitedEntriesHelper
The handling limited entries helper -
_rightManager
The rights manager -
_workflowProvider
The current user provider -
_userManager
The user manager -
_formSystemPropertyEP
The system property extension point -
_formElementDefinitionHelper
The form element definition helper -
_formEntryDAO
The form entry DAO -
_searcherFactory
The searcher factory -
_formWorkflowHelper
The form workflow helper -
_formEntriesSearchHelper
The form entries search helper
-
-
Constructor Details
-
FormEntryDAO
public FormEntryDAO()
-
-
Method Details
-
service
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
hasHandleDataRightOnForm
Check if a user have handle data right on a form element as ametys object- Parameters:
userIdentity- the userformElement- the form element- Returns:
- true if the user handle data right for a form element
-
checkHandleDataRight
Check handle data right for a form element as ametys object- Parameters:
formElement- the form element as ametys object
-
getFormEntryProperties
Gets properties of a form entry- Parameters:
id- The id of the form entry- Returns:
- The properties
-
getFormEntryProperties
Gets properties of a form entry- Parameters:
entry- The form entry- Returns:
- The properties
-
_getUserRights
Get user rights for the given form entry- Parameters:
entry- the form entry- Returns:
- the set of rights
-
createEntry
Creates aFormEntry.- Parameters:
form- The parent formclientIP- The client IP address- Returns:
- return the form entry
-
editFormEntry
public void editFormEntry(FormEntry entry, Map<String, Object> values, View editView, boolean isJustCreated) throws ExceptionEdit a form entry- Parameters:
entry- the form entryvalues- the values to seteditView- the edit viewisJustCreated-trueif the entry is just created before edition- Throws:
Exception- if an error occurs
-
_handleComputedValues
protected void _handleComputedValues(List<FormQuestion> questions, FormEntry entry, boolean forEdition) Handle computed values- Parameters:
questions- the form questionsentry- the entryforEdition-trueto handle edition
-
getSearchModelConfiguration
Get the search model configuration to search form entries- Parameters:
formId- the identifier of form- Returns:
- The search model configuration
- Throws:
ProcessingException- If an error occurred
-
_getCriteria
Get criteria to search form entries- Parameters:
form- the form- Returns:
- the criteria as JSON
-
_getColumns
Get the columns for search form entries- Parameters:
form- the form- Returns:
- the columns as JSON
- Throws:
ProcessingException- if an error occurred
-
deleteEntry
Deletes aFormEntry.- Parameters:
id- The id of the form entry to delete- Returns:
- The entry data
-
clearEntries
Delete all entries of a form- Parameters:
id- The id of the form- Returns:
- the deleted entries data
-
getCurrentStepId
Retrieves the current step id of the form entry- Parameters:
entry- The form entry- Returns:
- the current step id
- Throws:
AmetysRepositoryException- if an error occurs.
-
getFormEntryModel
Get the form entry model- Parameters:
form- the form- Returns:
- the form entry model
-
getAllFormEntries
Get all form entries- Parameters:
site- the site. Can be null to get all form entries of all sites- Returns:
- the list of all form entries
-
getFormEntries
public List<FormEntry> getFormEntries(Form form, boolean onlyActiveEntries, List<FormEntryDAO.Sort> sorts) Get the form entries- Parameters:
form- the formonlyActiveEntries-trueto have only active entriessorts- the list of sort- Returns:
- the form entries
-
getFormEntries
public List<FormEntry> getFormEntries(Form form, boolean onlyActiveEntries, Expression additionalEntryFilterExpr, List<FormEntryDAO.Sort> sorts) Get the form entries- Parameters:
form- the formonlyActiveEntries-trueto have only active entriesadditionalEntryFilterExpr- the additional entry filter expression. Can be null.sorts- the list of sort- Returns:
- the form entries
-
searchFormEntries
public SearchResults<FormEntry> searchFormEntries(String siteName, Form form, boolean onlyActiveEntries, boolean actionableOnly, boolean checkRights, Query additionalEntryFilterQuery, List<SearcherFactory.FacetDefinition> facets, List<SearcherFactory.SortDefinition> sorts, int offset, int length) throws Exception Search the form entries- Parameters:
siteName- the site nameform- the formonlyActiveEntries-trueto have only active entries. Active entries are used in waiting list.actionableOnly-trueto return only entry with at least one available action for the current usercheckRights-trueto check rights for returned entriesadditionalEntryFilterQuery- the additional entry filter query. Can be null.facets- the list of facetsorts- the list of sortoffset- the offset of the first result to returnlength- the maximum number of results to return- Returns:
- the form entries
- Throws:
Exception- if an error occurred during search
-
getFormEntriesUsers
Get all users who answer to the form as JSON- Parameters:
formId- the form id- Returns:
- all users as JSON
-