1 /*
2 * Demosys.
3 *
4 * Terms of license - http://opensource.org/licenses/apachepl.php
5 */
6 package org.demosys.task;
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 /***
12 * Formulaire pour la creation d'une task.
13 */
14 public class CreationTaskForm extends ActionForm {
15 private String title;
16 private String description;
17 private String responsible;
18 private double estimate;
19 private double work;
20 private double remainingWork;
21
22 public void reset(ActionMapping actionMapping,
23 javax.servlet.http.HttpServletRequest httpServletRequest) {
24 setTitle(null);
25 setDescription("coucou");
26 setResponsible(null);
27 setEstimate(0);
28 setWork(0);
29 setRemainingWork(0);
30 }
31
32
33 public ActionErrors validate(ActionMapping actionMapping,
34 javax.servlet.http.HttpServletRequest httpServletRequest) {
35 ActionErrors errors = new ActionErrors();
36
37 if (this.getTitle().length() < 2) {
38 errors.add("title", new ActionError("task.creation.error.title"));
39 }
40
41 return errors;
42 }
43
44
45 public String getTitle() {
46 return title;
47 }
48
49
50 public void setTitle(String title) {
51 this.title = title;
52 }
53
54
55 public String getDescription() {
56 return description;
57 }
58
59
60 public void setDescription(String description) {
61 this.description = description;
62 }
63
64
65 public String getResponsible() {
66 return responsible;
67 }
68
69
70 public void setResponsible(String responsible) {
71 this.responsible = responsible;
72 }
73
74
75 public double getEstimate() {
76 return estimate;
77 }
78
79
80 public void setEstimate(double estimate) {
81 this.estimate = estimate;
82 }
83
84
85 public double getWork() {
86 return work;
87 }
88
89
90 public void setWork(double work) {
91 this.work = work;
92 }
93
94
95 public double getRemainingWork() {
96 return remainingWork;
97 }
98
99
100 public void setRemainingWork(double remainingWork) {
101 this.remainingWork = remainingWork;
102 }
103
104
105 public TaskView toTaskView() {
106 TaskView task = new TaskView();
107 task.setTitle(getTitle());
108 task.setDescription(getDescription());
109 task.setResponsible(getResponsible());
110 task.setEstimate(getEstimate());
111 task.setWork(getWork());
112 task.setRemainingWork(getRemainingWork());
113
114 return task;
115 }
116 }
This page was automatically generated by Maven