Mercurial > dive4elements > river
diff flys-client/src/main/java/de/intevation/flys/client/server/MapPrintServiceImpl.java @ 5622:b28a6d05e969
Add a new mechanism in mapfish print call to add arbitary data maps
Data properties are identified by starting with mapfish-data
and they are then split in info value pairs where info
can be the description of the information and value the value
of the information to be transported in the data map.
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Tue, 09 Apr 2013 19:04:32 +0200 |
parents | 6602be8ca685 |
children | f8409fbe3b88 |
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/server/MapPrintServiceImpl.java Tue Apr 09 19:01:23 2013 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/MapPrintServiceImpl.java Tue Apr 09 19:04:32 2013 +0200 @@ -261,14 +261,34 @@ // Retrieve print settings from request Map<String, Object> pageSpecs = new HashMap<String, Object>(); + Map<String, Object> data = new HashMap<String, Object>(); + List<Object> payload = new ArrayList<Object>(); + data.put("data", payload); Enumeration<String> paramNames = req.getParameterNames(); while (paramNames.hasMoreElements()) { String paramName = paramNames.nextElement(); - if (paramName.startsWith("mapfish-")) { + 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 + String paramValue = req.getParameter(paramName); + if (paramValue != null && !paramValue.isEmpty()) { + Map<String, Object> data3 = new HashMap<String, Object>(); + data3.put("info", paramName.substring(13)); + data3.put("value", paramValue); + payload.add(data3); + } + } else if (paramName.startsWith("mapfish-")) { String paramValue = req.getParameter(paramName); pageSpecs.put(paramName.substring(8), paramValue); } } + if (!payload.isEmpty()) { + pageSpecs.put("data", data); + List<Object> columns = new ArrayList<Object>(); + columns.add("info"); + columns.add("value"); + data.put("columns", columns); + } String url = getURL();