01: package com.technoetic.xplanner.forms;
02:
03: import org.apache.struts.action.ActionErrors;
04: import org.apache.struts.action.ActionMapping;
05:
06: import javax.servlet.http.HttpServletRequest;
07:
08: import com.technoetic.xplanner.XPlannerProperties;
09:
10: public class MoveContinueStoryForm extends AbstractEditorForm {
11: private String name;
12: private int iterationId;
13: private int targetIterationId;
14: private int customerId;
15: private boolean isFutureIteration;
16:
17: static final String MISSING_NAME_ERROR_KEY = "story.editor.missing_name";
18: static final String SAME_ITERATION_ERROR_KEY = "story.editor.same_iteration";
19:
20: public String getContainerId() {
21: return Integer.toString(getIterationId());
22: }
23:
24: public ActionErrors validate(ActionMapping mapping,
25: HttpServletRequest request) {
26: ActionErrors errors = new ActionErrors();
27: if (isSubmitted()) {
28: if (!isMerge()) {
29: require(errors, name, MISSING_NAME_ERROR_KEY);
30: } else {
31: require(errors, targetIterationId != iterationId,
32: SAME_ITERATION_ERROR_KEY);
33: }
34:
35: }
36: return errors;
37: }
38:
39: public void reset(ActionMapping mapping, HttpServletRequest request) {
40: XPlannerProperties props = new XPlannerProperties();
41: reset(mapping, request, props);
42: }
43:
44: public void reset(ActionMapping mapping,
45: HttpServletRequest request, XPlannerProperties props) {
46: super .reset(mapping, request);
47: name = null;
48: iterationId = 0;
49: targetIterationId = 0;
50: customerId = 0;
51: }
52:
53: public String getName() {
54: return name;
55: }
56:
57: public void setName(String name) {
58: this .name = name;
59: }
60:
61: public void setIterationId(int iterationId) {
62: if (targetIterationId == 0) {
63: targetIterationId = iterationId;
64: }
65: this .iterationId = iterationId;
66: }
67:
68: public int getIterationId() {
69: return iterationId;
70: }
71:
72: public int getTargetIterationId() {
73: return targetIterationId;
74: }
75:
76: public void setTargetIterationId(int targetIterationId) {
77: this .targetIterationId = targetIterationId;
78: }
79:
80: public int getCustomerId() {
81: return customerId;
82: }
83:
84: public void setCustomerId(int customerId) {
85: this .customerId = customerId;
86: }
87:
88: public boolean isFutureIteration() {
89: return isFutureIteration;
90: }
91:
92: public void setFutureIteration(boolean futureIteration) {
93: isFutureIteration = futureIteration;
94: }
95: }
|