annotate src/main/java/de/intevation/lada/importer/laf/LafWriter.java @ 1028:1c41c7b8f7c2 schema-update

Updated server application to new database model. THIS IS STILL WIP!!!
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 08 Jul 2016 15:32:36 +0200
parents fa922101a462
children
rev   line source
626
9e733f44d8b0 Code style and comments.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 616
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
9e733f44d8b0 Code style and comments.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 616
diff changeset
2 * Software engineering by Intevation GmbH
9e733f44d8b0 Code style and comments.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 616
diff changeset
3 *
9e733f44d8b0 Code style and comments.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 616
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
9e733f44d8b0 Code style and comments.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 616
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
9e733f44d8b0 Code style and comments.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 616
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
9e733f44d8b0 Code style and comments.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 616
diff changeset
7 */
610
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8 package de.intevation.lada.importer.laf;
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
9
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10 import java.util.ArrayList;
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11 import java.util.List;
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 import java.util.Map;
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 import javax.inject.Inject;
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15 import javax.persistence.PersistenceException;
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 import de.intevation.lada.importer.ReportItem;
1028
1c41c7b8f7c2 Updated server application to new database model. THIS IS STILL WIP!!!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 833
diff changeset
18 import de.intevation.lada.model.land.KommentarM;
1c41c7b8f7c2 Updated server application to new database model. THIS IS STILL WIP!!!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 833
diff changeset
19 import de.intevation.lada.model.land.KommentarP;
1c41c7b8f7c2 Updated server application to new database model. THIS IS STILL WIP!!!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 833
diff changeset
20 import de.intevation.lada.model.land.Messung;
1c41c7b8f7c2 Updated server application to new database model. THIS IS STILL WIP!!!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 833
diff changeset
21 import de.intevation.lada.model.land.Messwert;
1c41c7b8f7c2 Updated server application to new database model. THIS IS STILL WIP!!!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 833
diff changeset
22 import de.intevation.lada.model.land.Ortszuordnung;
1c41c7b8f7c2 Updated server application to new database model. THIS IS STILL WIP!!!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 833
diff changeset
23 import de.intevation.lada.model.land.Probe;
1c41c7b8f7c2 Updated server application to new database model. THIS IS STILL WIP!!!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 833
diff changeset
24 import de.intevation.lada.model.stammdaten.Ort;
610
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25 import de.intevation.lada.util.annotation.AuthorizationConfig;
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26 import de.intevation.lada.util.annotation.RepositoryConfig;
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
27 import de.intevation.lada.util.auth.Authorization;
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
28 import de.intevation.lada.util.auth.AuthorizationType;
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
29 import de.intevation.lada.util.auth.UserInfo;
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30 import de.intevation.lada.util.data.Repository;
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31 import de.intevation.lada.util.data.RepositoryType;
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
33 /**
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
34 * Writer to persist new entities in the database.
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35 *
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36 * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a>
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37 */
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38 public class LafWriter {
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39
626
9e733f44d8b0 Code style and comments.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 616
diff changeset
40 /**
9e733f44d8b0 Code style and comments.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 616
diff changeset
41 * The repository to write database objects.
9e733f44d8b0 Code style and comments.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 616
diff changeset
42 */
615
3f57484e06f1 Updated importer: Do validation and object creation in the correct order.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 610
diff changeset
43 @Inject
610
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
44 @RepositoryConfig(type=RepositoryType.RW)
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
45 private Repository repository;
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46
626
9e733f44d8b0 Code style and comments.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 616
diff changeset
47 /**
9e733f44d8b0 Code style and comments.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 616
diff changeset
48 * The authorization module.
9e733f44d8b0 Code style and comments.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 616
diff changeset
49 */
610
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
50 @Inject
722
c81881dac97e Switch to shibboleth authorization in all REST-services.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 685
diff changeset
51 @AuthorizationConfig(type=AuthorizationType.HEADER)
610
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52 private Authorization authorization;
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53
626
9e733f44d8b0 Code style and comments.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 616
diff changeset
54 /**
9e733f44d8b0 Code style and comments.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 616
diff changeset
55 * The errors.
9e733f44d8b0 Code style and comments.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 616
diff changeset
56 */
610
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57 private List<ReportItem> errors;
626
9e733f44d8b0 Code style and comments.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 616
diff changeset
58
9e733f44d8b0 Code style and comments.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 616
diff changeset
59 /**
9e733f44d8b0 Code style and comments.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 616
diff changeset
60 * The warnings.
9e733f44d8b0 Code style and comments.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 616
diff changeset
61 */
610
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
62 private List<ReportItem> warnings;
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
63
626
9e733f44d8b0 Code style and comments.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 616
diff changeset
64 /**
9e733f44d8b0 Code style and comments.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 616
diff changeset
65 * The current probe id used to create child objects.
9e733f44d8b0 Code style and comments.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 616
diff changeset
66 */
615
3f57484e06f1 Updated importer: Do validation and object creation in the correct order.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 610
diff changeset
67 private Integer currentProbeId;
3f57484e06f1 Updated importer: Do validation and object creation in the correct order.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 610
diff changeset
68
610
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
69 /**
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
70 * Default constructor.
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
71 */
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
72 public LafWriter() {
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
73 errors = new ArrayList<ReportItem>();
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
74 warnings = new ArrayList<ReportItem>();
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
75 }
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
76
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
77 /**
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
78 * Write a new {@link LProbe} object to the database using
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
79 * authorization and validation.
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
80 *
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
81 * @param auth The authentication information.
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
82 * @param probe The new {@link LProbe} object.
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
83 * @return success
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
84 */
1028
1c41c7b8f7c2 Updated server application to new database model. THIS IS STILL WIP!!!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 833
diff changeset
85 public boolean writeProbe(UserInfo userInfo, Probe probe) {
1c41c7b8f7c2 Updated server application to new database model. THIS IS STILL WIP!!!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 833
diff changeset
86 if (!authorization.isAuthorized(userInfo, probe, Probe.class)) {
610
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
87 errors.add(new ReportItem("auth", "not authorized", 699));
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
88 return false;
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
89 }
1028
1c41c7b8f7c2 Updated server application to new database model. THIS IS STILL WIP!!!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 833
diff changeset
90 if (probe.getIdAlt() == null) {
610
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
91 errors.add(new ReportItem("probeId", "missing", 673));
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
92 return false;
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
93 }
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
94 try {
615
3f57484e06f1 Updated importer: Do validation and object creation in the correct order.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 610
diff changeset
95 repository.create(probe, "land");
3f57484e06f1 Updated importer: Do validation and object creation in the correct order.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 610
diff changeset
96 this.currentProbeId = probe.getId();
610
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
97 }
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
98 catch (PersistenceException e) {
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
99 errors.add(new ReportItem("probe", "writing", 670));
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
100 return false;
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
101 }
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
102 return true;
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
103 }
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
104
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
105 /**
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
106 * Write new {@link LMessung} objects to the database using
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
107 * authorization and validation.
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
108 *
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
109 * @param auth The authentication information.
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
110 * @param messungen The new {@link LMessung} objects.
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
111 * @return success
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
112 */
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
113 public boolean writeMessungen(
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
114 UserInfo userInfo,
1028
1c41c7b8f7c2 Updated server application to new database model. THIS IS STILL WIP!!!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 833
diff changeset
115 Messung messung
610
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
116 ) {
615
3f57484e06f1 Updated importer: Do validation and object creation in the correct order.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 610
diff changeset
117 messung.setProbeId(this.currentProbeId);
3f57484e06f1 Updated importer: Do validation and object creation in the correct order.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 610
diff changeset
118 repository.create(messung, "land");
610
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
119 return true;
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
120 }
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
121
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
122 /**
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
123 * Write new {@link SOrt} objects to the database.
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
124 *
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
125 * @param auth The authentication information.
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
126 * @param orte List of {@link SOrt} objects.
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
127 * @return success
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
128 */
810
092e673cbb8d Added and updated model, services, etc for to fit the new db schema.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 722
diff changeset
129 public boolean writeOrte(UserInfo userInfo, List<Ort> orte) {
610
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
130 return true;
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
131 }
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
132
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
133 /**
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
134 * Write new {@link LOrt} objects to the database using validation.
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
135 *
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
136 * @param auth The authentication information.
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
137 * @param orte List of {@link LOrt} objects.
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
138 * @return success
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
139 */
1028
1c41c7b8f7c2 Updated server application to new database model. THIS IS STILL WIP!!!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 833
diff changeset
140 public boolean writeOrtszuordung(UserInfo userInfo, Ortszuordnung ort) {
672
aeae6a81f28e Validate imported Ort objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 626
diff changeset
141 ort.setProbeId(this.currentProbeId);
aeae6a81f28e Validate imported Ort objects.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 626
diff changeset
142 repository.create(ort, "land");
610
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
143 return true;
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
144 }
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
145
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
146 /**
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
147 * Write new {@link LKommentarP} objects to the database.
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
148 *
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
149 * @param auth The authentication information.
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
150 * @param kommentare List of {@link LKommentarP} objects.
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
151 * @return success
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
152 */
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
153 public boolean writeProbenKommentare(
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
154 UserInfo userInfo,
1028
1c41c7b8f7c2 Updated server application to new database model. THIS IS STILL WIP!!!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 833
diff changeset
155 List<KommentarP> kommentare
610
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
156 ) {
1028
1c41c7b8f7c2 Updated server application to new database model. THIS IS STILL WIP!!!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 833
diff changeset
157 for(KommentarP kommentar: kommentare) {
615
3f57484e06f1 Updated importer: Do validation and object creation in the correct order.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 610
diff changeset
158 kommentar.setProbeId(this.currentProbeId);
610
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
159 repository.create(kommentar, "land");
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
160 }
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
161 return true;
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
162 }
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
163
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
164 /**
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
165 * Write new {@link LKommentarM} objects to the database.
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
166 *
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
167 * @param auth The authentication information.
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
168 * @param kommentare List of {@link LKommentarM} objects.
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
169 * @return success
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
170 */
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
171 public boolean writeMessungKommentare(
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
172 UserInfo userInfo,
1028
1c41c7b8f7c2 Updated server application to new database model. THIS IS STILL WIP!!!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 833
diff changeset
173 Map<Messung, List<KommentarM>> kommentare
610
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
174 ) {
1028
1c41c7b8f7c2 Updated server application to new database model. THIS IS STILL WIP!!!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 833
diff changeset
175 for (Messung messung : kommentare.keySet()) {
1c41c7b8f7c2 Updated server application to new database model. THIS IS STILL WIP!!!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 833
diff changeset
176 for (KommentarM kommentar: kommentare.get(messung)) {
610
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
177 kommentar.setMessungsId(messung.getId());
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
178 repository.create(kommentar, "land");
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
179 }
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
180 }
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
181 return true;
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
182 }
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
183
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
184 /**
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
185 * Write new {@link LMesswert} objects to the database using validation.
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
186 *
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
187 * @param auth The authentication information.
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
188 * @param werte List of {@link LMesswert} objects.
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
189 * @return success
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
190 */
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
191 public boolean writeMesswerte(
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
192 UserInfo userInfo,
1028
1c41c7b8f7c2 Updated server application to new database model. THIS IS STILL WIP!!!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 833
diff changeset
193 Map<Messung, List<Messwert>> werte
610
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
194 ) {
1028
1c41c7b8f7c2 Updated server application to new database model. THIS IS STILL WIP!!!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 833
diff changeset
195 for (Messung messung : werte.keySet()) {
1c41c7b8f7c2 Updated server application to new database model. THIS IS STILL WIP!!!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 833
diff changeset
196 for (Messwert messwert: werte.get(messung)) {
610
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
197 messwert.setMessungsId(messung.getId());
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
198 repository.create(messwert, "land");
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
199 }
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
200 }
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
201 return true;
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
202 }
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
203
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
204 /**
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
205 * @return the errors
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
206 */
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
207 public List<ReportItem> getErrors() {
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
208 return errors;
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
209 }
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
210
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
211 /**
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
212 * @return the warnings
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
213 */
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
214 public List<ReportItem> getWarnings() {
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
215 return warnings;
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
216 }
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
217
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
218 /**
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
219 * Reset the errors and warnings.
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
220 */
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
221 public void reset() {
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
222 this.warnings = new ArrayList<ReportItem>();
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
223 this.errors = new ArrayList<ReportItem>();
615
3f57484e06f1 Updated importer: Do validation and object creation in the correct order.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 610
diff changeset
224 this.currentProbeId = null;
610
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
225 }
374a2e78cec5 Added importer impl for laf file format.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
226 }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)