comparison artifacts/src/main/java/org/dive4elements/river/artifacts/D4EArtifact.java @ 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 744df5a03337
children 965dbf2d4c44
comparison
equal deleted inserted replaced
7243:01deeed9d169 7244:737dd43e32d6
1294 } 1294 }
1295 1295
1296 return gen; 1296 return gen;
1297 } 1297 }
1298 1298
1299 /** If a global facet filter and a bounded out are defined 1299 /** If we use a facet filter that bases the list of compatible facets
1300 * use them to eliminate unwished facets. 1300 * on the output this artifact is bound to then this returns true */
1301 */ 1301 public boolean usesOutputFacetFilter() {
1302 protected List<Facet> filterFacets(List<Facet> facets) {
1303 if (boundToOut == null || boundToOut.isEmpty()) { 1302 if (boundToOut == null || boundToOut.isEmpty()) {
1304 return facets; 1303 return false;
1305 } 1304 }
1306 1305
1307 FacetFilter facetFilter = 1306 FacetFilter facetFilter =
1308 (FacetFilter)RiverContextFactory.getGlobalContext() 1307 (FacetFilter)RiverContextFactory.getGlobalContext()
1309 .get(RiverContext.FACETFILTER_KEY); 1308 .get(RiverContext.FACETFILTER_KEY);
1310 if (facetFilter == null) { 1309 if (facetFilter == null) {
1310 return false;
1311 }
1312
1313 return true;
1314 }
1315
1316 /** If a global facet filter and a bounded out are defined
1317 * use them to eliminate unwished facets.
1318 */
1319 protected List<Facet> filterFacets(List<Facet> facets) {
1320 if (!usesOutputFacetFilter()) {
1311 return facets; 1321 return facets;
1312 } 1322 }
1323
1324 FacetFilter facetFilter =
1325 (FacetFilter)RiverContextFactory.getGlobalContext()
1326 .get(RiverContext.FACETFILTER_KEY);
1313 1327
1314 List<Facet> result = new ArrayList<Facet>(facets.size()); 1328 List<Facet> result = new ArrayList<Facet>(facets.size());
1315 for (Facet facet: facets) { 1329 for (Facet facet: facets) {
1316 if (facetFilter.accept(boundToOut, facet.getName())) { 1330 if (facetFilter.accept(boundToOut, facet.getName())) {
1317 result.add(facet); 1331 result.add(facet);
1354 boolean facetAdded = false; 1368 boolean facetAdded = false;
1355 for (Facet f: fs) { 1369 for (Facet f: fs) {
1356 String type = f.getName(); 1370 String type = f.getName();
1357 1371
1358 /* Match the facets to the output configuration. 1372 /* Match the facets to the output configuration.
1359 * This is only done when we are not already bound to an out. 1373 * This is only done when we are not using the Output
1360 * If we are bound we come from the datacage so the user has 1374 * we are bound to to determine the compatible facets. */
1361 * explicitly requested our nice and shiny facets. And who 1375 if (outTypes.contains(type) || usesOutputFacetFilter()) {
1362 * are we to deny them to him. */
1363 if (outTypes.contains(type) ||
1364 (boundToOut != null &&
1365 boundToOut.equals(outName))) {
1366 if (debug) { 1376 if (debug) {
1367 log.debug("Add facet " + f); 1377 log.debug("Add facet " + f);
1368 } 1378 }
1369 facetAdded = true; 1379 facetAdded = true;
1370 o.addFacet(f); 1380 o.addFacet(f);

http://dive4elements.wald.intevation.org