[PATCH 07 of 15] Build static facets in D4EArtifact
Wald Commits
scm-commit at wald.intevation.org
Wed Apr 30 15:30:10 CEST 2014
# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1398863874 -7200
# Node ID 4e264d6c6e0618174d274a6dfd75ed0598aab716
# Parent 2abcd7df4e5d39b64d801d713af8d69962841f40
Build static facets in D4EArtifact.
diff -r 2abcd7df4e5d -r 4e264d6c6e06 artifacts/src/main/java/org/dive4elements/river/artifacts/D4EArtifact.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/D4EArtifact.java Wed Apr 30 15:16:42 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/D4EArtifact.java Wed Apr 30 15:17:54 2014 +0200
@@ -39,6 +39,7 @@
import org.dive4elements.artifactdatabase.state.Output;
import org.dive4elements.artifactdatabase.state.State;
import org.dive4elements.artifactdatabase.state.StateEngine;
+import org.dive4elements.artifactdatabase.state.StaticFacet;
import org.dive4elements.artifactdatabase.transition.TransitionEngine;
import org.dive4elements.artifacts.Artifact;
import org.dive4elements.artifacts.ArtifactDatabase;
@@ -209,11 +210,36 @@
handleInitModel(data, context, callMeta);
+ buildStaticFacets(data, facets, callMeta);
+
filterFacets = buildFilterFacets(data);
extractOut(data);
}
+ protected void buildStaticFacets(
+ Document data,
+ List<Class> facets,
+ CallMeta callMeta)
+ {
+ List<Facet> staticFacets = new ArrayList<Facet>();
+ String currentState = getCurrentStateId();
+ for (int i = 0; i < facets.size(); i++) {
+ try {
+ StaticFacet facet = (StaticFacet)facets.get(i).newInstance();
+ facet.setup(this, data, callMeta);
+ staticFacets.add(facet);
+ }
+ catch (InstantiationException ie) {
+ log.error(ie.getLocalizedMessage(), ie);
+ }
+ catch (IllegalAccessException iae) {
+ log.error(iae.getLocalizedMessage(), iae);
+ }
+ }
+ this.facets.put(currentState, staticFacets);
+ }
+
protected void handleInitModel(Document data, Object context, CallMeta callMeta) {
RiverContext flysContext = RiverUtils.getFlysContext(context);
More information about the Dive4Elements-commits
mailing list