01: package com.technoetic.xplanner.actions;
02:
03: import com.technoetic.xplanner.domain.Iteration;
04: import com.technoetic.xplanner.domain.IterationStatus;
05: import com.technoetic.xplanner.charts.DataSampler;
06:
07: import net.sf.hibernate.Session;
08: import org.apache.commons.lang.StringUtils;
09: import org.apache.struts.action.ActionForm;
10: import org.apache.struts.action.ActionMapping;
11:
12: import javax.servlet.ServletException;
13: import javax.servlet.http.HttpServletRequest;
14: import javax.servlet.http.HttpServletResponse;
15:
16: public class EditIterationAction extends EditObjectAction {
17: public static final String ACTION_KEY = "action";
18: private DataSampler dataSampler;
19:
20: public DataSampler getDataSampler() {
21: return dataSampler;
22: }
23:
24: public void setDataSampler(DataSampler dataSampler) {
25: this .dataSampler = dataSampler;
26: }
27:
28: public void beforeObjectCommit(Object object, Session session,
29: ActionMapping actionMapping, ActionForm actionForm,
30: HttpServletRequest request, HttpServletResponse reply)
31: throws Exception {
32: Iteration iteration = (Iteration) object;
33: String action = request.getParameter(ACTION_KEY);
34: try {
35: if (StringUtils.equals(action,
36: EditObjectAction.CREATE_ACTION)) {
37: iteration.setStatus(IterationStatus.INACTIVE);
38: iteration.setDaysWorked(0.0d);
39: }
40: } catch (Exception e) {
41: throw new ServletException(e);
42: }
43: }
44:
45: }
|