01: package com.technoetic.xplanner.forms;
02:
03: import javax.servlet.http.HttpServletRequest;
04:
05: import com.technoetic.xplanner.domain.UserStory;
06: import org.apache.struts.action.ActionErrors;
07: import org.apache.struts.action.ActionMapping;
08:
09: public class MoveContinueTaskForm extends AbstractEditorForm {
10: private String name;
11: private int storyId;
12: private int targetStoryId;
13: private int taskId;
14: static final String SAME_STORY_ERROR_KEY = "task.editor.same_story";
15:
16: public String getContainerId() {
17: return Integer.toString(getStoryId());
18: }
19:
20: public ActionErrors validate(ActionMapping mapping,
21: HttpServletRequest request) {
22: ActionErrors errors = new ActionErrors();
23:
24: if (isSubmitted()) {
25: if (!isMerge()) {
26: require(errors, name, "task.editor.missing_name");
27: } else {
28: require(errors, targetStoryId != storyId,
29: SAME_STORY_ERROR_KEY);
30: }
31: }
32: return errors;
33: }
34:
35: public void reset(ActionMapping mapping, HttpServletRequest request) {
36: super .reset(mapping, request);
37: storyId = 0;
38: targetStoryId = 0;
39: }
40:
41: public String getName() {
42: return name;
43: }
44:
45: public void setName(String name) {
46: this .name = name;
47: }
48:
49: public void setStoryId(int storyId) {
50: if (targetStoryId == 0) {
51: targetStoryId = storyId;
52: }
53: this .storyId = storyId;
54: }
55:
56: public int getStoryId() {
57: return storyId;
58: }
59:
60: public void setStory(UserStory story) {
61: this .storyId = story == null ? 0 : story.getId();
62: }
63:
64: public int getTargetStoryId() {
65: return targetStoryId;
66: }
67:
68: public void setTargetStoryId(int targetStoryId) {
69: this .targetStoryId = targetStoryId;
70: }
71:
72: public int getTaskId() {
73: return taskId;
74: }
75:
76: public void setTaskId(int taskId) {
77: this.taskId = taskId;
78: }
79: }
|