[Lada-commits] [PATCH] Fixed deskriptoren output in json export
Wald Commits
scm-commit at wald.intevation.org
Tue Nov 8 17:32:06 CET 2016
# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1478622722 -3600
# Node ID 3d1b7b1586a8f91f94fb3e59593e8b8db36954dd
# Parent 35e15ff43a3b55e8baf62f4b2e8e672c7a1901f9
Fixed deskriptoren output in json export.
diff -r 35e15ff43a3b -r 3d1b7b1586a8 src/main/java/de/intevation/lada/exporter/json/JsonExporter.java
--- a/src/main/java/de/intevation/lada/exporter/json/JsonExporter.java Tue Nov 08 16:55:14 2016 +0100
+++ b/src/main/java/de/intevation/lada/exporter/json/JsonExporter.java Tue Nov 08 17:32:02 2016 +0100
@@ -247,21 +247,32 @@
);
int vorgaenger = 0;
ObjectNode node = new ObjectNode(JsonNodeFactory.instance);
+ boolean isZebs = Integer.parseInt(parts[1]) == 1;
+ int hdV = 0;
+ int ndV = 0;
for (int i = 0; i < parts.length - 1; i++) {
- logger.debug("ebene: " + i);
- logger.debug("sn: " + Integer.parseInt(parts[i+1]));
String beschreibung = "";
if (Integer.parseInt(parts[i+1]) != 0) {
builder.and("ebene", i);
builder.and("sn", Integer.parseInt(parts[i+1]));
- logger.debug(vorgaenger);
if (vorgaenger != 0) {
builder.and("vorgaenger", vorgaenger);
}
List<Deskriptoren> found = repository.filterPlain(builder.getQuery(), "stamm");
if (found.size() > 0) {
beschreibung = found.get(0).getBeschreibung();
- vorgaenger = found.get(0).getId();
+ if (isZebs && i < 4) {
+ vorgaenger = hdV;
+ }
+ else if (!isZebs && i < 2) {
+ vorgaenger = hdV;
+ }
+ else {
+ vorgaenger = ndV;
+ }
+ if (i == 1) {
+ ndV = found.get(0).getId();
+ }
}
}
node.put("S" + i, beschreibung);
More information about the Lada-commits
mailing list