Mercurial > lada > lada-server
annotate src/main/java/de/intevation/lada/factory/ProbeFactory.java @ 656:866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
messprogramm
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Tue, 12 May 2015 15:18:03 +0200 |
parents | |
children | a5e6580e8016 |
rev | line source |
---|---|
656
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.lada.factory; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
3 import java.math.BigInteger; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
4 import java.sql.Timestamp; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 import java.util.ArrayList; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 import java.util.Calendar; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
7 import java.util.Date; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
8 import java.util.List; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
9 |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
10 import javax.inject.Inject; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
11 |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
12 import org.apache.log4j.Logger; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 import de.intevation.lada.model.land.LKommentarP; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
15 import de.intevation.lada.model.land.LMessung; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
16 import de.intevation.lada.model.land.LMesswert; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
17 import de.intevation.lada.model.land.LOrt; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
18 import de.intevation.lada.model.land.LProbe; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 import de.intevation.lada.model.land.Messprogramm; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 import de.intevation.lada.model.land.MessprogrammMmt; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 import de.intevation.lada.model.land.MessungTranslation; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 import de.intevation.lada.model.land.ProbeTranslation; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 import de.intevation.lada.model.stamm.SOrt; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 import de.intevation.lada.util.annotation.RepositoryConfig; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 import de.intevation.lada.util.data.QueryBuilder; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 import de.intevation.lada.util.data.Repository; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 import de.intevation.lada.util.data.RepositoryType; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 import de.intevation.lada.util.rest.Response; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 public class ProbeFactory { |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 @Inject |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 private Logger logger; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 @Inject |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 @RepositoryConfig(type = RepositoryType.RW) |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
37 private Repository repository; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
38 |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 public List<LProbe> create(String id, Long from, Long to) { |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 QueryBuilder<Messprogramm> builder = |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 new QueryBuilder<Messprogramm>( |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
42 repository.entityManager("land"), |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
43 Messprogramm.class); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 builder.and("id", id); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
45 Response response = repository.filter(builder.getQuery(), "land"); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
46 List<Messprogramm> messprogramme = |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
47 (List<Messprogramm>)response.getData(); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
48 if (messprogramme == null || messprogramme.isEmpty()) { |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
49 return null; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
50 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
51 Messprogramm messprogramm = messprogramme.get(0); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
52 Calendar start = Calendar.getInstance(); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
53 start.setTime(new Date(from)); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
54 Calendar end = Calendar.getInstance(); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
55 end.setTime(new Date (to)); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
56 // benutzereingabe + gültigVon/Bis |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
57 // kann mehrere Intervalle enthalten, wenn nutzereingabe über mehrere |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
58 // Jahre. |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
59 Date[][] intervals = calculateIntervals(start, end, messprogramm); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
60 List<LProbe> proben = new ArrayList<LProbe>(); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
61 for (Date[] interval : intervals) { |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
62 //erzeuge proben für einen intervall(gültigkeitsbereich) |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
63 createProben(interval, messprogramm, proben); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
64 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
65 return proben; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
66 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
67 |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
68 private void createProben( |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
69 Date[] interval, |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
70 Messprogramm messprogramm, |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
71 List<LProbe> proben |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
72 ) { |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
73 Calendar start = Calendar.getInstance(); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
74 start.setTime(interval[0]); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
75 int startDay = start.get(Calendar.DAY_OF_YEAR); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
76 Calendar end = Calendar.getInstance(); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
77 end.setTime(interval[1]); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
78 int endDay = end.get(Calendar.DAY_OF_YEAR); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
79 if ("J".equals(messprogramm.getProbenintervall()) && |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
80 messprogramm.getTeilintervallVon() >= startDay + messprogramm.getIntervallOffset() && |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
81 messprogramm.getTeilintervallBis() <= endDay + messprogramm.getIntervallOffset()) { |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
82 start.add(Calendar.DATE, messprogramm.getTeilintervallVon() - startDay + messprogramm.getIntervallOffset()); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
83 Date startDate = start.getTime(); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
84 end.add(Calendar.DATE, messprogramm.getTeilintervallBis() - endDay + messprogramm.getIntervallOffset()); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
85 Date endDate = end.getTime(); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
86 LProbe probe = createObjects(messprogramm, startDate, endDate); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
87 proben.add(probe); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
88 return; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
89 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
90 int intervalDays = parseInterval(messprogramm.getProbenintervall()); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
91 int teilStart = messprogramm.getTeilintervallVon() + startDay; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
92 int teilEnd = messprogramm.getTeilintervallBis() + startDay; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
93 int offset = messprogramm.getIntervallOffset() == null ? 0 : messprogramm.getIntervallOffset(); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
94 |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
95 for (; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
96 teilStart >= startDay + offset && teilEnd <= endDay + offset;) { |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
97 start.add(Calendar.DATE, teilStart - startDay + offset); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
98 Date startDate = start.getTime(); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
99 end.add(Calendar.DATE, teilEnd - endDay + offset); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
100 Date endDate = end.getTime(); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
101 LProbe probe = createObjects(messprogramm, startDate, endDate); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
102 proben.add(probe); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
103 teilStart += intervalDays; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
104 teilEnd += intervalDays; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
105 end.setTime(interval[1]); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
106 start.setTime(interval[0]); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
107 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
108 return; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
109 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
110 |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
111 private LProbe createObjects( |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
112 Messprogramm messprogramm, |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
113 Date startDate, |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
114 Date endDate |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
115 ) { |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
116 LProbe probe = new LProbe(); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
117 probe.setBaId(messprogramm.getBaId()); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
118 probe.setDatenbasisId(messprogramm.getDatenbasisId()); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
119 probe.setMediaDesk(messprogramm.getMediaDesk()); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
120 probe.setMstId(messprogramm.getMstId()); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
121 probe.setNetzbetreiberId(messprogramm.getNetzbetreiberId()); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
122 probe.setProbenartId(messprogramm.getProbenartId()); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
123 probe.setProbeNehmerId(messprogramm.getProbeNehmerId()); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
124 probe.setSolldatumBeginn(new Timestamp(startDate.getTime())); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
125 probe.setSolldatumEnde(new Timestamp(endDate.getTime())); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
126 probe.setTest(messprogramm.getTest()); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
127 probe.setUmwId(messprogramm.getUmwId()); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
128 repository.create(probe, "land"); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
129 ProbeTranslation translation = new ProbeTranslation(); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
130 translation.setProbeId(probe); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
131 repository.create(translation, "land"); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
132 |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
133 if (messprogramm.getProbeKommentar() != null && |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
134 !messprogramm.getProbeKommentar().equals("")) { |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
135 LKommentarP kommentar = new LKommentarP(); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
136 kommentar.setDatum(new Timestamp(new Date().getTime())); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
137 kommentar.setProbeId(probe.getId()); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
138 kommentar.setText(messprogramm.getProbeKommentar()); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
139 kommentar.setErzeuger(messprogramm.getMstId()); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
140 |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
141 repository.create(kommentar, "land"); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
142 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
143 |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
144 QueryBuilder<MessprogrammMmt> builder = |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
145 new QueryBuilder<MessprogrammMmt>( |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
146 repository.entityManager("land"), |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
147 MessprogrammMmt.class); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
148 builder.and("messprogrammId", messprogramm.getId()); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
149 Response response = repository.filter(builder.getQuery(), "land"); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
150 List<MessprogrammMmt> mmts = (List<MessprogrammMmt>)response.getData(); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
151 for (MessprogrammMmt mmt : mmts) { |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
152 LMessung messung = new LMessung(); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
153 messung.setFertig(false); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
154 messung.setGeplant(true); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
155 messung.setMmtId(mmt.getMmtId()); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
156 messung.setNebenprobenNr( |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
157 messprogramm.getNetzbetreiberId() + mmt.getMmtId()); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
158 messung.setProbeId(probe.getId()); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
159 repository.create(messung, "land"); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
160 MessungTranslation mTranslation = new MessungTranslation(); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
161 mTranslation.setMessungsId(messung); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
162 repository.create(mTranslation, "land"); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
163 for (int mw : mmt.getMessgroessen()) { |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
164 LMesswert wert = new LMesswert(); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
165 wert.setMessgroesseId(mw); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
166 wert.setMessungsId(messung.getId()); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
167 wert.setMesswert(0f); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
168 wert.setMehId(1); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
169 repository.create(wert, "land"); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
170 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
171 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
172 if (messprogramm.getGemId() != null && |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
173 !messprogramm.getGemId().equals("")) { |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
174 LOrt ort = new LOrt(); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
175 ort.setOrtsTyp("E"); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
176 ort.setProbeId(probe.getId()); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
177 QueryBuilder<SOrt> ortBuilder = new QueryBuilder<SOrt>( |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
178 repository.entityManager("stamm"), SOrt.class); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
179 ortBuilder.and("verwaltungseinheitId", messprogramm.getGemId()); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
180 Response ortResponse = repository.filter(ortBuilder.getQuery(), "stamm"); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
181 List<SOrt> orte = (List<SOrt>) ortResponse.getData(); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
182 if (orte != null && !orte.isEmpty()) { |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
183 ort.setOrt(BigInteger.valueOf(orte.get(0).getId())); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
184 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
185 repository.create(ort, "land"); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
186 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
187 return probe; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
188 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
189 |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
190 private Date[][] calculateIntervals( |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
191 Calendar start, |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
192 Calendar end, |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
193 Messprogramm messprogramm |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
194 ) { |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
195 int realStart = start.get(Calendar.DAY_OF_YEAR); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
196 int realEnd = end.get(Calendar.DAY_OF_YEAR); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
197 int startYear = start.get(Calendar.YEAR); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
198 int endYear = end.get(Calendar.YEAR); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
199 int years = (endYear - startYear) + 1; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
200 Date[][] intervals = new Date[years][2]; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
201 for (int i = 0; i < years; i++) { |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
202 Calendar cStart = Calendar.getInstance(); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
203 cStart.set(startYear + i, start.get(Calendar.MONTH), start.get(Calendar.DAY_OF_MONTH)); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
204 if (messprogramm.getGueltigVon() == null || |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
205 messprogramm.getGueltigVon() <= 0 || |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
206 (realStart > messprogramm.getGueltigVon() && |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
207 i == 0) |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
208 ) { |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
209 intervals[0][0] = start.getTime(); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
210 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
211 else { |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
212 start.add(Calendar.DATE, messprogramm.getGueltigVon() - realStart); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
213 Date startDate = start.getTime(); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
214 intervals[i][0] = startDate; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
215 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
216 |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
217 Calendar cEnd = Calendar.getInstance(); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
218 cEnd.set(startYear + i, end.get(Calendar.MONTH), end.get(Calendar.DAY_OF_MONTH)); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
219 if (messprogramm.getGueltigBis() == null || |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
220 messprogramm.getGueltigBis() <= 0 || |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
221 (realEnd < messprogramm.getGueltigBis() && |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
222 i == years - 1) |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
223 ) { |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
224 intervals[i][1] = cEnd.getTime(); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
225 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
226 else { |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
227 cEnd.add(Calendar.DATE, messprogramm.getGueltigBis() - realEnd); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
228 Date endDate = cEnd.getTime(); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
229 intervals[i][1] = endDate; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
230 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
231 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
232 |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
233 return intervals; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
234 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
235 |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
236 private int parseInterval(String interval) { |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
237 if ("J".equals(interval)) { |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
238 return 365; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
239 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
240 else if ("H".equals(interval)) { |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
241 return 183; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
242 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
243 else if ("Q".equals(interval)) { |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
244 return 91; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
245 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
246 else if ("M".equals(interval)) { |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
247 return 30; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
248 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
249 else if ("W4".equals(interval)) { |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
250 return 28; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
251 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
252 else if ("W2".equals(interval)) { |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
253 return 14; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
254 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
255 else if ("W".equals(interval)) { |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
256 return 7; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
257 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
258 else if ("T".equals(interval)) { |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
259 return 1; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
260 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
261 else { |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
262 return 0; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
263 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
264 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
265 } |