com.silverpeas.formsonline.model
Class FormsOnlineDAOJdbc

java.lang.Object
  extended by com.silverpeas.formsonline.model.FormsOnlineDAOJdbc
All Implemented Interfaces:
FormsOnlineDAO

public class FormsOnlineDAOJdbc
extends Object
implements FormsOnlineDAO


Constructor Summary
FormsOnlineDAOJdbc()
           
 
Method Summary
 FormDetail createForm(FormDetail formDetail)
          Save new form in database
 FormInstance createInstance(FormInstance instance)
           
 FormDetail deleteForm(FormPK pk)
          Delete Form from database
 void deleteRequest(RequestPK pk)
           
 List<FormDetail> findAllForms(String instanceId)
          Get all forms that has been created in given instance
 List<String> getAvailableFormIdsAsReceiver(String instanceId, String userId, String[] userGroupIds)
           
protected  Connection getConnection()
          Get a new connection.
 FormDetail getForm(FormPK pk)
          Load forms from database with given instance Id and form id
 List<FormDetail> getForms(List<String> formIds)
           
 List<FormInstance> getReceivedRequests(FormPK pk, boolean allRequests, String userId)
          Get all requests associated to given form.
 List<String> getReceiversAsGroups(FormPK pk)
          Get the form's receivers list where groups has been declared directly.
 List<String> getReceiversAsUsers(FormPK pk)
          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.
 List<FormInstance> getSentFormInstances(FormPK pk, String userId)
          Get all form instances that have been sent by given user (excepted the ones that have been archived.
 List<FormDetail> getUserAvailableForms(String instanceId, String userId, String[] userGroupIds)
          Get the form available to be sent for given user or given groups
 void updateForm(FormDetail formDetail)
          Update form in database
 void updateReceivers(FormPK pk, String[] newUserReceiverIds, String[] newGroupReceiverIds)
          Update form receivers list.
 void updateRequest(FormInstance formInstance)
           
 void updateSenders(FormPK pk, String[] newUserSenderIds, String[] newGroupSenderIds)
          Update form senders list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FormsOnlineDAOJdbc

public FormsOnlineDAOJdbc()
Method Detail

createForm

public FormDetail createForm(FormDetail formDetail)
                      throws FormsOnlineDatabaseException
Description copied from interface: FormsOnlineDAO
Save new form in database

Specified by:
createForm in interface FormsOnlineDAO
Parameters:
formDetail - the form detail
Returns:
the created FormDetail
Throws:
FormsOnlineDatabaseException

deleteForm

public FormDetail deleteForm(FormPK pk)
                      throws FormsOnlineDatabaseException
Description copied from interface: FormsOnlineDAO
Delete Form from database

Specified by:
deleteForm in interface FormsOnlineDAO
Parameters:
pk - the pk of form to be deleted
Returns:
the deleted FormDetail
Throws:
FormsOnlineDatabaseException

getForm

public FormDetail getForm(FormPK pk)
                   throws FormsOnlineDatabaseException
Description copied from interface: FormsOnlineDAO
Load forms from database with given instance Id and form id

Specified by:
getForm in interface FormsOnlineDAO
Parameters:
pk - the form primary key
Returns:
a FormDetail object
Throws:
FormsOnlineDatabaseException

findAllForms

public List<FormDetail> findAllForms(String instanceId)
                              throws FormsOnlineDatabaseException
Description copied from interface: FormsOnlineDAO
Get all forms that has been created in given instance

Specified by:
findAllForms in interface FormsOnlineDAO
Parameters:
instanceId - the instance id
Returns:
a List of FormDetail object
Throws:
FormsOnlineDatabaseException

updateForm

public void updateForm(FormDetail formDetail)
                throws FormsOnlineDatabaseException
Description copied from interface: FormsOnlineDAO
Update form in database

Specified by:
updateForm in interface FormsOnlineDAO
Parameters:
formDetail - the form detail
Throws:
FormsOnlineDatabaseException

getReceiversAsGroups

public List<String> getReceiversAsGroups(FormPK pk)
                                  throws FormsOnlineDatabaseException
Description copied from interface: FormsOnlineDAO
Get the form's receivers list where groups has been declared directly.

Specified by:
getReceiversAsGroups in interface FormsOnlineDAO
Parameters:
pk - the form primary key
Returns:
group ids as a list of String
Throws:
FormsOnlineDatabaseException

getReceiversAsUsers

public List<String> getReceiversAsUsers(FormPK pk)
                                 throws FormsOnlineDatabaseException
Description copied from interface: FormsOnlineDAO
Get the form's receivers list where users has been declared directly.

Specified by:
getReceiversAsUsers in interface FormsOnlineDAO
Parameters:
pk - the form primary key
Returns:
user ids as a list of String
Throws:
FormsOnlineDatabaseException

getSendersAsGroups

public List<String> getSendersAsGroups(FormPK pk)
                                throws FormsOnlineDatabaseException
Description copied from interface: FormsOnlineDAO
Get the form's senders list where groups has been declared directly.

Specified by:
getSendersAsGroups in interface FormsOnlineDAO
Parameters:
pk - the form primary key
Returns:
group ids as a list of String
Throws:
FormsOnlineDatabaseException

getSendersAsUsers

public List<String> getSendersAsUsers(FormPK pk)
                               throws FormsOnlineDatabaseException
Description copied from interface: FormsOnlineDAO
Get the form's senders list where users has been declared directly.

Specified by:
getSendersAsUsers in interface FormsOnlineDAO
Parameters:
pk - the form primary key
Returns:
user ids as a list of String
Throws:
FormsOnlineDatabaseException

updateReceivers

public void updateReceivers(FormPK pk,
                            String[] newUserReceiverIds,
                            String[] newGroupReceiverIds)
                     throws FormsOnlineDatabaseException
Description copied from interface: FormsOnlineDAO
Update form receivers list.

Specified by:
updateReceivers in interface FormsOnlineDAO
Parameters:
pk - the form primary key
newUserReceiverIds - the new receivers list as user ids
newGroupReceiverIds - the new receivers list as group ids
Throws:
FormsOnlineDatabaseException

updateSenders

public void updateSenders(FormPK pk,
                          String[] newUserSenderIds,
                          String[] newGroupSenderIds)
                   throws FormsOnlineDatabaseException
Description copied from interface: FormsOnlineDAO
Update form senders list.

Specified by:
updateSenders in interface FormsOnlineDAO
Parameters:
pk - the form primary key
newUserSenderIds - the new sender list as user ids
newGroupSenderIds - the new sender list as group ids
Throws:
FormsOnlineDatabaseException

getUserAvailableForms

public List<FormDetail> getUserAvailableForms(String instanceId,
                                              String userId,
                                              String[] userGroupIds)
                                       throws FormsOnlineDatabaseException
Description copied from interface: FormsOnlineDAO
Get the form available to be sent for given user or given groups

Specified by:
getUserAvailableForms in interface FormsOnlineDAO
Parameters:
instanceId - the component instance id
userId - the user id
userGroupIds - the user's groups id list
Returns:
a list of FormDetail objects
Throws:
FormsOnlineDatabaseException

getForms

public List<FormDetail> getForms(List<String> formIds)
                          throws FormsOnlineDatabaseException
Specified by:
getForms in interface FormsOnlineDAO
Throws:
FormsOnlineDatabaseException

getSentFormInstances

public List<FormInstance> getSentFormInstances(FormPK pk,
                                               String userId)
                                        throws FormsOnlineDatabaseException
Description copied from interface: FormsOnlineDAO
Get all form instances that have been sent by given user (excepted the ones that have been archived.

Specified by:
getSentFormInstances in interface FormsOnlineDAO
Parameters:
pk - the form primary key
userId - the user id
Returns:
a list of FormInstance objects
Throws:
FormsOnlineDatabaseException

getReceivedRequests

public List<FormInstance> getReceivedRequests(FormPK pk,
                                              boolean allRequests,
                                              String userId)
                                       throws FormsOnlineDatabaseException
Description copied from interface: FormsOnlineDAO
Get all requests associated to given form.

Specified by:
getReceivedRequests in interface FormsOnlineDAO
Parameters:
pk - the form primary key
userId - the user id
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:
FormsOnlineDatabaseException

getAvailableFormIdsAsReceiver

public List<String> getAvailableFormIdsAsReceiver(String instanceId,
                                                  String userId,
                                                  String[] userGroupIds)
                                           throws FormsOnlineDatabaseException
Specified by:
getAvailableFormIdsAsReceiver in interface FormsOnlineDAO
Throws:
FormsOnlineDatabaseException

createInstance

public FormInstance createInstance(FormInstance instance)
                            throws FormsOnlineDatabaseException
Specified by:
createInstance in interface FormsOnlineDAO
Throws:
FormsOnlineDatabaseException

getRequest

public FormInstance getRequest(RequestPK pk)
                        throws FormsOnlineDatabaseException
Specified by:
getRequest in interface FormsOnlineDAO
Throws:
FormsOnlineDatabaseException

updateRequest

public void updateRequest(FormInstance formInstance)
                   throws FormsOnlineDatabaseException
Specified by:
updateRequest in interface FormsOnlineDAO
Throws:
FormsOnlineDatabaseException

deleteRequest

public void deleteRequest(RequestPK pk)
                   throws FormsOnlineDatabaseException
Specified by:
deleteRequest in interface FormsOnlineDAO
Throws:
FormsOnlineDatabaseException

getConnection

protected Connection getConnection()
                            throws FormsOnlineDatabaseException
Get a new connection.

Returns:
the initialized connection.
Throws:
FormsOnlineDatabaseException - if a database error occured while getting connection


Copyright © 2016 Silverpeas. All Rights Reserved.