changeset 1158:3d1b7b1586a8

Fixed deskriptoren output in json export.
author Raimund Renkert <raimund.renkert@intevation.de>
date Tue, 08 Nov 2016 17:32:02 +0100
parents 35e15ff43a3b
children 67fff2a4437e
files src/main/java/de/intevation/lada/exporter/json/JsonExporter.java
diffstat 1 files changed, 15 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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);
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)