diff flys-artifacts/src/main/java/de/intevation/flys/collections/OutputParser.java @ 1779:2fe270661b20

Let Output and Attribute Parsers collect Facets during processing. flys-artifacts/trunk@3101 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Fri, 28 Oct 2011 09:08:48 +0000
parents e8a98eee816d
children 22732713c54d
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/collections/OutputParser.java	Fri Oct 28 09:02:48 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/collections/OutputParser.java	Fri Oct 28 09:08:48 2011 +0000
@@ -32,8 +32,12 @@
     protected CallMeta         meta;
     protected CallContext      context;
 
+    /** Map outputs name to Output. */
     protected Map<String, Output> outs;
 
+    /** Map facets name to list of Facets. */
+    protected List<Facet> facets;
+
 
     /**
      * @param db Database used to fetch artifacts, outputs and facets.
@@ -43,11 +47,12 @@
         this.meta    = context.getMeta();
         this.context = context;
         this.outs    = new HashMap<String, Output>();
+        this.facets  = new ArrayList<Facet>();
     }
 
 
     /**
-     * Gets raw facet with given id and sorts outputs in mapping.
+     * Gets raw artifact with given id and sorts outputs in mapping.
      * Converts Facets to ManagedFacets on the way.
      * @param uuid uuid of artifact to load from database.
      */
@@ -80,8 +85,9 @@
                 pos = o.getFacets().size() + 1;
             }
 
-            List<Facet> facets = facet2ManagedFacet(uuid, out.getFacets(), pos);
-            o.addFacets(facets);
+            List<Facet> mfacets = facet2ManagedFacet(uuid, out.getFacets(), pos);
+            o.addFacets(mfacets);
+            this.facets.addAll(mfacets);
         }
     }
 
@@ -94,6 +100,19 @@
     }
 
 
+    /**
+     * Access all facets.
+     */
+    public List<Facet> getFacets() {
+        return this.facets;
+    }
+
+
+    /**
+     * Creates a list of ManagedFacets from list of Facets.
+     * @param pos Position of first facet (for each other the positions
+     *            will be increased).
+     */
     protected List<Facet> facet2ManagedFacet(
         String      uuid,
         List<Facet> old,

http://dive4elements.wald.intevation.org