public ActionForward save(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
// get the service
ReleaseService releaseService = AgilePlanningObjectFactory.getReleaseService();
// get the form
ReleaseForm releaseform = (ReleaseForm) form;
// TODO faire une seul méthode iterationService.saveOrUpdate ?
Errors errors = null;
// get the current basicProject from the session
Integer basicProjectPersistanceId = (Integer) request.getSession().getAttribute("basicProject.persistanceId");
// save the iteration
if (releaseform.getPersistanceId() == 0) {
// add
errors = releaseService.add(basicProjectPersistanceId.intValue(), releaseform.getNumber(), releaseform.getDate());
} else {
// update
errors = releaseService.update(releaseform.getNumber(), releaseform.getDate(), releaseform.getPersistanceId(), releaseform.getPersistanceVersion());
}
// Convert into struts action errors
if (errors.hasErrors()) {
ActionMessages actionMessages = ActionMessageUtils.convertFromKeopsErrorsToActionMessages(errors);