Interface FormsOnlineDAO
-
- All Known Implementing Classes:
FormsOnlineDAOJdbc
public interface FormsOnlineDAO
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description FormDetail
createForm(FormDetail formDetail)
Save new form in databaseFormDetail
deleteForm(FormPK pk)
Delete Form from databasevoid
deleteRequest(RequestPK pk)
List<FormDetail>
findAllForms(String instanceId)
Get all forms that has been created in given instanceorg.silverpeas.core.util.SilverpeasList<FormInstance>
getAllRequests(FormPK pk)
FormDetail
getForm(FormPK pk)
Load forms from database with given instance Id and form idList<FormDetail>
getForms(Collection<String> formIds)
Map<Integer,Integer>
getNumberOfRequestsByForm(String instanceId)
Map<String,Set<FormInstanceValidationType>>
getPossibleValidationTypesByFormId(Collection<String> formIds)
Gets the possibleFormInstanceValidationType
instances mapped by form identifiers.org.silverpeas.core.util.SilverpeasList<FormInstance>
getReceivedRequests(FormDetail form, List<Integer> states, RequestValidationCriteria validatorCriteria, org.silverpeas.core.admin.PaginationPage paginationPage)
Get all requests associated to given form ordered from the newest to the older.List<String>
getReceiversAsGroups(FormPK pk, String rightType)
Get the form's receivers list where groups has been declared directly.List<String>
getReceiversAsUsers(FormPK pk, String rightType)
Get the form's receivers list where users has been declared directly.FormInstance
getRequest(RequestPK pk)
List<String>
getSendersAsGroups(FormPK pk)
Get the form's senders list where groups has been declared directly.List<String>
getSendersAsUsers(FormPK pk)
Get the form's senders list where users has been declared directly.org.silverpeas.core.util.SilverpeasList<FormInstance>
getSentFormInstances(FormPK pk, String userId, List<Integer> states, org.silverpeas.core.admin.PaginationPage paginationPage)
Get all form instances that have been sent by given user (excepted the ones that have been archived.List<FormDetail>
getUserAvailableForms(Collection<String> componentIds, String userId, String[] userGroupIds)
Get the form available to be sent for given user or given groupsMap<String,Set<FormInstanceValidationType>>
getValidatorFormIdsWithValidationTypes(String instanceId, String validatorId, String[] validatorGroupIds, Collection<String> formIds)
Gets theFormInstanceValidationType
instances mapped by form identifiers of the the validator represented by given validator id and validator group ids on the given component instance.FormInstance
saveRequest(FormInstance request)
Inserts or updates the given request (also called a form instance).void
saveRequestState(FormInstance request)
Saves the state of the given request without updating anything else.void
updateForm(FormDetail formDetail)
Update form in databasevoid
updateReceivers(FormPK pk, Map<String,org.silverpeas.core.util.Pair<List<String>,List<String>>> userAndGroupIdsByRightTypes)
Updates the form rights from given parameters.void
updateSenders(FormPK pk, Map<String,org.silverpeas.core.util.Pair<List<String>,List<String>>> userAndGroupIdsByRightTypes)
Update form senders list.
-
-
-
Method Detail
-
findAllForms
List<FormDetail> findAllForms(String instanceId) throws FormsOnlineException
Get all forms that has been created in given instance- Parameters:
instanceId
- the instance id- Returns:
- a List of FormDetail object
- Throws:
FormsOnlineException
-
getForm
FormDetail getForm(FormPK pk) throws FormsOnlineException
Load forms from database with given instance Id and form id- Parameters:
pk
- the form primary key- Returns:
- a FormDetail object
- Throws:
FormsOnlineException
-
createForm
FormDetail createForm(FormDetail formDetail) throws FormsOnlineException
Save new form in database- Parameters:
formDetail
- the form detail- Returns:
- the created FormDetail
- Throws:
FormsOnlineException
-
updateForm
void updateForm(FormDetail formDetail) throws FormsOnlineException
Update form in database- Parameters:
formDetail
- the form detail- Throws:
FormsOnlineException
-
deleteForm
FormDetail deleteForm(FormPK pk) throws FormsOnlineException
Delete Form from database- Parameters:
pk
- the pk of form to be deleted- Returns:
- the deleted FormDetail
- Throws:
FormsOnlineException
-
updateSenders
void updateSenders(FormPK pk, Map<String,org.silverpeas.core.util.Pair<List<String>,List<String>>> userAndGroupIdsByRightTypes) throws FormsOnlineException
Update form senders list.- Parameters:
pk
- the form primary keyuserAndGroupIdsByRightTypes
- the new sender list as user ids- Throws:
FormsOnlineException
-
updateReceivers
void updateReceivers(FormPK pk, Map<String,org.silverpeas.core.util.Pair<List<String>,List<String>>> userAndGroupIdsByRightTypes) throws FormsOnlineException
Updates the form rights from given parameters.- Parameters:
pk
- the unique identifier of a form.userAndGroupIdsByRightTypes
- the user and group rights to update indexed by right types. Users and groups are represented by aPair
containing on left the user identifiers and on right the group identifiers.- Throws:
FormsOnlineException
- on technical error.
-
getSendersAsUsers
List<String> getSendersAsUsers(FormPK pk) throws FormsOnlineException
Get the form's senders list where users has been declared directly.- Parameters:
pk
- the form primary key- Returns:
- user ids as a list of String
- Throws:
FormsOnlineException
-
getSendersAsGroups
List<String> getSendersAsGroups(FormPK pk) throws FormsOnlineException
Get the form's senders list where groups has been declared directly.- Parameters:
pk
- the form primary key- Returns:
- group ids as a list of String
- Throws:
FormsOnlineException
-
getReceiversAsUsers
List<String> getReceiversAsUsers(FormPK pk, String rightType) throws FormsOnlineException
Get the form's receivers list where users has been declared directly.- Parameters:
pk
- the form primary key- Returns:
- user ids as a list of String
- Throws:
FormsOnlineException
-
getReceiversAsGroups
List<String> getReceiversAsGroups(FormPK pk, String rightType) throws FormsOnlineException
Get the form's receivers list where groups has been declared directly.- Parameters:
pk
- the form primary key- Returns:
- group ids as a list of String
- Throws:
FormsOnlineException
-
getUserAvailableForms
List<FormDetail> getUserAvailableForms(Collection<String> componentIds, String userId, String[] userGroupIds) throws FormsOnlineException
Get the form available to be sent for given user or given groups- Parameters:
componentIds
- the component instance iduserId
- the user iduserGroupIds
- the user's groups id list- Returns:
- a list of FormDetail objects
- Throws:
FormsOnlineException
-
getSentFormInstances
org.silverpeas.core.util.SilverpeasList<FormInstance> getSentFormInstances(FormPK pk, String userId, List<Integer> states, org.silverpeas.core.admin.PaginationPage paginationPage) throws FormsOnlineException
Get all form instances that have been sent by given user (excepted the ones that have been archived.- Parameters:
pk
- the form primary keyuserId
- the user idstates
- the states to filter on if anypaginationPage
- pagination which can be null if no pagination is requested.- Returns:
- a list of FormInstance objects
- Throws:
FormsOnlineException
-
getReceivedRequests
org.silverpeas.core.util.SilverpeasList<FormInstance> getReceivedRequests(FormDetail form, List<Integer> states, RequestValidationCriteria validatorCriteria, org.silverpeas.core.admin.PaginationPage paginationPage) throws FormsOnlineException
Get all requests associated to given form ordered from the newest to the older.- Parameters:
form
- the form primary keystates
- the states to filter on if anyvalidatorCriteria
- the validation criteriapaginationPage
- pagination which can be null if no pagination is requested.- Returns:
- if allRequests is false only requests to validate and requests validated by given user are returned. If true, all requests (validated or not) are returned.
- Throws:
FormsOnlineException
-
getValidatorFormIdsWithValidationTypes
Map<String,Set<FormInstanceValidationType>> getValidatorFormIdsWithValidationTypes(String instanceId, String validatorId, String[] validatorGroupIds, Collection<String> formIds) throws FormsOnlineException
Gets theFormInstanceValidationType
instances mapped by form identifiers of the the validator represented by given validator id and validator group ids on the given component instance.- Parameters:
instanceId
- the identifier of the component instance.validatorId
- the identifier of the validator.validatorGroupIds
- identifiers of the group of the validator.formIds
- optional filter about form identifiers in order to reduce the search load.- Returns:
FormInstanceValidationType
instances mapped by form identifiers.- Throws:
FormsOnlineException
-
getPossibleValidationTypesByFormId
Map<String,Set<FormInstanceValidationType>> getPossibleValidationTypesByFormId(Collection<String> formIds) throws FormsOnlineException
Gets the possibleFormInstanceValidationType
instances mapped by form identifiers.- Parameters:
formIds
- form identifiers to search for.- Returns:
FormInstanceValidationType
instances mapped by form identifiers.- Throws:
FormsOnlineException
-
getRequest
FormInstance getRequest(RequestPK pk) throws FormsOnlineException
- Throws:
FormsOnlineException
-
getForms
List<FormDetail> getForms(Collection<String> formIds) throws FormsOnlineException
- Throws:
FormsOnlineException
-
saveRequest
FormInstance saveRequest(FormInstance request) throws FormsOnlineException
Inserts or updates the given request (also called a form instance).All validation data contained into
FormInstance.getValidations()
are also inserted or updated.- Parameters:
request
- the request to insert or update.- Returns:
- the
FormInstance
itself. - Throws:
FormsOnlineException
- on database integrity error.
-
saveRequestState
void saveRequestState(FormInstance request) throws FormsOnlineException
Saves the state of the given request without updating anything else.- Parameters:
request
- the request which the state MUST be updated.- Throws:
FormsOnlineException
- if the form instance id does not exist.
-
deleteRequest
void deleteRequest(RequestPK pk) throws FormsOnlineException
- Throws:
FormsOnlineException
-
getNumberOfRequestsByForm
Map<Integer,Integer> getNumberOfRequestsByForm(String instanceId) throws FormsOnlineException
- Throws:
FormsOnlineException
-
getAllRequests
org.silverpeas.core.util.SilverpeasList<FormInstance> getAllRequests(FormPK pk) throws FormsOnlineException
- Throws:
FormsOnlineException
-
-