diff flys-artifacts/src/main/java/de/intevation/flys/collections/CollectionAttribute.java @ 1993:85132c9edd64

Make reuse of the old CollectionAttribute during the describe() operation of FLYSArtifactCollection - remove the old facets only. flys-artifacts/trunk@3430 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 16 Dec 2011 09:19:11 +0000
parents a7c437c9547e
children ca6ccf722c24
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/collections/CollectionAttribute.java	Fri Dec 16 07:28:17 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/collections/CollectionAttribute.java	Fri Dec 16 09:19:11 2011 +0000
@@ -58,6 +58,28 @@
     }
 
 
+    public void setSettings(String outputKey, Settings settings) {
+        if (settings == null) {
+            logger.warn("Tried to set empty Settings for '" + outputKey + "'");
+            return;
+        }
+
+        if (outputMap == null) {
+            logger.warn("Tried to add facet but no Outputs are existing yet.");
+            return;
+        }
+
+        Output output = outputMap.get(outputKey);
+
+        if (output == null) {
+            logger.warn("Tried to add facet for unknown Output: " + outputKey);
+            return;
+        }
+
+        output.setSettings(settings);
+    }
+
+
     public void addFacet(String outputKey, Facet facet) {
         if (facet == null) {
             logger.warn("Tried to add empty facet.");
@@ -87,6 +109,27 @@
     }
 
 
+    public void clearFacets(String outputKey) {
+        if (outputKey == null || outputKey.length() == 0) {
+            logger.warn("Tried to clear Facets, but no Output key specified!");
+            return;
+        }
+
+        if (outputMap == null) {
+            logger.warn("Tried to clear Facets, but no Outputs existing!");
+            return;
+        }
+
+        Output output = outputMap.get(outputKey);
+        if (output == null) {
+            logger.warn("Tried to clear Facets for unknown Out: " + outputKey);
+            return;
+        }
+
+        output.setFacets(new ArrayList<Facet>());
+    }
+
+
     public Document toXML() {
         Document doc = XMLUtils.newDocument();
 

http://dive4elements.wald.intevation.org