Mercurial > dive4elements > river
changeset 2079:ca6ccf722c24
#447 removed empty Outputs from Collection's attribute.
flys-artifacts/trunk@3595 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 05 Jan 2012 13:39:58 +0000 (2012-01-05) |
parents | cbeeaaad1056 |
children | 0553e31d25e7 |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/collections/AttributeWriter.java flys-artifacts/src/main/java/de/intevation/flys/collections/CollectionAttribute.java |
diffstat | 3 files changed, 38 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Thu Jan 05 10:46:32 2012 +0000 +++ b/flys-artifacts/ChangeLog Thu Jan 05 13:39:58 2012 +0000 @@ -1,3 +1,15 @@ +2012-01-05 Ingo Weinzierl <ingo@intevation.de> + + flys/issue447 (W-Differenzen: Fehler beim Hinzuf�gen einer Parameterisierung) + + * src/main/java/de/intevation/flys/collections/CollectionAttribute.java: + Added a new method cleanEmptyOutputs() which removes Outputs that have + no Facets set. + + * src/main/java/de/intevation/flys/collections/AttributeWriter.java: Call + CollectionAttribute.cleanEmptyOutputs() at the end of write() to remove + empty Outputs that have been added during the merge process. + 2012-01-05 Ingo Weinzierl <ingo@intevation.de> flys/issue440 (Karte: WSPLGEN Berechnungen f�r Mosel schlagen fehl)
--- a/flys-artifacts/src/main/java/de/intevation/flys/collections/AttributeWriter.java Thu Jan 05 10:46:32 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/collections/AttributeWriter.java Thu Jan 05 13:39:58 2012 +0000 @@ -103,6 +103,9 @@ writeOutput(a.getName(), newFacets, oldFacets); } + // THIS CALL IS ABSOLUTELY NECESSARY! + attribute.cleanEmptyOutputs(); + return attribute; }
--- a/flys-artifacts/src/main/java/de/intevation/flys/collections/CollectionAttribute.java Thu Jan 05 10:46:32 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/collections/CollectionAttribute.java Thu Jan 05 13:39:58 2012 +0000 @@ -58,6 +58,29 @@ } + public void cleanEmptyOutputs() { + if (outputMap == null) { + return; + } + + List<String> removeUs = new ArrayList<String>(); + + Set<Map.Entry<String, Output>> entries = outputMap.entrySet(); + for (Map.Entry<String, Output> entry: entries) { + Output o = entry.getValue(); + + List<Facet> facets = o.getFacets(); + if (facets == null || facets.isEmpty()) { + removeUs.add(entry.getKey()); + } + } + + for (String key: removeUs) { + outputMap.remove(key); + } + } + + public void setSettings(String outputKey, Settings settings) { if (settings == null) { logger.warn("Tried to set empty Settings for '" + outputKey + "'");