Mercurial > dive4elements > river
changeset 7845:4e264d6c6e06
Build static facets in D4EArtifact.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Wed, 30 Apr 2014 15:17:54 +0200 |
parents | 2abcd7df4e5d |
children | e84726b48484 |
files | artifacts/src/main/java/org/dive4elements/river/artifacts/D4EArtifact.java |
diffstat | 1 files changed, 26 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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);