Mercurial > lada > lada-server
annotate src/main/java/de/intevation/lada/factory/ProbeFactory.java @ 684:98d79aa9d996
Removed unused loggers.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Fri, 29 May 2015 13:09:37 +0200 |
parents | a5e6580e8016 |
children | 3118fbbe6292 |
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 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
|
13 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
|
14 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
|
15 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
|
16 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
|
17 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
|
18 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
|
19 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
|
20 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
|
21 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
|
22 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
|
23 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
|
24 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
|
25 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
|
26 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
|
27 |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 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
|
29 |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 @Inject |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 @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
|
32 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
|
33 |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 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
|
35 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
|
36 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
|
37 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
|
38 Messprogramm.class); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 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
|
40 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
|
41 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
|
42 (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
|
43 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
|
44 return null; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
45 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
46 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
|
47 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
|
48 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
|
49 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
|
50 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
|
51 // 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
|
52 // 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
|
53 // Jahre. |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
54 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
|
55 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
|
56 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
|
57 //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
|
58 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
|
59 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
60 return proben; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
61 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
62 |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
63 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
|
64 Date[] interval, |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
65 Messprogramm messprogramm, |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
66 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
|
67 ) { |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
68 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
|
69 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
|
70 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
|
71 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
|
72 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
|
73 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
|
74 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
|
75 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
|
76 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
|
77 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
|
78 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
|
79 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
|
80 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
|
81 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
|
82 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
|
83 return; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
84 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
85 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
|
86 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
|
87 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
|
88 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
|
89 |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
90 for (; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
91 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
|
92 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
|
93 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
|
94 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
|
95 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
|
96 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
|
97 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
|
98 teilStart += intervalDays; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
99 teilEnd += intervalDays; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
100 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
|
101 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
|
102 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
103 return; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
104 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
105 |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
106 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
|
107 Messprogramm messprogramm, |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
108 Date startDate, |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
109 Date endDate |
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 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
|
112 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
|
113 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
|
114 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
|
115 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
|
116 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
|
117 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
|
118 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
|
119 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
|
120 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
|
121 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
|
122 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
|
123 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
|
124 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
|
125 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
|
126 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
|
127 |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
128 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
|
129 !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
|
130 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
|
131 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
|
132 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
|
133 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
|
134 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
|
135 |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
136 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
|
137 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
138 |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
139 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
|
140 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
|
141 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
|
142 MessprogrammMmt.class); |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
143 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
|
144 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
|
145 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
|
146 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
|
147 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
|
148 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
|
149 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
|
150 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
|
151 messung.setNebenprobenNr( |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
152 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
|
153 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
|
154 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
|
155 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
|
156 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
|
157 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
|
158 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
|
159 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
|
160 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
|
161 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
|
162 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
|
163 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
|
164 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
|
165 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
166 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
167 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
|
168 !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
|
169 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
|
170 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
|
171 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
|
172 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
|
173 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
|
174 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
|
175 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
|
176 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
|
177 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
|
178 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
|
179 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
180 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
|
181 } |
680
a5e6580e8016
Reload the created probe object to have the 'probeIdAlt' field available.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
656
diff
changeset
|
182 // Reolad the probe to have the old id |
a5e6580e8016
Reload the created probe object to have the 'probeIdAlt' field available.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
656
diff
changeset
|
183 probe = |
a5e6580e8016
Reload the created probe object to have the 'probeIdAlt' field available.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
656
diff
changeset
|
184 (LProbe)repository.getById(LProbe.class, probe.getId(), "land").getData(); |
656
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
185 return probe; |
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 |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
188 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
|
189 Calendar start, |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
190 Calendar end, |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
191 Messprogramm messprogramm |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
192 ) { |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
193 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
|
194 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
|
195 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
|
196 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
|
197 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
|
198 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
|
199 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
|
200 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
|
201 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
|
202 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
|
203 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
|
204 (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
|
205 i == 0) |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
206 ) { |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
207 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
|
208 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
209 else { |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
210 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
|
211 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
|
212 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
|
213 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
214 |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
215 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
|
216 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
|
217 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
|
218 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
|
219 (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
|
220 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
|
221 ) { |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
222 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
|
223 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
224 else { |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
225 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
|
226 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
|
227 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
|
228 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
229 } |
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 return intervals; |
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 |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
234 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
|
235 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
|
236 return 365; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
237 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
238 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
|
239 return 183; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
240 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
241 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
|
242 return 91; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
243 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
244 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
|
245 return 30; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
246 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
247 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
|
248 return 28; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
249 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
250 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
|
251 return 14; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
252 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
253 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
|
254 return 7; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
255 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
256 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
|
257 return 1; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
258 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
259 else { |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
260 return 0; |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
261 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
262 } |
866d05db7a6a
Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
263 } |