| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 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 |
|
|
| 13 |
|
|
| 14 |
0 |
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 |
0 |
setTitle(null); |
| 25 |
0 |
setDescription("coucou"); |
| 26 |
0 |
setResponsible(null); |
| 27 |
0 |
setEstimate(0); |
| 28 |
0 |
setWork(0); |
| 29 |
0 |
setRemainingWork(0); |
| 30 |
0 |
} |
| 31 |
|
|
| 32 |
|
|
| 33 |
|
public ActionErrors validate(ActionMapping actionMapping, |
| 34 |
|
javax.servlet.http.HttpServletRequest httpServletRequest) { |
| 35 |
0 |
ActionErrors errors = new ActionErrors(); |
| 36 |
|
|
| 37 |
0 |
if (this.getTitle().length() < 2) { |
| 38 |
0 |
errors.add("title", new ActionError("task.creation.error.title")); |
| 39 |
|
} |
| 40 |
|
|
| 41 |
0 |
return errors; |
| 42 |
|
} |
| 43 |
|
|
| 44 |
|
|
| 45 |
|
public String getTitle() { |
| 46 |
0 |
return title; |
| 47 |
|
} |
| 48 |
|
|
| 49 |
|
|
| 50 |
|
public void setTitle(String title) { |
| 51 |
0 |
this.title = title; |
| 52 |
0 |
} |
| 53 |
|
|
| 54 |
|
|
| 55 |
|
public String getDescription() { |
| 56 |
0 |
return description; |
| 57 |
|
} |
| 58 |
|
|
| 59 |
|
|
| 60 |
|
public void setDescription(String description) { |
| 61 |
0 |
this.description = description; |
| 62 |
0 |
} |
| 63 |
|
|
| 64 |
|
|
| 65 |
|
public String getResponsible() { |
| 66 |
0 |
return responsible; |
| 67 |
|
} |
| 68 |
|
|
| 69 |
|
|
| 70 |
|
public void setResponsible(String responsible) { |
| 71 |
0 |
this.responsible = responsible; |
| 72 |
0 |
} |
| 73 |
|
|
| 74 |
|
|
| 75 |
|
public double getEstimate() { |
| 76 |
0 |
return estimate; |
| 77 |
|
} |
| 78 |
|
|
| 79 |
|
|
| 80 |
|
public void setEstimate(double estimate) { |
| 81 |
0 |
this.estimate = estimate; |
| 82 |
0 |
} |
| 83 |
|
|
| 84 |
|
|
| 85 |
|
public double getWork() { |
| 86 |
0 |
return work; |
| 87 |
|
} |
| 88 |
|
|
| 89 |
|
|
| 90 |
|
public void setWork(double work) { |
| 91 |
0 |
this.work = work; |
| 92 |
0 |
} |
| 93 |
|
|
| 94 |
|
|
| 95 |
|
public double getRemainingWork() { |
| 96 |
0 |
return remainingWork; |
| 97 |
|
} |
| 98 |
|
|
| 99 |
|
|
| 100 |
|
public void setRemainingWork(double remainingWork) { |
| 101 |
0 |
this.remainingWork = remainingWork; |
| 102 |
0 |
} |
| 103 |
|
|
| 104 |
|
|
| 105 |
|
public TaskView toTaskView() { |
| 106 |
0 |
TaskView task = new TaskView(); |
| 107 |
0 |
task.setTitle(getTitle()); |
| 108 |
0 |
task.setDescription(getDescription()); |
| 109 |
0 |
task.setResponsible(getResponsible()); |
| 110 |
0 |
task.setEstimate(getEstimate()); |
| 111 |
0 |
task.setWork(getWork()); |
| 112 |
0 |
task.setRemainingWork(getRemainingWork()); |
| 113 |
|
|
| 114 |
0 |
return task; |
| 115 |
|
} |
| 116 |
|
} |