1
2
3
4
5
6
7
8
9
10
11
12 package fr.hyphonem.conges;
13
14 import java.util.Calendar;
15
16 import javax.servlet.http.HttpServletRequest;
17
18 import org.apache.struts.action.ActionError;
19 import org.apache.struts.action.ActionErrors;
20
21 import fr.hyphonem.conges.data.EmployeeData;
22
23
24
25
26
27 public final class CheckData {
28
29
30
31
32
33
34
35
36
37
38
39 public static ActionErrors check(HttpServletRequest request,
40 EmployeeData employee, ActionErrors errors) {
41
42 String dataDirPath = (String) request.getSession().getAttribute(
43 "dataDirPath");
44
45 AccessData ad = new AccessDataMng().getInstance(dataDirPath);
46
47 try {
48 ad.readNationalHolidays(employee.getPays(), ""
49 + Calendar.getInstance().get(Calendar.YEAR));
50 } catch (Exception e) {
51 System.out.println("CheckData NationalHolidays " + e.getMessage());
52 errors.add("NationalHolidays", new ActionError(
53 "error.data.not.ready"));
54 }
55
56 try {
57 ad.readCalendarData(employee);
58 } catch (Exception e) {
59 System.out.println("CheckData CalendarData " + e.getMessage());
60 errors.add("CalendarData", new ActionError("error.data.not.ready"));
61 }
62
63 try {
64 ad.readParamMail();
65 } catch (Exception e) {
66 System.out.println("CheckData ParamMail " + e.getMessage());
67 errors.add("ParamMail", new ActionError("error.data.not.ready"));
68 }
69
70 try {
71 ad.readParamPays();
72 } catch (Exception e) {
73 System.out.println("CheckData ParamPays " + e.getMessage());
74 errors.add("ParamPays", new ActionError("error.data.not.ready"));
75 }
76
77 try {
78 ad.readParams();
79 } catch (Exception e) {
80 System.out.println("CheckData Param " + e.getMessage());
81 errors.add("Param", new ActionError("error.data.not.ready"));
82 }
83
84 try {
85 ad.readReasons();
86 } catch (Exception e) {
87 System.out.println("CheckData Reasons " + e.getMessage());
88 errors.add("Reasons", new ActionError("error.data.not.ready"));
89 }
90
91 try {
92 ad.readTeams();
93 } catch (Exception e) {
94 System.out.println("CheckData Teams " + e.getMessage());
95 errors.add("Teams", new ActionError("error.data.not.ready"));
96 }
97
98 try {
99 ad.readUsers();
100 } catch (Exception e) {
101 System.out.println("CheckData Users " + e.getMessage());
102 errors.add("Users", new ActionError("error.data.not.ready"));
103 }
104
105 return errors;
106 }
107 }