1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
package org.demosys.web.story.action; |
7 |
|
import org.apache.struts.action.ActionError; |
8 |
|
import org.apache.struts.action.ActionErrors; |
9 |
|
import org.apache.struts.action.ActionForm; |
10 |
|
import org.apache.struts.action.ActionMapping; |
11 |
|
import org.demosys.web.story.StoryView; |
12 |
|
|
13 |
|
|
14 |
|
|
15 |
0 |
public class NewStoryForm extends ActionForm { |
16 |
|
private String title; |
17 |
|
private String description; |
18 |
|
private double estimate; |
19 |
|
private int priority; |
20 |
|
|
21 |
|
public void reset(ActionMapping actionMapping, |
22 |
|
javax.servlet.http.HttpServletRequest httpServletRequest) { |
23 |
0 |
setTitle(null); |
24 |
0 |
setDescription(null); |
25 |
0 |
setEstimate(0); |
26 |
0 |
setPriority(5); |
27 |
0 |
} |
28 |
|
|
29 |
|
|
30 |
|
public ActionErrors validate(ActionMapping actionMapping, |
31 |
|
javax.servlet.http.HttpServletRequest httpServletRequest) { |
32 |
0 |
ActionErrors errors = new ActionErrors(); |
33 |
|
|
34 |
0 |
if (this.getTitle().length() < 2) { |
35 |
0 |
errors.add("title", new ActionError("story.new.error.title")); |
36 |
|
} |
37 |
|
|
38 |
0 |
return errors; |
39 |
|
} |
40 |
|
|
41 |
|
|
42 |
|
public String getTitle() { |
43 |
0 |
return title; |
44 |
|
} |
45 |
|
|
46 |
|
|
47 |
|
public void setTitle(String title) { |
48 |
0 |
this.title = title; |
49 |
0 |
} |
50 |
|
|
51 |
|
|
52 |
|
public String getDescription() { |
53 |
0 |
return description; |
54 |
|
} |
55 |
|
|
56 |
|
|
57 |
|
public void setDescription(String description) { |
58 |
0 |
this.description = description; |
59 |
0 |
} |
60 |
|
|
61 |
|
|
62 |
|
public double getEstimate() { |
63 |
0 |
return estimate; |
64 |
|
} |
65 |
|
|
66 |
|
|
67 |
|
public void setEstimate(double estimate) { |
68 |
0 |
this.estimate = estimate; |
69 |
0 |
} |
70 |
|
|
71 |
|
|
72 |
|
public int getPriority() { |
73 |
0 |
return priority; |
74 |
|
} |
75 |
|
|
76 |
|
|
77 |
|
public void setPriority(int priority) { |
78 |
0 |
this.priority = priority; |
79 |
0 |
} |
80 |
|
|
81 |
|
|
82 |
|
public StoryView toStoryView() { |
83 |
0 |
StoryView story = new StoryView(); |
84 |
0 |
story.setTitle(getTitle()); |
85 |
0 |
story.setDescription(getDescription()); |
86 |
0 |
story.setEstimate(getEstimate()); |
87 |
0 |
story.setPriority(getPriority()); |
88 |
|
|
89 |
0 |
return story; |
90 |
|
} |
91 |
|
} |