annotate src/main/java/de/intevation/lada/factory/ProbeFactory.java @ 691:46bb231ff9b9

Documentation.
author Raimund Renkert <raimund.renkert@intevation.de>
date Tue, 07 Jul 2015 11:56:36 +0200
parents 3118fbbe6292
children b8afbf6c1b5d
rev   line source
691
46bb231ff9b9 Documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 685
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
46bb231ff9b9 Documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 685
diff changeset
2 * Software engineering by Intevation GmbH
46bb231ff9b9 Documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 685
diff changeset
3 *
46bb231ff9b9 Documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 685
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
46bb231ff9b9 Documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 685
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
46bb231ff9b9 Documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 685
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
46bb231ff9b9 Documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 685
diff changeset
7 */
656
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8 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
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 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
11 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
12 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
13 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
14 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
15 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
16
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 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
18
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.LKommentarP;
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.LMessung;
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.LMesswert;
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.LOrt;
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.land.LProbe;
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.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
25 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
26 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
27 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
28 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
29 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
30 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
31 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
32 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
33 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
34
691
46bb231ff9b9 Documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 685
diff changeset
35 /**
46bb231ff9b9 Documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 685
diff changeset
36 * This factory creates probe objects and its children using a messprogramm
46bb231ff9b9 Documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 685
diff changeset
37 * as template.
46bb231ff9b9 Documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 685
diff changeset
38 *
46bb231ff9b9 Documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 685
diff changeset
39 * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a>
46bb231ff9b9 Documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 685
diff changeset
40 */
656
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
41 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
42
691
46bb231ff9b9 Documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 685
diff changeset
43 /**
46bb231ff9b9 Documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 685
diff changeset
44 * The data repository
46bb231ff9b9 Documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 685
diff changeset
45 */
656
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46 @Inject
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47 @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
48 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
49
691
46bb231ff9b9 Documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 685
diff changeset
50 /**
46bb231ff9b9 Documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 685
diff changeset
51 * Create a list of probe objects
46bb231ff9b9 Documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 685
diff changeset
52 *
46bb231ff9b9 Documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 685
diff changeset
53 * @param id Messprogramm id
46bb231ff9b9 Documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 685
diff changeset
54 * @param from The start date
46bb231ff9b9 Documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 685
diff changeset
55 * @param to The end date
46bb231ff9b9 Documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 685
diff changeset
56 *
46bb231ff9b9 Documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 685
diff changeset
57 * @return List of probe objects.
46bb231ff9b9 Documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 685
diff changeset
58 */
656
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
59 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
60 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
61 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
62 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
63 Messprogramm.class);
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
64 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
65 Response response = repository.filter(builder.getQuery(), "land");
685
3118fbbe6292 Fixed or supressed warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 684
diff changeset
66 @SuppressWarnings("unchecked")
656
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
67 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
68 (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
69 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
70 return null;
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
71 }
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
72 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
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(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
75 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
76 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
77 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
78 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
79 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
80 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
81 }
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
82 return proben;
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
83 }
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 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
86 Date[] interval,
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
87 Messprogramm messprogramm,
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
88 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
89 ) {
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
90 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
91 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
92 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
93 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
94 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
95 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
96 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
97 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
98 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
99 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
100 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
101 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
102 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
103 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
104 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
105 return;
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
106 }
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
107 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
108 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
109 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
110 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
111
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
112 for (;
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
113 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
114 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
115 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
116 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
117 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
118 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
119 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
120 teilStart += intervalDays;
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
121 teilEnd += intervalDays;
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
122 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
123 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
124 }
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
125 return;
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
126 }
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 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
129 Messprogramm messprogramm,
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
130 Date startDate,
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
131 Date endDate
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 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
134 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
135 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
136 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
137 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
138 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
139 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
140 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
141 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
142 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
143 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
144 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
145 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
146 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
147 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
148 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
149
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
150 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
151 !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
152 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
153 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
154 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
155 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
156 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
157
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
158 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
159 }
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
160
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
161 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
162 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
163 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
164 MessprogrammMmt.class);
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
165 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
166 Response response = repository.filter(builder.getQuery(), "land");
685
3118fbbe6292 Fixed or supressed warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 684
diff changeset
167 @SuppressWarnings("unchecked")
656
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
168 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
169 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
170 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
171 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
172 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
173 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
174 messung.setNebenprobenNr(
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
175 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
176 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
177 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
178 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
179 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
180 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
181 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
182 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
183 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
184 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
185 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
186 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
187 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
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 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
191 !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
192 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
193 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
194 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
195 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
196 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
197 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
198 Response ortResponse = repository.filter(ortBuilder.getQuery(), "stamm");
685
3118fbbe6292 Fixed or supressed warnings.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 684
diff changeset
199 @SuppressWarnings("unchecked")
656
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
200 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
201 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
202 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
203 }
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
204 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
205 }
680
a5e6580e8016 Reload the created probe object to have the 'probeIdAlt' field available.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 656
diff changeset
206 // 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
207 probe =
a5e6580e8016 Reload the created probe object to have the 'probeIdAlt' field available.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 656
diff changeset
208 (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
209 return probe;
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
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
212 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
213 Calendar start,
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
214 Calendar end,
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
215 Messprogramm messprogramm
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 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
218 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
219 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
220 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
221 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
222 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
223 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
224 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
225 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
226 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
227 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
228 (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
229 i == 0)
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 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
232 }
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
233 else {
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
234 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
235 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
236 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
237 }
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
238
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
239 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
240 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
241 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
242 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
243 (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
244 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
245 ) {
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
246 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
247 }
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
248 else {
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
249 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
250 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
251 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
252 }
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
253 }
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 return intervals;
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
256 }
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 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
259 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
260 return 365;
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 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
263 return 183;
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 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
266 return 91;
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
267 }
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
268 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
269 return 30;
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
270 }
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
271 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
272 return 28;
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
273 }
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
274 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
275 return 14;
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
276 }
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
277 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
278 return 7;
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
279 }
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
280 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
281 return 1;
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
282 }
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
283 else {
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
284 return 0;
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
285 }
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
286 }
866d05db7a6a Added probe factory. This factory creates probe objects(and its childs) from
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
287 }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)