# HG changeset patch # User Ingo Weinzierl # Date 1311256809 0 # Node ID 79251b1d47dab9843a6c9e42d72c8d68e91ceda4 # Parent ff6ce301c4723898c27e913e0f8fb99eaec9d48a Modified the CollectionMonitor to recommend artifacts for the current state's outputs only. flys-artifacts/trunk@2385 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r ff6ce301c472 -r 79251b1d47da flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Thu Jul 21 10:45:52 2011 +0000 +++ b/flys-artifacts/ChangeLog Thu Jul 21 14:00:09 2011 +0000 @@ -1,3 +1,13 @@ +2011-07-21 Ingo Weinzierl + + * src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java: Refactored + the method that retrieves the Outputs for the Artifact. Now, we are able + to query the Outputs for the current state, and all outputs separately. + + * src/main/java/de/intevation/flys/artifacts/CollectionMonitor.java: The + recommendations provided by this monitor will take the Outputs of the + current state only into account. + 2011-07-21 Ingo Weinzierl * doc/conf/meta-data-template.xml: Added conditions for each output type. diff -r ff6ce301c472 -r 79251b1d47da flys-artifacts/src/main/java/de/intevation/flys/artifacts/CollectionMonitor.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/CollectionMonitor.java Thu Jul 21 10:45:52 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/CollectionMonitor.java Thu Jul 21 14:00:09 2011 +0000 @@ -69,7 +69,7 @@ FLYSArtifact flys, CallContext context) { - List outs = flys.getOutputs(context); + List outs = flys.getCurrentOutputs(context); String[] names = new String[outs.size()]; for (int i = 0, num = outs != null ? outs.size() : 0; i < num; i++) { diff -r ff6ce301c472 -r 79251b1d47da flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java --- 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 getOutputs(CallContext context) { - List stateIds = getPreviousStateIds(); - - DefaultState cur = (DefaultState) getCurrentState(context); - try { - if (cur.validate(this, context)) { - stateIds.add(cur.getID()); - } - } - catch (IllegalArgumentException iae) { } - + List stateIds = getPreviousStateIds(); List generated = new ArrayList(); FLYSContext flysContext = getFlysContext(context); @@ -1140,29 +1131,49 @@ for (String stateId: stateIds) { DefaultState state = (DefaultState) engine.getState(stateId); - - List list = state.getOutputs(); - if (list == null || list.size() == 0) { - logger.debug("-> No output modes for this state."); - continue; - } - - List fs = facets.get(stateId); - if (fs == null || fs.size() == 0) { - logger.debug("No facets found."); - continue; - } - - List o = generateOutputs(list, fs); - - generated.addAll(o); + generated.addAll(getOutputForState(context, state)); } + generated.addAll(getCurrentOutputs(context)); return generated; } + public List getCurrentOutputs(CallContext context) { + DefaultState cur = (DefaultState) getCurrentState(context); + + try { + if (cur.validate(this, context)) { + return getOutputForState(context, cur); + } + } + catch (IllegalArgumentException iae) { } + + return new ArrayList(); + } + + + protected List getOutputForState( + CallContext context, + DefaultState state) + { + List list = state.getOutputs(); + if (list == null || list.size() == 0) { + logger.debug("-> No output modes for this state."); + return new ArrayList(); + } + + List fs = facets.get(state.getID()); + if (fs == null || fs.size() == 0) { + logger.debug("No facets found."); + return new ArrayList(); + } + + return generateOutputs(list, fs); + } + + protected List generateOutputs(List list, List fs) { List generated = new ArrayList();