Mercurial > dive4elements > river
changeset 7244:737dd43e32d6
Remove boundToOut facet pass. This is now only done if we filtered before.
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Fri, 04 Oct 2013 18:21:25 +0200 |
parents | 01deeed9d169 |
children | 965dbf2d4c44 |
files | artifacts/src/main/java/org/dive4elements/river/artifacts/D4EArtifact.java |
diffstat | 1 files changed, 21 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/D4EArtifact.java Fri Oct 04 18:00:29 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/D4EArtifact.java Fri Oct 04 18:21:25 2013 +0200 @@ -1296,20 +1296,34 @@ return gen; } + /** If we use a facet filter that bases the list of compatible facets + * on the output this artifact is bound to then this returns true */ + public boolean usesOutputFacetFilter() { + if (boundToOut == null || boundToOut.isEmpty()) { + return false; + } + + FacetFilter facetFilter = + (FacetFilter)RiverContextFactory.getGlobalContext() + .get(RiverContext.FACETFILTER_KEY); + if (facetFilter == null) { + return false; + } + + return true; + } + /** If a global facet filter and a bounded out are defined * use them to eliminate unwished facets. */ protected List<Facet> filterFacets(List<Facet> facets) { - if (boundToOut == null || boundToOut.isEmpty()) { + if (!usesOutputFacetFilter()) { return facets; } FacetFilter facetFilter = (FacetFilter)RiverContextFactory.getGlobalContext() .get(RiverContext.FACETFILTER_KEY); - if (facetFilter == null) { - return facets; - } List<Facet> result = new ArrayList<Facet>(facets.size()); for (Facet facet: facets) { @@ -1356,13 +1370,9 @@ String type = f.getName(); /* Match the facets to the output configuration. - * This is only done when we are not already bound to an out. - * If we are bound we come from the datacage so the user has - * explicitly requested our nice and shiny facets. And who - * are we to deny them to him. */ - if (outTypes.contains(type) || - (boundToOut != null && - boundToOut.equals(outName))) { + * This is only done when we are not using the Output + * we are bound to to determine the compatible facets. */ + if (outTypes.contains(type) || usesOutputFacetFilter()) { if (debug) { log.debug("Add facet " + f); }