* submission_id) iii)new submission
*
* Creation date: June 5, 2006 5:19:18 PM
*/
protected Object formBackingObject(HttpServletRequest request) throws ServletException {
Study study = new Study();
String submission_id = ServletRequestUtils.getStringParameter(request, "id", null);
if (LOGGER.isInfoEnabled()) {
LOGGER.info("In studyFormController--");
}
if (!TreebaseUtil.isEmpty(submission_id)) {
study = mStudyService.findBySubmissionID(Long.parseLong(submission_id));
ControllerUtil.saveStudy(request, study); // user has made selection
return study;
}
// if we start a new form (indicated by URL)
String form = request.getParameter("form");
if (form != null && form.equals("new")) {
// start a new form, remove what's in the session
request.getSession().removeAttribute(Constants.STUDY_KEY);
request.getSession().removeAttribute(Constants.STUDY_MAP);
return new Study();
}
// if we are updating a data that's already in the db (access from RHS menu)
study = ControllerUtil.findStudy(request, mStudyService);
return study;