1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
package org.demosys.web.project.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.project.ProjectView; |
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
0 |
public class NewProjectForm extends ActionForm { |
20 |
|
private String name; |
21 |
|
private String description; |
22 |
|
|
23 |
|
public void reset(ActionMapping actionMapping, |
24 |
|
javax.servlet.http.HttpServletRequest httpServletRequest) { |
25 |
0 |
setName(null); |
26 |
0 |
setDescription(null); |
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.getName().length() < 2) { |
35 |
0 |
errors.add("title", new ActionError("project.new.error.title")); |
36 |
|
} |
37 |
|
|
38 |
0 |
return errors; |
39 |
|
} |
40 |
|
|
41 |
|
|
42 |
|
public String getName() { |
43 |
0 |
return name; |
44 |
|
} |
45 |
|
|
46 |
|
|
47 |
|
public void setName(String name) { |
48 |
0 |
this.name = name; |
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 ProjectView toProjectView() { |
63 |
0 |
ProjectView project = new ProjectView(); |
64 |
0 |
project.setName(getName()); |
65 |
0 |
project.setDescription(getDescription()); |
66 |
|
|
67 |
0 |
return project; |
68 |
|
} |
69 |
|
} |