# HG changeset patch # User Tim Englich # Date 1259683082 0 # Node ID 3eff9241ea1eb687d7711d411ca62cacbed5c459 # Parent e6e172a4915e921d5abc8019b1a1605c3f80377d Refactoring of the Transitionmodel. Now each Transition is responsible to allocate the Data which is required to describe or feed it. gnv-artifacts/trunk@390 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r e6e172a4915e -r 3eff9241ea1e gnv-artifacts/ChangeLog --- a/gnv-artifacts/ChangeLog Mon Nov 30 15:08:47 2009 +0000 +++ b/gnv-artifacts/ChangeLog Tue Dec 01 15:58:02 2009 +0000 @@ -1,3 +1,45 @@ +2009-12-01 Tim Englich + + * src/main/java/de/intevation/gnv/transition/OutputTransitionBase.java: + All Data which is required to generate the Charts is now fetched using the + Method getChartResult. The Method advance and initialize now have nothing to do. + + * src/main/java/de/intevation/gnv/transition/timeseries/TimeSeriesOutputTransition.java (out): + Removed the advance call because all Data which is required to generate the Charts is + fetched using the Method getChartResult. + * src/main/java/de/intevation/gnv/transition/profile/horizontal/NorthSouthEastWestTransition.java (initialize): + Use Method instantiate instead of Advance to add the required Data for describe + and feed this Transition. + + * src/main/java/de/intevation/gnv/transition/TransitionBase.java (initialize), + src/main/java/de/intevation/gnv/transition/Transition.java (initialize): + Added new Method Initaialize which will be callcall to Initailize the current + Transition. In this step all Data will be fetched which is required to Ddescribe and + feed each Transition. + Also the AlternativeTransition was removed because it is not longer required. + + * src/main/java/de/intevation/gnv/artifacts/fis/FISArtifact.java (advance): + Switched to the usage of the Method initialize instead of Advance while instantiating + a new Productartifact, according to the Refactoring work wich is done in the + TransitionModel. + + * src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java (initialize): + Added new Function Initialize so that it is possible to Initialize an Artifact + without doing this in the Constructor. That is nessessary because some Artifacts need + some Metadata (e.g. SourceID) befor it can be initialized. + + * doc/conf/products/verticalprofile/conf_timeseriespoint.xml, + doc/conf/products/verticalprofile/conf_mesh.xml, + doc/conf/products/verticalprofile/conf_instantaneouspoint.xml, + doc/conf/products/verticalcrosssection/conf_mesh.xml, + doc/conf/products/timeseries/conf_timeseriespoint.xml, + doc/conf/products/timeseries/conf_mesh.xml, + doc/conf/products/horizontalprofile/conf_mesh.xml, + doc/conf/products/horizontalprofile/conf_instantaneouspoint.xml, + doc/conf/products/horizontalcrosssection/conf_mesh.xml: + Some Refactoring work done according to the Refactoring Work wich + was done in the Transitionmodel. + 2009-11-30 Ingo Weinzierl * src/main/java/de/intevation/gnv/artifacts/ressource/RessourceFactory.java, diff -r e6e172a4915e -r 3eff9241ea1e gnv-artifacts/doc/conf/products/horizontalcrosssection/conf_mesh.xml --- a/gnv-artifacts/doc/conf/products/horizontalcrosssection/conf_mesh.xml Mon Nov 30 15:08:47 2009 +0000 +++ b/gnv-artifacts/doc/conf/products/horizontalcrosssection/conf_mesh.xml Tue Dec 01 15:58:02 2009 +0000 @@ -8,12 +8,15 @@ true horizontalcrosssection_subarea + horizontalcrosssection_mesh_without_geom + + subarea_filter subareaid @@ -21,28 +24,15 @@ horizontalcrosssection_mesh - - - verticalprofile_mesh - meshid - false - - horizontalcrosssection_meshpoint_depth - - - - - - - + - + verticalprofile_mesh meshid false @@ -53,6 +43,22 @@ + + + + + + verticalprofile_mesh_with_area + meshid + false + + horizontalcrosssection_meshpoint_depth + + + + + + @@ -64,8 +70,9 @@ horizontalcrosssection_meshpoint_parameter - + + @@ -80,6 +87,7 @@ + @@ -95,6 +103,7 @@ + diff -r e6e172a4915e -r 3eff9241ea1e gnv-artifacts/doc/conf/products/horizontalprofile/conf_instantaneouspoint.xml --- a/gnv-artifacts/doc/conf/products/horizontalprofile/conf_instantaneouspoint.xml Mon Nov 30 15:08:47 2009 +0000 +++ b/gnv-artifacts/doc/conf/products/horizontalprofile/conf_instantaneouspoint.xml Tue Dec 01 15:58:02 2009 +0000 @@ -8,12 +8,15 @@ true horizontalprofile_instantaneouspoint_subarea + horizontalprofile_instantaneouspoint_vehicle_without_geom + + subarea_filter subareaid @@ -21,24 +24,11 @@ horizontalprofile_instantaneouspoint_vehicle - - - horizontalprofile_instantaneouspoint_vehicle - vehicleid - false - - horizontalprofile_instantaneouspoint_cruise - - - - - - - + @@ -54,6 +44,7 @@ + @@ -68,6 +59,7 @@ + @@ -81,10 +73,25 @@ + + + horizontalprofile_instantaneouspoint_vehicle + vehicleid + false + + horizontalprofile_instantaneouspoint_cruise + + + + + + + + horizontalprofile_instantaneouspoint_cruise cruiseid @@ -96,6 +103,7 @@ + @@ -108,6 +116,7 @@ + @@ -121,6 +130,7 @@ + @@ -135,6 +145,7 @@ + @@ -150,6 +161,7 @@ + diff -r e6e172a4915e -r 3eff9241ea1e gnv-artifacts/doc/conf/products/horizontalprofile/conf_mesh.xml --- a/gnv-artifacts/doc/conf/products/horizontalprofile/conf_mesh.xml Mon Nov 30 15:08:47 2009 +0000 +++ b/gnv-artifacts/doc/conf/products/horizontalprofile/conf_mesh.xml Tue Dec 01 15:58:02 2009 +0000 @@ -8,10 +8,12 @@ true horizontalprofile_mesh_subarea + horizontalprofile_mesh_without_geom + @@ -21,27 +23,29 @@ horizontalprofile_mesh - - - verticalprofile_mesh - meshid - false - - horizontalprofile_mesh_coordinate - - - - - - - + - + + + verticalprofile_mesh + meshid + false + + horizontalprofile_mesh_coordinate + + + + + + + + + verticalprofile_mesh_with_area meshid false @@ -52,6 +56,7 @@ + @@ -64,6 +69,7 @@ + @@ -78,6 +84,7 @@ + @@ -90,6 +97,7 @@ + @@ -104,6 +112,7 @@ + @@ -121,6 +130,7 @@ + @@ -138,6 +148,7 @@ + diff -r e6e172a4915e -r 3eff9241ea1e gnv-artifacts/doc/conf/products/timeseries/conf_mesh.xml --- a/gnv-artifacts/doc/conf/products/timeseries/conf_mesh.xml Mon Nov 30 15:08:47 2009 +0000 +++ b/gnv-artifacts/doc/conf/products/timeseries/conf_mesh.xml Tue Dec 01 15:58:02 2009 +0000 @@ -8,10 +8,12 @@ true timeseries_mesh_subarea + timeseries_mesh_without_geom + @@ -21,26 +23,28 @@ timeseries_mesh - - - verticalprofile_mesh - meshid - false - - timeseries_mesh_coordinate - - - - - - - + + + + verticalprofile_mesh + meshid + false + + timeseries_mesh_coordinate + + + + + + + + verticalprofile_mesh_with_area meshid @@ -52,6 +56,7 @@ + @@ -62,7 +67,8 @@ timeseries_meshpoint - + + @@ -78,6 +84,7 @@ + @@ -92,6 +99,7 @@ + @@ -107,6 +115,7 @@ + @@ -123,6 +132,8 @@ + + diff -r e6e172a4915e -r 3eff9241ea1e gnv-artifacts/doc/conf/products/timeseries/conf_timeseriespoint.xml --- a/gnv-artifacts/doc/conf/products/timeseries/conf_timeseriespoint.xml Mon Nov 30 15:08:47 2009 +0000 +++ b/gnv-artifacts/doc/conf/products/timeseries/conf_timeseriespoint.xml Tue Dec 01 15:58:02 2009 +0000 @@ -57,6 +57,7 @@ The User / calling program can choose which Transition he/it wants to use next --> timeseries_subarea + timeseries_without_geom @@ -69,6 +70,7 @@ the Values into the SQL-Query. --> + @@ -79,29 +81,29 @@ timeseries_timeseriespoint - - - - timeseries_timeseriespoint - featureid - false - - timeseries_parameter - - - - - - - + + + + + timeseries_timeseriespoint + featureid + false + + timeseries_parameter + + + + + + + + timeseries_timeseriespoint_with_area featureid @@ -113,6 +115,7 @@ + @@ -126,6 +129,7 @@ + @@ -140,6 +144,7 @@ + @@ -154,6 +159,8 @@ + + diff -r e6e172a4915e -r 3eff9241ea1e gnv-artifacts/doc/conf/products/verticalcrosssection/conf_mesh.xml --- a/gnv-artifacts/doc/conf/products/verticalcrosssection/conf_mesh.xml Mon Nov 30 15:08:47 2009 +0000 +++ b/gnv-artifacts/doc/conf/products/verticalcrosssection/conf_mesh.xml Tue Dec 01 15:58:02 2009 +0000 @@ -8,10 +8,12 @@ true verticalcrosssection_mesh_subarea + verticalcrosssection_mesh_without_geom + @@ -21,26 +23,28 @@ verticalcrosssection_mesh - - - verticalprofile_mesh - meshid - false - - verticalcrosssection_mesh_coordinate - - - - - - - + + + + verticalprofile_mesh + meshid + false + + verticalcrosssection_mesh_coordinate + + + + + + + + verticalprofile_mesh_with_area meshid @@ -52,6 +56,7 @@ + @@ -62,8 +67,9 @@ verticalcrosssection_mesh_point - + + @@ -75,9 +81,10 @@ verticalcrosssection_mesh_axis - - + + + @@ -87,9 +94,10 @@ verticalcrosssection_mesh_parameter - - + + + @@ -104,6 +112,7 @@ + @@ -121,6 +130,7 @@ + diff -r e6e172a4915e -r 3eff9241ea1e gnv-artifacts/doc/conf/products/verticalprofile/conf_instantaneouspoint.xml --- a/gnv-artifacts/doc/conf/products/verticalprofile/conf_instantaneouspoint.xml Mon Nov 30 15:08:47 2009 +0000 +++ b/gnv-artifacts/doc/conf/products/verticalprofile/conf_instantaneouspoint.xml Tue Dec 01 15:58:02 2009 +0000 @@ -9,8 +9,9 @@ verticalprofile_instantaneouspoint_point - + + @@ -21,9 +22,10 @@ verticalprofile_instantaneouspoint_parameter - - - + + + + @@ -36,7 +38,8 @@ - + + @@ -51,6 +54,8 @@ + + diff -r e6e172a4915e -r 3eff9241ea1e gnv-artifacts/doc/conf/products/verticalprofile/conf_mesh.xml --- a/gnv-artifacts/doc/conf/products/verticalprofile/conf_mesh.xml Mon Nov 30 15:08:47 2009 +0000 +++ b/gnv-artifacts/doc/conf/products/verticalprofile/conf_mesh.xml Tue Dec 01 15:58:02 2009 +0000 @@ -8,10 +8,12 @@ true verticalprofile_mesh_subarea + verticalprofile_mesh_without_geom + @@ -21,26 +23,28 @@ verticalprofile_mesh - - - verticalprofile_mesh - meshid - false - - verticalprofile_mesh_coordinate - - - - - - - + + + + verticalprofile_mesh + meshid + false + + verticalprofile_mesh_coordinate + + + + + + + + verticalprofile_mesh_with_area meshid @@ -52,6 +56,7 @@ + @@ -62,8 +67,9 @@ verticalprofile_mesh_point - + + @@ -75,9 +81,10 @@ verticalprofile_mesh_mindepth - - + + + @@ -92,6 +99,7 @@ + @@ -107,6 +115,7 @@ + @@ -122,6 +131,7 @@ + @@ -139,6 +149,7 @@ + diff -r e6e172a4915e -r 3eff9241ea1e gnv-artifacts/doc/conf/products/verticalprofile/conf_timeseriespoint.xml --- a/gnv-artifacts/doc/conf/products/verticalprofile/conf_timeseriespoint.xml Mon Nov 30 15:08:47 2009 +0000 +++ b/gnv-artifacts/doc/conf/products/verticalprofile/conf_timeseriespoint.xml Tue Dec 01 15:58:02 2009 +0000 @@ -8,12 +8,15 @@ true verticalprofile_subarea + verticalprofile_without_geom + + subarea_filter subareaid @@ -21,26 +24,28 @@ verticalprofile_timeseriespoint - - - verticalprofile_point - featureid - false - - verticalprofile_parameter - - - - - - - + + + + verticalprofile_point + featureid + false + + verticalprofile_parameter + + + + + + + + timeseries_timeseriespoint_with_area featureid @@ -49,9 +54,10 @@ verticalprofile_parameter - + + @@ -63,8 +69,9 @@ verticalprofile_date - + + @@ -76,9 +83,10 @@ verticalprofile_minmaxdepth - - + + + @@ -90,10 +98,12 @@ verticalprofile_calculate_results - - + + - + + + @@ -101,12 +111,12 @@ verticalprofile_chart_data verticalprofile_odv_data - - - + + + - + diff -r e6e172a4915e -r 3eff9241ea1e gnv-artifacts/doc/conf/queries.properties --- a/gnv-artifacts/doc/conf/queries.properties Mon Nov 30 15:08:47 2009 +0000 +++ b/gnv-artifacts/doc/conf/queries.properties Tue Dec 01 15:58:02 2009 +0000 @@ -493,6 +493,24 @@ M.SOURCEID= ? \ ORDER BY S.DESCRIPTION +verticalprofile_instantaneouspoint_series_with_area = SELECT \ + S.SERIESID KEY, \ + S.DESCRIPTION VALUE \ + FROM MEDIAN.INSTANTANEOUSPOINT, \ + MEDIAN.SERIES S, \ + MEDIAN.MEASUREMENT M \ + WHERE S.SERIESID = MEDIAN.INSTANTANEOUSPOINT.SERIESID AND \ + MEDIAN.INSTANTANEOUSPOINT.POINTSPEC = 4 AND \ + MEDIAN.INSTANTANEOUSPOINT.FEATUREID = M.FEATUREID AND \ + M.SOURCEID= ? AND \ + INTERSECTS(SHAPE, \ + (SELECT st_astext(SHAPE) \ + FROM MEDIAN.FEATUREAREA \ + WHERE (FEATURETYPE = 7 OR FEATURETYPE = 8) AND \ + FEATURECODE = ? )\ + ) \ + ORDER BY S.DESCRIPTION + verticalprofile_instantaneouspoint_point = SELECT \ MEDIAN.INSTANTANEOUSPOINT.FEATUREID, \ to_char(MEDIAN.INSTANTANEOUSPOINT.TIMEVALUE,'DD.MM.YYYY HH24:MI') VALUE, \ diff -r e6e172a4915e -r 3eff9241ea1e gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java --- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java Mon Nov 30 15:08:47 2009 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java Tue Dec 01 15:58:02 2009 +0000 @@ -109,6 +109,10 @@ super.identifier); // 3. Umschalten auf neue Transistion this.current = nextStep; + + // 4. Initialisieren des nächsten Schrittes == Laden der Daten + this.current.initialize(super.identifier, context.getMeta()); + result = new ArtifactXMLUtilities() .createSuccessReport("Advance success", XMLUtils.newDocument()); @@ -138,6 +142,22 @@ } return result; } + + + public Document initialize (CallContext context) { + Document result = XMLUtils.newDocument(); + try { + this.current.initialize(super.identifier, context.getMeta()); + result = new ArtifactXMLUtilities() + .createSuccessReport("Initialize success", + XMLUtils.newDocument()); + } catch (TransitionException e) { + log.error(e,e); + result = new ArtifactXMLUtilities().createExceptionReport(e + .getLocalizedMessage(), XMLUtils.newDocument()); + } + return result; + } protected String readTransitionName(Document document) { String returnValue = Config.getStringXPath(document, @@ -235,6 +255,8 @@ } } + + protected Document createDescibeOutput(CallMeta callMeta, String uuid, boolean incudeUI) { log.debug("GNVArtifactBase.createDescibeOutput"); diff -r e6e172a4915e -r 3eff9241ea1e gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/fis/FISArtifact.java --- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/fis/FISArtifact.java Mon Nov 30 15:08:47 2009 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/fis/FISArtifact.java Tue Dec 01 15:58:02 2009 +0000 @@ -91,33 +91,14 @@ "action/hash/@value"); this.productArtifact = this.current.getArtifactFactory() .createArtifact(uuid, context); + Document feedDocument = xmlUtilities.reInitDocument(this .createFeedProductArtifactDocument(uuid, hash)); log.debug("Feed ==> " + this.xmlUtilities .writeDocument2String(feedDocument)); - Document descibeDocument = xmlUtilities - .reInitDocument(this. - productArtifact. - describe(xmlUtilities. - reInitDocument(this. - createDescribeRequestBody(uuid, - hash, - false)), - context)); - log.debug("Descibe ==> " - + this.xmlUtilities - .writeDocument2String(descibeDocument)); this.productArtifact.feed(feedDocument, context); - String targetName = Config.getStringXPath(descibeDocument, - "result/reachable-states/state/@name"); - Document advanceDocument = xmlUtilities.reInitDocument(this - .createAdvanceProductArtifactDocument(uuid, hash, - targetName)); - log.debug("Advance ==> " - + this.xmlUtilities - .writeDocument2String(advanceDocument)); - result = this.productArtifact.advance(advanceDocument, context); + result = ((GNVArtifactBase)this.productArtifact).initialize(context); } else { String msg = "Artifact is not configured properly. Call feed first."; log.error(msg); diff -r e6e172a4915e -r 3eff9241ea1e gnv-artifacts/src/main/java/de/intevation/gnv/transition/OutputTransitionBase.java --- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/OutputTransitionBase.java Mon Nov 30 15:08:47 2009 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/OutputTransitionBase.java Tue Dec 01 15:58:02 2009 +0000 @@ -9,6 +9,7 @@ import org.apache.log4j.Logger; +import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; @@ -116,10 +117,16 @@ @Override public void advance(String uuid, CallMeta callMeta) throws TransitionException { - log.debug("OutputTransitionBase.advance"); - if (this.getChartResult(uuid) == null) { - super.advance(uuid, callMeta); - } + } + + @Override + public void initialize(String uuid, CallMeta callMeta) + throws TransitionException { + } + + public void out(Document format, Collection inputData, + OutputStream outputStream, String uuid, CallMeta callMeta) + throws TransitionException { } /** @@ -135,15 +142,22 @@ */ protected Collection getChartResult(String uuid) { log.debug("OutputTransitionBase.getChartResult"); + Collection result = null; if (CacheFactory.getInstance().isInitialized()) { String key = uuid + super.getID(); log.debug("Hash for Queryelements: " + key); net.sf.ehcache.Element value = CacheFactory.getInstance().getCache().get(key); if (value != null) { - return (Collection) (value.getObjectValue()); + result = (Collection) (value.getObjectValue()); + }else{ + result = this.getData(this.queryID); + if (CacheFactory.getInstance().isInitialized()) { + CacheFactory.getInstance().getCache().put(new net.sf.ehcache.Element(key, result)); + } + } } - return null; + return result; } protected Object getChartFromCache(String uuid) { @@ -165,22 +179,32 @@ // TODO add Caching? I think it's not nessessary Collection returnValue = null; if (this.queryODVID != null){ + returnValue = this.getData(this.queryODVID); + }else{ + log.warn("No Query for ODV Data is defined."); + } + return returnValue; + } + + /** + * @param returnValue + * @return + */ + private Collection getData(String queryID) { + log.debug("OutputTransitionBase.getData"); + Collection returnValue = null; + try { + String[] filterValues = this.generateFilterValuesFromInputData(); try { - String[] filterValues = this.generateFilterValuesFromInputData(); - try { - QueryExecutor queryExecutor = QueryExecutorFactory - .getInstance() - .getQueryExecutor(); - returnValue = queryExecutor.executeQuery(this.queryODVID, - filterValues); - } catch (RuntimeException e) { - log.error(e, e); - } - } catch (QueryException e) { + QueryExecutor queryExecutor = QueryExecutorFactory + .getInstance() + .getQueryExecutor(); + returnValue = queryExecutor.executeQuery(queryID,filterValues); + } catch (RuntimeException e) { log.error(e, e); } - }else{ - log.warn("No Query for ODV Data is defined."); + } catch (QueryException e) { + log.error(e, e); } return returnValue; } @@ -209,21 +233,6 @@ } } - /** - * @see de.intevation.gnv.transition.TransitionBase#purifyResult(java.util.Collection, - * java.lang.String) - */ - @Override - protected void purifyResult(Collection result, String uuid) { - log.debug("OutputTransitionBase.purifyResult"); - if (CacheFactory.getInstance().isInitialized()) { - String key = uuid + super.getID(); - log.debug("Hash for Queryelements: " + key); - CacheFactory.getInstance().getCache().put(new net.sf.ehcache.Element(key, result)); - } - } - - protected void purifyChart(Object chart, String uuid) { log.debug("Prufify chart [" + uuid + "]"); CacheFactory cacheFactory = CacheFactory.getInstance(); diff -r e6e172a4915e -r 3eff9241ea1e gnv-artifacts/src/main/java/de/intevation/gnv/transition/Transition.java --- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/Transition.java Mon Nov 30 15:08:47 2009 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/Transition.java Tue Dec 01 15:58:02 2009 +0000 @@ -28,7 +28,8 @@ public String getDescription(); - public void describe(Document document, Node rootNode, CallMeta callMeta, String uuid); + public void describe(Document document, Node rootNode, + CallMeta callMeta, String uuid); public void setParent(Transition transition); @@ -37,12 +38,14 @@ public Collection getRequiredInputValues(); public void putInputData(Collection inputData, - String uuid) - throws TransitionException; + String uuid)throws TransitionException; public Collection getInputData() throws TransitionException; public void advance(String uuid, CallMeta callMeta) - throws TransitionException; + throws TransitionException; + public void initialize(String uuid, CallMeta callMeta) + throws TransitionException; + } diff -r e6e172a4915e -r 3eff9241ea1e gnv-artifacts/src/main/java/de/intevation/gnv/transition/TransitionBase.java --- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/TransitionBase.java Mon Nov 30 15:08:47 2009 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/TransitionBase.java Tue Dec 01 15:58:02 2009 +0000 @@ -46,6 +46,8 @@ */ public abstract class TransitionBase implements Transition { + + /** * The UID of this Class */ @@ -76,8 +78,6 @@ protected String queryID = null; private Collection reachableTransitions = null; - - private Transition alternativeTransition = null; protected Collection inputValueNames = null; @@ -115,7 +115,14 @@ public Collection reachableTransitions() { if (this.couldAlternativeTransitionUsed()){ - return this.alternativeTransition.reachableTransitions(); + Iterator it = this.reachableTransitions.iterator(); + String transValue = null; + while (it.hasNext()){ + transValue = it.next(); + } + Collection returnValue = new ArrayList(1); + returnValue.add(transValue); + return returnValue; }else{ return this.reachableTransitions; } @@ -127,9 +134,8 @@ */ private boolean couldAlternativeTransitionUsed() { // TODO das muss hier noch etwas freier gestaltet werden. - Object[] inputValues = this.inputValueNames.toArray(); - String key = (String)inputValues[inputValues.length-1]; - boolean returnValue= this.alternativeTransition != null && + String key = this.dataName; + boolean returnValue= /*this.alternativeTransition != null &&*/ this.inputData != null && this.inputData.containsKey(key) && this.inputData.get(key).getValue(). @@ -163,12 +169,6 @@ } - Node alternativeTransitionNode = Config.getNodeXPath(configuration, - "alternativeTransition/transition"); - if (alternativeTransitionNode != null){ - this.alternativeTransition = TransitionFactory.getInstance() - .createTransition(alternativeTransitionNode); - } NodeList inputValuesNodes = Config.getNodeSetXPath(configuration, "inputvalues/inputvalue"); this.inputValues = new HashMap(inputValuesNodes @@ -396,16 +396,12 @@ public boolean isTransitionReachable(String transitionID) { log.debug("TransitionBase.isTransitionReachable"); boolean returnValue = false; - if (this.couldAlternativeTransitionUsed()){ - return alternativeTransition.isTransitionReachable(transitionID); - }else{ - Iterator transitions = reachableTransitions.iterator(); - while (transitions.hasNext()) { - if (transitions.next().equals(transitionID)) { - log.debug("Transition " + transitionID + " wird unterstützt."); - returnValue = true; - break; - } + Iterator transitions = reachableTransitions.iterator(); + while (transitions.hasNext()) { + if (transitions.next().equals(transitionID)) { + log.debug("Transition " + transitionID + " wird unterstützt."); + returnValue = true; + break; } } return returnValue; @@ -416,34 +412,30 @@ * de.intevation.artifacts.CallMeta) */ public void advance(String uuid, CallMeta callMeta) - throws TransitionException { - log.debug("TransitionBase.advance"); - - if (this.couldAlternativeTransitionUsed()){ - this.alternativeTransition.setParent(this.getParent()); - this.alternativeTransition.putInputData(this.inputData != null ? - this.inputData.values() : - null,uuid); - this.alternativeTransition.advance(uuid, callMeta); - }else{ + throws TransitionException { + } + + public void initialize(String uuid, CallMeta callMeta) + throws TransitionException { + log.debug("TransitionBase.initialize"); + try { + String[] filterValues = this + .generateFilterValuesFromInputData(); + Collection result = null; try { - String[] filterValues = this.generateFilterValuesFromInputData(); - Collection result = null; - try { - if (this.queryID != null) { - QueryExecutor queryExecutor = QueryExecutorFactory - .getInstance().getQueryExecutor(); - result = queryExecutor.executeQuery(this.queryID, - filterValues); - } - this.purifyResult(result, uuid); - } catch (RuntimeException e) { - log.error(e, e); + if (this.queryID != null) { + QueryExecutor queryExecutor = QueryExecutorFactory + .getInstance().getQueryExecutor(); + result = queryExecutor.executeQuery(this.queryID, + filterValues); } - } catch (QueryException e) { + this.purifyResult(result, uuid); + } catch (RuntimeException e) { log.error(e, e); - throw new TransitionException(e); } + } catch (QueryException e) { + log.error(e, e); + throw new TransitionException(e); } } @@ -647,7 +639,7 @@ selectNode.appendChild(lableNode); selectNode.appendChild(choiceNode); - if (!it.hasNext()) { + if (!it.hasNext() && this.dataName != null) { dynamic.appendChild(selectNode); } else { staticNode.appendChild(selectNode); @@ -714,7 +706,7 @@ groupNode.appendChild(inputMinNode); groupNode.appendChild(inputMaxNode); - if (!it.hasNext()) { + if (!it.hasNext() && this.dataName != null) { dynamic.appendChild(groupNode); } else { staticNode.appendChild(groupNode); @@ -750,7 +742,7 @@ inputNode.appendChild(inputValueNode); groupNode.appendChild(inputNode); - if (!it.hasNext()) { + if (!it.hasNext() && this.dataName != null) { dynamic.appendChild(groupNode); } else { staticNode.appendChild(groupNode); @@ -792,10 +784,6 @@ * @see de.intevation.gnv.transition.Transition#getInputData() */ public Collection getInputData() throws TransitionException { - if (this.couldAlternativeTransitionUsed()){ - return this.alternativeTransition.getInputData(); - }else{ - return this.inputData != null ? this.inputData.values() : null; - } + return this.inputData != null ? this.inputData.values() : null; } } diff -r e6e172a4915e -r 3eff9241ea1e gnv-artifacts/src/main/java/de/intevation/gnv/transition/profile/horizontal/NorthSouthEastWestTransition.java --- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/profile/horizontal/NorthSouthEastWestTransition.java Mon Nov 30 15:08:47 2009 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/profile/horizontal/NorthSouthEastWestTransition.java Tue Dec 01 15:58:02 2009 +0000 @@ -22,6 +22,7 @@ */ public class NorthSouthEastWestTransition extends TransitionBase { + /** * The UID of this Class */ @@ -34,12 +35,18 @@ } /** - * @see de.intevation.gnv.transition.TransitionBase#advance(java.lang.String, - * de.intevation.artifacts.CallMeta) + * @see de.intevation.gnv.transition.TransitionBase#purifyResult(java.util.Collection, java.lang.String) */ @Override - public void advance(String uuid, CallMeta callMeta) - throws TransitionException { + protected void purifyResult(Collection result, String uuid) { + } + + /** + * @see de.intevation.gnv.transition.TransitionBase#initialize(java.lang.String, de.intevation.artifacts.CallMeta) + */ + @Override + public void initialize(String uuid, CallMeta callMeta) + throws TransitionException { Collection describeData = this.getDescibeData(uuid); if (describeData == null) { describeData = new ArrayList(); @@ -56,9 +63,5 @@ describeData.add(keyValueDescibeData); } - @Override - protected void purifyResult(Collection result, String uuid) { - - } } diff -r e6e172a4915e -r 3eff9241ea1e gnv-artifacts/src/main/java/de/intevation/gnv/transition/timeseries/TimeSeriesOutputTransition.java --- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/timeseries/TimeSeriesOutputTransition.java Mon Nov 30 15:08:47 2009 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/timeseries/TimeSeriesOutputTransition.java Tue Dec 01 15:58:02 2009 +0000 @@ -190,9 +190,6 @@ ); try { - - this.advance(uuid, callMeta); // TODO This hsould only be done if it is nessessary - if (outputMode.equalsIgnoreCase("chart")) { log.debug("Chart will be generated."); int chartWidth = 600;