Class FormsOnlineDAOJdbc
- java.lang.Object
-
- org.silverpeas.components.formsonline.model.FormsOnlineDAOJdbc
-
- All Implemented Interfaces:
FormsOnlineDAO
public class FormsOnlineDAOJdbc extends Object implements FormsOnlineDAO
-
-
Constructor Summary
Constructors Constructor Description FormsOnlineDAOJdbc()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FormDetailcreateForm(FormDetail formDetail)Save new form in databaseFormDetaildeleteForm(FormPK pk)Delete Form from databasevoiddeleteRequest(RequestPK pk)List<FormDetail>findAllForms(String instanceId, String orderBy)Get all forms that has been created in given instanceorg.silverpeas.core.util.SilverpeasList<FormInstance>getAllRequests(FormPK pk)protected ConnectiongetConnection()Get a new connection.FormDetailgetForm(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 possibleFormInstanceValidationTypeinstances mapped by form identifiers.org.silverpeas.core.util.SilverpeasList<FormInstance>getReceivedRequests(FormDetail form, List<Integer> states, RequestValidationCriteria validationCriteria, 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.FormInstancegetRequest(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> instanceIds, String userId, String[] userGroupIds, String orderBy)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 theFormInstanceValidationTypeinstances mapped by form identifiers of the the validator represented by given validator id and validator group ids on the given component instance.FormInstancesaveRequest(FormInstance request)Inserts or updates the given request (also called a form instance).voidsaveRequestState(FormInstance request)Saves the state of the given request without updating anything else.voidupdateForm(FormDetail formDetail)Update form in databasevoidupdateReceivers(FormPK pk, Map<String,org.silverpeas.core.util.Pair<List<String>,List<String>>> userAndGroupIdsByRightTypes)Updates the form rights from given parameters.voidupdateSenders(FormPK pk, Map<String,org.silverpeas.core.util.Pair<List<String>,List<String>>> userAndGroupIdsByRightTypes)Update form senders list.
-
-
-
Method Detail
-
createForm
public FormDetail createForm(FormDetail formDetail) throws FormsOnlineException
Description copied from interface:FormsOnlineDAOSave new form in database- Specified by:
createFormin interfaceFormsOnlineDAO- Parameters:
formDetail- the form detail- Returns:
- the created FormDetail
- Throws:
FormsOnlineException
-
deleteForm
public FormDetail deleteForm(FormPK pk) throws FormsOnlineException
Description copied from interface:FormsOnlineDAODelete Form from database- Specified by:
deleteFormin interfaceFormsOnlineDAO- Parameters:
pk- the pk of form to be deleted- Returns:
- the deleted FormDetail
- Throws:
FormsOnlineException
-
getForm
public FormDetail getForm(FormPK pk) throws FormsOnlineException
Description copied from interface:FormsOnlineDAOLoad forms from database with given instance Id and form id- Specified by:
getFormin interfaceFormsOnlineDAO- Parameters:
pk- the form primary key- Returns:
- a FormDetail object
- Throws:
FormsOnlineException
-
findAllForms
public List<FormDetail> findAllForms(String instanceId, String orderBy) throws FormsOnlineException
Description copied from interface:FormsOnlineDAOGet all forms that has been created in given instance- Specified by:
findAllFormsin interfaceFormsOnlineDAO- Parameters:
instanceId- the instance idorderBy- sort order method- Returns:
- a List of FormDetail object
- Throws:
FormsOnlineException
-
updateForm
public void updateForm(FormDetail formDetail) throws FormsOnlineException
Description copied from interface:FormsOnlineDAOUpdate form in database- Specified by:
updateFormin interfaceFormsOnlineDAO- Parameters:
formDetail- the form detail- Throws:
FormsOnlineException
-
getReceiversAsGroups
public List<String> getReceiversAsGroups(FormPK pk, String rightType) throws FormsOnlineException
Description copied from interface:FormsOnlineDAOGet the form's receivers list where groups has been declared directly.- Specified by:
getReceiversAsGroupsin interfaceFormsOnlineDAO- Parameters:
pk- the form primary key- Returns:
- group ids as a list of String
- Throws:
FormsOnlineException
-
getReceiversAsUsers
public List<String> getReceiversAsUsers(FormPK pk, String rightType) throws FormsOnlineException
Description copied from interface:FormsOnlineDAOGet the form's receivers list where users has been declared directly.- Specified by:
getReceiversAsUsersin interfaceFormsOnlineDAO- Parameters:
pk- the form primary key- Returns:
- user ids as a list of String
- Throws:
FormsOnlineException
-
getSendersAsGroups
public List<String> getSendersAsGroups(FormPK pk) throws FormsOnlineException
Description copied from interface:FormsOnlineDAOGet the form's senders list where groups has been declared directly.- Specified by:
getSendersAsGroupsin interfaceFormsOnlineDAO- Parameters:
pk- the form primary key- Returns:
- group ids as a list of String
- Throws:
FormsOnlineException
-
getSendersAsUsers
public List<String> getSendersAsUsers(FormPK pk) throws FormsOnlineException
Description copied from interface:FormsOnlineDAOGet the form's senders list where users has been declared directly.- Specified by:
getSendersAsUsersin interfaceFormsOnlineDAO- Parameters:
pk- the form primary key- Returns:
- user ids as a list of String
- Throws:
FormsOnlineException
-
updateReceivers
public void updateReceivers(FormPK pk, Map<String,org.silverpeas.core.util.Pair<List<String>,List<String>>> userAndGroupIdsByRightTypes) throws FormsOnlineException
Description copied from interface:FormsOnlineDAOUpdates the form rights from given parameters.- Specified by:
updateReceiversin interfaceFormsOnlineDAO- 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 aPaircontaining on left the user identifiers and on right the group identifiers.- Throws:
FormsOnlineException- on technical error.
-
updateSenders
public void updateSenders(FormPK pk, Map<String,org.silverpeas.core.util.Pair<List<String>,List<String>>> userAndGroupIdsByRightTypes) throws FormsOnlineException
Description copied from interface:FormsOnlineDAOUpdate form senders list.- Specified by:
updateSendersin interfaceFormsOnlineDAO- Parameters:
pk- the form primary keyuserAndGroupIdsByRightTypes- the new sender list as user ids- Throws:
FormsOnlineException
-
getUserAvailableForms
public List<FormDetail> getUserAvailableForms(Collection<String> instanceIds, String userId, String[] userGroupIds, String orderBy) throws FormsOnlineException
Description copied from interface:FormsOnlineDAOGet the form available to be sent for given user or given groups- Specified by:
getUserAvailableFormsin interfaceFormsOnlineDAO- Parameters:
instanceIds- the component instance iduserId- the user iduserGroupIds- the user's groups id list- Returns:
- a list of FormDetail objects
- Throws:
FormsOnlineException
-
getForms
public List<FormDetail> getForms(Collection<String> formIds) throws FormsOnlineException
- Specified by:
getFormsin interfaceFormsOnlineDAO- Throws:
FormsOnlineException
-
getSentFormInstances
public org.silverpeas.core.util.SilverpeasList<FormInstance> getSentFormInstances(FormPK pk, String userId, List<Integer> states, org.silverpeas.core.admin.PaginationPage paginationPage) throws FormsOnlineException
Description copied from interface:FormsOnlineDAOGet all form instances that have been sent by given user (excepted the ones that have been archived.- Specified by:
getSentFormInstancesin interfaceFormsOnlineDAO- 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
public org.silverpeas.core.util.SilverpeasList<FormInstance> getReceivedRequests(FormDetail form, List<Integer> states, RequestValidationCriteria validationCriteria, org.silverpeas.core.admin.PaginationPage paginationPage) throws FormsOnlineException
Description copied from interface:FormsOnlineDAOGet all requests associated to given form ordered from the newest to the older.- Specified by:
getReceivedRequestsin interfaceFormsOnlineDAO- Parameters:
form- the form primary keystates- the states to filter on if anyvalidationCriteria- 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
public Map<String,Set<FormInstanceValidationType>> getValidatorFormIdsWithValidationTypes(String instanceId, String validatorId, String[] validatorGroupIds, Collection<String> formIds) throws FormsOnlineException
Description copied from interface:FormsOnlineDAOGets theFormInstanceValidationTypeinstances mapped by form identifiers of the the validator represented by given validator id and validator group ids on the given component instance.- Specified by:
getValidatorFormIdsWithValidationTypesin interfaceFormsOnlineDAO- 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:
FormInstanceValidationTypeinstances mapped by form identifiers.- Throws:
FormsOnlineException
-
getPossibleValidationTypesByFormId
public Map<String,Set<FormInstanceValidationType>> getPossibleValidationTypesByFormId(Collection<String> formIds) throws FormsOnlineException
Description copied from interface:FormsOnlineDAOGets the possibleFormInstanceValidationTypeinstances mapped by form identifiers.- Specified by:
getPossibleValidationTypesByFormIdin interfaceFormsOnlineDAO- Parameters:
formIds- form identifiers to search for.- Returns:
FormInstanceValidationTypeinstances mapped by form identifiers.- Throws:
FormsOnlineException
-
saveRequest
public FormInstance saveRequest(FormInstance request) throws FormsOnlineException
Description copied from interface:FormsOnlineDAOInserts or updates the given request (also called a form instance).All validation data contained into
FormInstance.getValidations()are also inserted or updated.- Specified by:
saveRequestin interfaceFormsOnlineDAO- Parameters:
request- the request to insert or update.- Returns:
- the
FormInstanceitself. - Throws:
FormsOnlineException- on database integrity error.
-
saveRequestState
public void saveRequestState(FormInstance request) throws FormsOnlineException
Description copied from interface:FormsOnlineDAOSaves the state of the given request without updating anything else.- Specified by:
saveRequestStatein interfaceFormsOnlineDAO- Parameters:
request- the request which the state MUST be updated.- Throws:
FormsOnlineException- if the form instance id does not exist.
-
getRequest
public FormInstance getRequest(RequestPK pk) throws FormsOnlineException
- Specified by:
getRequestin interfaceFormsOnlineDAO- Throws:
FormsOnlineException
-
deleteRequest
public void deleteRequest(RequestPK pk) throws FormsOnlineException
- Specified by:
deleteRequestin interfaceFormsOnlineDAO- Throws:
FormsOnlineException
-
getNumberOfRequestsByForm
public Map<Integer,Integer> getNumberOfRequestsByForm(String instanceId) throws FormsOnlineException
- Specified by:
getNumberOfRequestsByFormin interfaceFormsOnlineDAO- Throws:
FormsOnlineException
-
getAllRequests
public org.silverpeas.core.util.SilverpeasList<FormInstance> getAllRequests(FormPK pk) throws FormsOnlineException
- Specified by:
getAllRequestsin interfaceFormsOnlineDAO- Throws:
FormsOnlineException
-
getConnection
protected Connection getConnection() throws SQLException
Get a new connection.- Returns:
- the initialized connection.
- Throws:
SQLException
-
-