[PATCH] Remove boundToOut facet pass. This is now only done if we filtered before
Wald Commits
scm-commit at wald.intevation.org
Fri Oct 4 18:21:32 CEST 2013
# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1380903685 -7200
# Node ID 737dd43e32d6cc837410dfe4153ebacda52fd90b
# Parent 01deeed9d169b0ff34dfb861296ad34d24cd9307
Remove boundToOut facet pass. This is now only done if we filtered before.
diff -r 01deeed9d169 -r 737dd43e32d6 artifacts/src/main/java/org/dive4elements/river/artifacts/D4EArtifact.java
--- 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);
}
More information about the Dive4elements-commits
mailing list