Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java @ 965:79251b1d47da
Modified the CollectionMonitor to recommend artifacts for the current state's outputs only.
flys-artifacts/trunk@2385 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 21 Jul 2011 14:00:09 +0000 |
parents | 92027887775a |
children | 799c7108ea6d |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java Thu Jul 21 10:45:52 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java Thu Jul 21 14:00:09 2011 +0000 @@ -1122,16 +1122,7 @@ public List<Output> getOutputs(CallContext context) { - List<String> stateIds = getPreviousStateIds(); - - DefaultState cur = (DefaultState) getCurrentState(context); - try { - if (cur.validate(this, context)) { - stateIds.add(cur.getID()); - } - } - catch (IllegalArgumentException iae) { } - + List<String> stateIds = getPreviousStateIds(); List<Output> generated = new ArrayList<Output>(); FLYSContext flysContext = getFlysContext(context); @@ -1140,29 +1131,49 @@ for (String stateId: stateIds) { DefaultState state = (DefaultState) engine.getState(stateId); - - List<Output> list = state.getOutputs(); - if (list == null || list.size() == 0) { - logger.debug("-> No output modes for this state."); - continue; - } - - List<Facet> fs = facets.get(stateId); - if (fs == null || fs.size() == 0) { - logger.debug("No facets found."); - continue; - } - - List<Output> o = generateOutputs(list, fs); - - generated.addAll(o); + generated.addAll(getOutputForState(context, state)); } + generated.addAll(getCurrentOutputs(context)); return generated; } + public List<Output> getCurrentOutputs(CallContext context) { + DefaultState cur = (DefaultState) getCurrentState(context); + + try { + if (cur.validate(this, context)) { + return getOutputForState(context, cur); + } + } + catch (IllegalArgumentException iae) { } + + return new ArrayList<Output>(); + } + + + protected List<Output> getOutputForState( + CallContext context, + DefaultState state) + { + List<Output> list = state.getOutputs(); + if (list == null || list.size() == 0) { + logger.debug("-> No output modes for this state."); + return new ArrayList<Output>(); + } + + List<Facet> fs = facets.get(state.getID()); + if (fs == null || fs.size() == 0) { + logger.debug("No facets found."); + return new ArrayList<Output>(); + } + + return generateOutputs(list, fs); + } + + protected List<Output> generateOutputs(List<Output> list, List<Facet> fs) { List<Output> generated = new ArrayList<Output>();