# HG changeset patch # User Andre Heinecke # Date 1365764326 -7200 # Node ID 413798463dfe823f3c2c6cb028178207f45d9344 # Parent f8409fbe3b888b477342faaae48dbbd3e9d8ed75 Do ordering in the data dictionary and replace "null" strings with empty strings diff -r f8409fbe3b88 -r 413798463dfe flys-client/src/main/java/de/intevation/flys/client/server/MapPrintServiceImpl.java --- a/flys-client/src/main/java/de/intevation/flys/client/server/MapPrintServiceImpl.java Fri Apr 12 12:57:57 2013 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/MapPrintServiceImpl.java Fri Apr 12 12:58:46 2013 +0200 @@ -266,21 +266,34 @@ Map data = new HashMap(); List payload = new ArrayList(); data.put("data", payload); - Enumeration paramNames = req.getParameterNames(); - while (paramNames.hasMoreElements()) { - String paramName = paramNames.nextElement(); - if (paramName.startsWith("mapfish-data-")) { - // You can add mapfish-data variables that will be mapped + Enumeration paramNames = req.getParameterNames(); + List params = Collections.list(paramNames); + Collections.sort(params); + for (String paramName : params) { + if (paramName.startsWith("mapfish_data_")) { + // You can add mapfish_data variables that will be mapped // to a info value pairs to provide meta data for the map + // The the info part starts with a number for sorting that + // number will be stripped String paramValue = req.getParameter(paramName); - if (paramValue != null && !paramValue.isEmpty()) { - Map data3 = new HashMap(); + Map data3 = new HashMap(); + int order = 0; + try { + order = Integer.parseInt(paramName.substring(13, 14)); + data3.put("info", paramName.substring(14)); + } catch (NumberFormatException nfe) { data3.put("info", paramName.substring(13)); - data3.put("value", paramValue); payload.add(data3); } - } else if (paramName.startsWith("mapfish-")) { + if (paramValue.equals("null")) + data3.put("value", ""); + else + data3.put("value", paramValue); + payload.add(data3); + } else if (paramName.startsWith("mapfish_")) { String paramValue = req.getParameter(paramName); + if (paramValue.equals("null") + paramValue = ""; pageSpecs.put(paramName.substring(8), paramValue); } }