1
2
3
4
5
6
7
8
9
10
11 package de.jaret.util.date.holidayenumerator;
12
13 import java.util.Calendar;
14 import java.util.Date;
15 import java.util.Locale;
16
17
18
19
20
21
22
23
24
25 public class HolidayEnumerator_de_DE extends HolidayEnumeratorBase {
26
27 public static final String DE_DE_REGION_NRW = "NRW";
28
29 public static final String DE_DE_REGION_BLN = "BLN";
30
31 public static final String DE_DE_REGION_BAV = "BAV";
32
33 public static final String DE_DE_REGION_HH = "HH";
34
35 public static final String DE_DE_REGION_HB = "HB";
36
37 public static final String DE_DE_REGION_SHLST = "SHLST";
38
39 public static final String DE_DE_REGION_NIE = "NIE";
40
41 public static final String DE_DE_REGION_MVP = "MVP";
42
43 public static final String DE_DE_REGION_BRA = "BRA";
44
45 public static final String DE_DE_REGION_THUE = "THUE";
46
47 public static final String DE_DE_REGION_SACH = "SACH";
48
49 public static final String DE_DE_REGION_SAAN = "SAAN";
50
51 public static final String DE_DE_REGION_BAWUE = "BAWUE";
52
53 public static final String DE_DE_REGION_HES = "HES";
54
55 public static final String DE_DE_REGION_SAAR = "SAAR";
56
57 public static final String DE_DE_REGION_RHPFA = "RHPFA";
58
59 private static final String[] REGIONIDS = {DE_DE_REGION_NRW, DE_DE_REGION_BLN, DE_DE_REGION_BAV, DE_DE_REGION_HH,
60 DE_DE_REGION_HB, DE_DE_REGION_SHLST, DE_DE_REGION_NIE, DE_DE_REGION_MVP, DE_DE_REGION_BRA,
61 DE_DE_REGION_THUE, DE_DE_REGION_SACH, DE_DE_REGION_SAAN, DE_DE_REGION_BAWUE, DE_DE_REGION_HES,
62 DE_DE_REGION_SAAR, DE_DE_REGION_RHPFA};
63
64
65
66
67
68
69 public HolidayEnumerator_de_DE(String regionId) {
70 _regionId = regionId;
71 _locale = Locale.GERMANY;
72 }
73
74
75
76
77
78 public String[] getAvailableRegionIds() {
79 return REGIONIDS;
80 }
81
82
83
84
85 protected void fillMap(int year) {
86
87 addNamedDate(year, 0, 1, true, "Neujahr");
88 addNamedDate(year, 4, 1, true, "Tag der Arbeit");
89 addNamedDate(year, 9, 3, true, "Tag der deutschen Einheit");
90 addNamedDate(year, 11, 24, false, "Heiligabend");
91 addNamedDate(year, 11, 25, true, "1. Weihnachtsfeiertag");
92 addNamedDate(year, 11, 26, true, "2. Weihnachtsfeiertag");
93 addNamedDate(year, 11, 31, false, "Sylvester");
94
95
96 EasyDate ed = calcEaster(year);
97 addNamedDate(year, ed.month, ed.day, true, "Ostersonntag");
98 addNamedDate(year, ed.month, ed.day, 1, true, "Ostermontag");
99 addNamedDate(year, ed.month, ed.day, -2, true, "Karfreitag");
100
101
102 addNamedDate(year, ed.month, ed.day, 39, true, "Christi Himmelfahrt");
103
104
105 addNamedDate(year, ed.month, ed.day, 49, true, "Pfingstsonntag");
106 addNamedDate(year, ed.month, ed.day, 50, true, "Pfingstmontag");
107
108
109
110 if (_regionId != null
111 && (_regionId.equals(DE_DE_REGION_BAV) || _regionId.equals(DE_DE_REGION_SAAN) || _regionId
112 .equals(DE_DE_REGION_BAWUE))) {
113 addNamedDate(year, 0, 6, true, "Heilige drei Kˆnige");
114 } else {
115 addNamedDate(year, 0, 6, false, "Heilige drei Kˆnige");
116 }
117
118
119
120 if (_regionId != null
121 && (_regionId.equals(DE_DE_REGION_BAV) || _regionId.equals(DE_DE_REGION_BAWUE)
122 || _regionId.equals(DE_DE_REGION_HES) || _regionId.equals(DE_DE_REGION_NRW)
123 || _regionId.equals(DE_DE_REGION_RHPFA) || _regionId.equals(DE_DE_REGION_SAAR))) {
124 addNamedDate(year, ed.month, ed.day, 60, true, "Fronleichnam");
125 } else {
126 addNamedDate(year, ed.month, ed.day, 60, false, "Fronleichnam");
127 }
128
129
130
131 if (_regionId != null && (_regionId.equals(DE_DE_REGION_SAAR))) {
132 addNamedDate(year, 7, 15, true, "Mari‰ Himmelfahrt");
133 } else {
134 addNamedDate(year, 7, 15, false, "Mari‰ Himmelfahrt");
135 }
136
137
138
139 if (_regionId != null
140 && (_regionId.equals(DE_DE_REGION_BRA) || _regionId.equals(DE_DE_REGION_MVP)
141 || _regionId.equals(DE_DE_REGION_SACH) || _regionId.equals(DE_DE_REGION_SAAN) || _regionId
142 .equals(DE_DE_REGION_THUE))) {
143 addNamedDate(year, 9, 31, true, "Reformationstag");
144 } else {
145 addNamedDate(year, 9, 31, false, "Reformationstag");
146 }
147
148
149
150 if (_regionId != null
151 && (_regionId.equals(DE_DE_REGION_BAV) || _regionId.equals(DE_DE_REGION_BAWUE)
152 || _regionId.equals(DE_DE_REGION_NRW) || _regionId.equals(DE_DE_REGION_RHPFA) || _regionId
153 .equals(DE_DE_REGION_SAAR))) {
154 addNamedDate(year, 10, 1, true, "Allerheiligen");
155 } else {
156 addNamedDate(year, 10, 1, false, "Allerheiligen");
157 }
158
159
160
161
162 EasyDate bbt = calcBussBettag(year);
163 if (_regionId != null && (_regionId.equals(DE_DE_REGION_SACH))) {
164 addNamedDate(year, bbt.month, bbt.day, true, "Bufl- und Bettag");
165 } else {
166 addNamedDate(year, bbt.month, bbt.day, false, "Bufl- und Bettag");
167 }
168
169
170 addNamedDate(year, ed.month, ed.day, -48, false, "Rosenmontag");
171 addNamedDate(year, ed.month, ed.day, -52, false, "Weiberfastnacht");
172 }
173
174
175
176
177
178
179
180
181 protected EasyDate calcBussBettag(int year) {
182 EasyDate result = null;
183 int i = 0;
184 while (i < 7 && result == null) {
185 Date d = getDate(year, 10, 16, i);
186 if (getWeekday(d) == Calendar.WEDNESDAY) {
187 result = new EasyDate(d);
188 }
189 i++;
190 }
191 return result;
192 }
193
194 }