Mercurial > dive4elements > gnv-client
changeset 804:9058c08eac3a
Added more Javadoc in some classes of state.profile.
gnv-artifacts/trunk@886 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 08 Apr 2010 10:10:04 +0000 |
parents | feae2f9d6c6f |
children | bb7afd783321 |
files | gnv-artifacts/ChangeLog gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileOutputState.java gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/OutputHelper.java gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java |
diffstat | 6 files changed, 510 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/gnv-artifacts/ChangeLog Wed Apr 07 07:52:27 2010 +0000 +++ b/gnv-artifacts/ChangeLog Thu Apr 08 10:10:04 2010 +0000 @@ -1,3 +1,12 @@ +2010-04-08 Ingo Weinzierl <ingo.weinzierl@intevation.de> + + * src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java, + src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/OutputHelper.java, + src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java, + src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileOutputState.java, + src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java: + Added Javadoc. + 2010-04-07 Sascha L. Teichmann <sascha.teichmann@intevation.de> * src/main/java/de/intevation/gnv/**/*.java:
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java Wed Apr 07 07:52:27 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java Thu Apr 08 10:10:04 2010 +0000 @@ -92,8 +92,16 @@ public static final boolean USE_INDEX_BUFFER = Boolean.getBoolean("gnv.horizontal.cross.section.mesh.index.buffer"); + /** + * Shapefile name for isolines. + */ public static final String ISOLINES_NAME = "isolines.shp"; + + /** + * Shapefile name for polygons. + */ public static final String POLYGON_NAME = "polygons.shp"; + public static final String LAYER_MODEL = "horizontalcrosssection"; private String ijkQueryID; @@ -108,6 +116,7 @@ public HorizontalCrossSectionMeshOutputState() { } + @Override public void initialize(String uuid, CallContext callContext) throws StateException { super.initialize(uuid, callContext); @@ -118,18 +127,33 @@ getResult(uuid, callContext); } + /** + * Returns the shapefile directory path. + * + * @return the shapefile path. + */ public String getShapeFilePath() { synchronized (shapeFileLock) { return shapeFilePath; } } + /** + * Set the shapefile path. + * + * @param shapeFilePath Destination path to write shapefiles. + */ public void setShapeFilePath(String shapeFilePath) { synchronized (shapeFileLock) { this.shapeFilePath = shapeFilePath; } } + /** + * Method to reset the shapefile path. + * + * @return the old path. + */ public String resetShapeFilePath() { synchronized (shapeFileLock) { String path = shapeFilePath; @@ -138,11 +162,20 @@ } } + + /** + * This method removes all shapefiles which might have been written by this + * artifact and resets the shapefile path. + * + * @param globalContext CallContext + */ + @Override public void endOfLife(Object globalContext) { super.endOfLife(globalContext); // do it in background new Thread() { + @Override public void run() { // TODO: Do the un-publishing WMS stuff. String path = resetShapeFilePath(); @@ -171,6 +204,23 @@ }.start(); } + + /** + * This out target has two options:<br> + * <ol> + * <li>zip: Write the resulting data to shapefiles and export them as + * zip-archive.</li> + * <li>wms: Write the resulting data to shapefiles and feed a map service + * with a layer displaying these shapefiles.</li> + * </ol> + * + * @param format + * @param inputData + * @param outputStream + * @param uuid + * @param callContext + * @throws StateException + */ public void out( Document format, Collection<InputData> inputData, @@ -206,6 +256,15 @@ } } + /** + * Create a zip archive with the shapefiles of the given shapefiles path and + * write it to <code>output</code>. + * + * @param uuid The UUID of the current artifact. + * @param callContext The CallContext object. + * @param output The output stream. + * @throws StateException if an error occured while zipfile creation. + */ protected void writeZip( String uuid, CallContext callContext, @@ -236,6 +295,18 @@ } } + /** + * Write data to shapefiles and feed a map service with information about + * these shapefiles. The map service can be queried for displaying + * corresponding layers as WMS. + * + * @param uuid The UUID of the current artifact. + * @param callContext The CallContext object. + * @param inputData A collection with some input data. + * @return a document with some meta information (shapefile path, geometry + * type, time to live of the current artifact, etc). + * @throws StateException if an error occured while shapefile writing. + */ protected Document getWMS( String uuid, CallContext callContext, @@ -312,6 +383,13 @@ return document; } + /** + * Find the parameter name which is used during mapfile creation in + * MapfileGenerator. + * + * @param callContext The CallContext object. + * @return the parameter name of the current parameterization. + */ protected String findParameterType(CallContext callContext) { InputData inputParam = inputData.get("parameterid"); @@ -330,6 +408,12 @@ } + /** + * Find the title for a wms layer specified by the user. + * + * @param inputData A collection with InputData objects. + * @return the title. + */ protected String getLayerTitle(Collection<InputData> inputData) { for (InputData data: inputData) { String name = data.getName(); @@ -341,6 +425,14 @@ return null; } + /** + * Write the resulting data to shapefiles. + * + * @param uuid The UUID of the current artifact. + * @param result The finalized data used for shapefile creation. + * @param callContext The CallContext object. + * @return the shapefile path. + */ protected String writeToShapeFile( String uuid, AttributedPoint2ds result, @@ -411,6 +503,14 @@ } + /** + * Return the processed results ready for being written to shapefile. + * + * @param uuid The UUID of the current artifacts. + * @param callContext The CallContext object. + * @return the processed data. + * @throws StateException if an error occured while processing data. + */ protected AttributedPoint2ds getResult(String uuid, CallContext callContext) throws StateException { @@ -433,6 +533,14 @@ return result; } + /** + * Query the database for result data and turn it into a useful format to + * write this data into shapefiles. + * + * @param callContext The CallContext object. + * @return the processed data. + * @throws StateException if an error occured while processing data. + */ protected AttributedPoint2ds produceResult(CallContext callContext) throws StateException { @@ -502,6 +610,13 @@ throw new StateException("no result produced"); } + /** + * First step of finalizing the data returned from database. + * + * @param results Resulting data from database. + * @return the pre-processed data which is still not useful for being + * written to shapefiles. + */ public AttributedPoint2ds preProcess(Collection<Result> results) { boolean debug = log.isDebugEnabled(); @@ -567,6 +682,16 @@ return ap2ds; } + /** + * The last step of finalizing the data. The returned data is useful for + * shapefile creation. + * + * @param boundingBox The bounding box. + * @param polygon A polygon. + * @param callContext CallContext. + * @param input The pre-processed data. + * @return the finalized data ready for shapefile creation. + */ public AttributedPoint2ds process( Envelope boundingBox, Polygon polygon,
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileOutputState.java Wed Apr 07 07:52:27 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileOutputState.java Thu Apr 08 10:10:04 2010 +0000 @@ -100,7 +100,7 @@ .getLogger(TimeSeriesOutputState.class); /** - * Constructor + * Creates a new VerticalProfileOutputState object. */ public VerticalProfileOutputState() { super(); @@ -156,6 +156,15 @@ } + /** + * Creates a csv file of the resulting data and writes it to output stream. + * + * @param out The output stream. + * @param results The data used to create the csv file. + * @throws UnsupportedEncodingException if the encoding is not supported. + * @throws IOException if an error occured while writing to output stream. + * @throws StateException if an error occured while creating the csv file. + */ @Override protected void createCSV(OutputStream out, Collection<Result> results) throws UnsupportedEncodingException, IOException, StateException @@ -211,18 +220,16 @@ } + @Override protected String createChartSubtitle(Locale locale, String uuid) { return getSelectedFeatureName(uuid); } - - /** - * @see de.intevation.gnv.state.timeseries.TimeSeriesOutputState#getStatisticsGenerator() - */ @Override protected Statistics getStatisticsGenerator() { return new VerticalProfileStatistics(); } } +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : \ No newline at end of file
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/OutputHelper.java Wed Apr 07 07:52:27 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/OutputHelper.java Thu Apr 08 10:10:04 2010 +0000 @@ -21,6 +21,16 @@ private OutputHelper() { } + + /** + * Creates a PolygonSeries representing the seabed used to be displayed in a + * 2D-chart. + * + * @param interpolation The interpolation which supports information about + * the max depth, the cell width and height. + * @param fill The fill color as integer. + * @return a PolygonSeries representing the seabed. + */ public static PolygonSeries createSeabedPolygon( Interpolation3D interpolation, Integer fill
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java Wed Apr 07 07:52:27 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java Thu Apr 08 10:10:04 2010 +0000 @@ -197,6 +197,13 @@ } + /** + * Retrieves the data used to create a VerticalCrossProfileChart. + * + * @param uuid The UUID of the current artifact. + * @param callContext The CallContext object. + * @return the data used to create a VerticalCrossProfileChart. + */ protected Object getData(String uuid, CallContext callContext) { Collection<Result> result = null; InputData meshLine = inputData.get("mesh_linestring"); @@ -251,6 +258,7 @@ } + @Override protected String getSelectedInputDataName(String uuid, String id) { Collection values = getCollection(id, uuid); @@ -325,6 +333,16 @@ public static final double EPSILON = 1e-5d; + + /** + * Finalize the data used for chart generation. Isolines are added, colors + * are assigned to polygons and the seabed is added. + * + * @param path The path which have been inserted while parameterization. + * @param columns The data used to be displayed in a 2D chart. + * @param callContext The CallContext object. + * @return the finalized data ready for chart generation. + */ protected Object process( List<Coordinate> path, AttributedXYColumns columns, @@ -477,6 +495,13 @@ } + /** + * Pre-process the data returned by database query. The resulting data is + * not ready for chart creation! + * + * @param results Data returned by database. + * @return Pre-processed data which is not ready for chart creation yet. + */ protected AttributedXYColumns preProcess(Collection results) { AttributedXYColumns attColumns = new AttributedXYColumns(); @@ -542,6 +567,26 @@ } + /** + * This <code>getChart</code> method returns a 2D VerticalCrossSectionChart + * displaying polygon data with isolines and a legend describing the colors + * used in that chart. + * + * @param chartLables Labels used to decorate the chart. + * @param theme The theme used to adjust the look of the chart. + * @param parameters A collection with parameters this chart contains. + * @param measurements A collection with measurement this chart contains. + * @param dates A collection with dates this chart contains. + * @param result The data collection used to be displayed in this chart. + * @param locale The Locale used to determine the language. + * @param uuid The uuid of the current artifact. + * @param linesVisible A boolean property to determine the visibility of + * lines connecting two points in a chart (not used in this chart type). + * @param shapesVisible A boolean property to determine the visiblity of + * datapoints in this chart (not used in this chart type). + * @param callContext The CallContext object. + * @return a 2D chart representing the data as polygons. + */ @Override protected Chart getChart( ChartLabels chartLables, @@ -614,16 +659,22 @@ return chart; } - /** - * @see de.intevation.gnv.state.timeseries.TimeSeriesOutputState#getStatisticsGenerator() - */ + @Override protected Statistics getStatisticsGenerator() { return new VerticalCrossSectionStatistics(); } /** - * @see de.intevation.gnv.state.timeseries.TimeSeriesOutputState#createCSV(java.io.OutputStream, java.util.Collection) + * Nothing happens here. <b>This method should never be called</b> until + * there is a wise implementation of a csv representation of the polygon + * data. + * + * @param outputStream The output stream used to write the csv file to. + * @param chartResult The data used to be written to csv file. + * @throws UnsupportedEncodingException if the encoding is not supported. + * @throws IOException if an error occured while writing to output stream. + * @throws StateException if an error occured while csv file creation. */ @Override protected void createCSV(
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java Wed Apr 07 07:52:27 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java Thu Apr 08 10:10:04 2010 +0000 @@ -86,12 +86,29 @@ */ public class TimeSeriesOutputState extends OutputStateBase { + /** + * A boolean property to enable caching of charts after they have been + * created. This property can be adjusted via system property 'cache.chart'. + * 'true' of 'false' are valid options - defaults to 'false'.<br> + * <b>NOTE:</b> If chart caching is enabled, charts aren't sensible to + * changes in the parameterization anymore, after a first chart has been + * created for an artifact. + */ protected static final boolean CACHE_CHART = Boolean.parseBoolean(System.getProperty("cache.chart", "false")); + /** + * A field parsing a system property to adjust the alignment of pdf exports. + * The system property is 'export.pdf.landscape' and should be true or + * false. If this property is true, PDFs will be created in landscape + * format. + */ protected static final boolean PDF_FORMAT_LANDSCAPE = Boolean.parseBoolean(System.getProperty("export.pdf.landscape","true")); + /** + * Supported image export formats. + */ protected static final String[] IMG_EXPORT_FORMAT = { "PNG", "JPEG", "GIF" }; @@ -109,6 +126,9 @@ private List<TimeGap> timeGapDefinitions = null; + /** + * Key in resource bundle the x-axis title is stored. + */ protected String domainLable = "chart.timeseries.title.xaxis"; protected String featureValuesName = "featureid"; @@ -116,6 +136,10 @@ protected String measuremenValueName = "measurementid"; protected String dateValueName = "dateid"; + + /** + * Array used to specify the columns used in csv exports. + */ public static final String [] TIMESERIES_CSV_PROFILE_COLUMNS = { "XORDINATE", "YORDINATE", @@ -125,6 +149,9 @@ }; + /** + * Column labels used in csv exports. + */ public static final String [] TIMESERIES_TIMESERIES_CSV_COLUMN_LABEL = { "Date/Time", "Value", @@ -133,6 +160,10 @@ "TimeseriesID" }; + + /** + * Array used to specify the column in csv exports on meshes. + */ public static final String [] TIMESERIES_MESH_CSV_COLUMN_LABEL = { "Date/Time", "Value", @@ -141,6 +172,10 @@ "MeshID" }; + + /** + * Array used to specify the columns in odv exports. + */ public static final String [] TIMESERIES_ODV_PROFILE_NAMES = { "CRUISE", "STATION", @@ -153,6 +188,9 @@ }; + /** + * Column labels used in odv exports. + */ public static final String [] ODV_COLUMN_HEADER = { "Cruise", "Station", @@ -165,6 +203,7 @@ "QF" }; + /** * Profile for exporting data to odv */ @@ -185,6 +224,16 @@ } + /** + * Calls <code>getChartResult</code> which puts the data used for chart + * creation into cache. This redruces waiting periods after selecting an + * output type. + * + * @param uuid The UUID of the current artifact. + * @param context The CallContext object. + * @throws StateException if an error occured while fetching the data used + * for chart creation. + */ @Override public void initialize(String uuid, CallContext context) throws StateException @@ -194,9 +243,39 @@ /** - * @see de.intevation.gnv.transition.OutputTransition#out(java.lang.String, - * java.util.Collection, java.io.OutputStream, java.lang.String, - * de.intevation.artifacts.CallMeta) + * This out target has following modes:<br> + * <ol> + * <li>chart: Creates a chart displaying the data corresponding to the + * current parameterization. A chart has following export modes:<br> + * <ol> + * <li>img: Image representation of a chart.</li> + * <li>pdf: PDF representation of a chart.</li> + * <li>svg: SVG representation of a chart.</li> + * </ol> + * All selected parameters are drawn into a single chart.<br> + * </li> + * <li>histogram: Creates a histogram displaying the data corresponding to + * the current parameterization. A histogram has following export modes:<br> + * <ol> + * <li>img: Image representation of a histogram.</li> + * <li>pdf: PDF representation of a histogram.</li> + * <li>svg: SVG representation of a histogram.</li> + * </ol> + * A single histogram is created for each selected parameter.<br> + * </li> + * <li>statistic: Creates a statistic with important figures.</li> + * <li>csv: Creates a csv file.</li> + * <li>odv: Creates a odv file.</li> + * </ol> + * + * @param format Document which contains some export specific information. + * @param inputData Contains some meta information to adjust the export + * (e.g. width and height of a chart). + * @param outputStream The output stream used to return the export. + * @param uuid The UUID of the current artifact. + * @param callContext The CallContext object. + * @throws StateException if an error occured while creating the export + * object. */ public void out( Document format, @@ -437,6 +516,13 @@ } + /** + * Retrieves the export format (e.g. png, gif, jpeg). + * + * @param mime Export format specified by the incoming request. + * @return <i>mime</i> if it is supported - otherwise the first format in + * {@link #IMG_EXPORT_FORMAT}. + */ protected String getExportFormat(String mime) { for(int i = 0; i < IMG_EXPORT_FORMAT.length; i++) { if (mime.trim().toUpperCase().indexOf(IMG_EXPORT_FORMAT[i]) > 0) @@ -448,6 +534,14 @@ } + /** + * Returns a collection containing all selected KeyValueDescibeData objects + * of <i>parameters</i>. + * + * @param parameters A collection with KeyValueDescibeData objects. + * @return a collection cleaned from unselected objects. + * @deprecated + */ protected Collection getCleanedParameters(Collection parameters) { Iterator iter = parameters.iterator(); Collection parameter = new Vector(parameters); @@ -461,11 +555,28 @@ } + /** + * Calls {@link #getCleanedParameters(java.util.Collection)} with the + * collection returned by {@link #getParameters(java.lang.String)}. + * + * @param uuid The UUID of the current artifact. + * @return a cleaned collection. + */ protected Collection getCleanedParameters(String uuid) { return getCleanedParameters(getParameters(uuid)); } + /** + * Create a csv file representing the data corresponding to the current + * parameterization. + * + * @param out The output stream used to export the csv file. + * @param results The data used for csv file creation. + * @throws UnsupportedEncodingException if the encoding is not supported. + * @throws IOException if an error occured while writing to output stream. + * @throws StateException if an error occured while creating the csv file. + */ protected void createCSV(OutputStream out, Collection<Result> results) throws UnsupportedEncodingException, IOException, StateException { @@ -507,7 +618,14 @@ /** - * TODO Result is not used at the moment. Change result with correct data. + * Create an odv file representing the data corresponding to the current + * parameterization. + * + * @param outputStream The output stream used to export the odv file. + * @param result The data used for odv file creation. + * @param uuid The UUID of the current artifact. + * @throws IOException if an error occured while writing to output stream. + * @throws StateException if an error occured while creating the odv file. */ protected void createODV(OutputStream outputStream, Collection result, @@ -524,31 +642,43 @@ } /** - * @return + * Returns the statistic generator. + * + * @return the statistic generator. */ protected Statistics getStatisticsGenerator() { Statistics s = new TimeseriesStatistics(); return s; } + + /** + * Writes the statistic into an xml document. + * + * @param statistic Statistic to be written to xml document. + * @return the xml document containing the statistic. + */ protected Document writeStatistics2XML( Collection<StatisticSet> statistic) { ArtifactXMLUtilities xmlUtilities = new ArtifactXMLUtilities(); Document doc = XMLUtils.newDocument(); if (statistic != null) { - Node statisticResults = xmlUtilities.createArtifactElement(doc, + @SuppressWarnings("static-access") + Node statisticResults = ArtifactXMLUtilities.createArtifactElement(doc, "statistics"); doc.appendChild(statisticResults); Iterator<StatisticSet> it = statistic.iterator(); while (it.hasNext()) { StatisticSet set = it.next(); - Element setElement = xmlUtilities.createArtifactElement(doc, + @SuppressWarnings("static-access") + Element setElement = ArtifactXMLUtilities.createArtifactElement(doc, "statistic"); setElement.setAttribute("name", set.getName()); Iterator<Statistic> sit = set.getStatistics().iterator(); while (sit.hasNext()){ Statistic s = sit.next(); - Element result = xmlUtilities.createArtifactElement(doc, + @SuppressWarnings("static-access") + Element result = ArtifactXMLUtilities.createArtifactElement(doc, "statistic-value"); result.setAttribute("name", s.getKey()); result.setAttribute("value", s.getStringValue()); @@ -562,6 +692,12 @@ } + /** + * Returns the name of the selected feature. + * + * @param uuid The UUID of the current artifact. + * @return the name of the selectef feature. + */ protected String getSelectedFeatureName(String uuid) { Collection values = getCollection(featureValuesName, uuid); @@ -580,14 +716,26 @@ /** - * @param outputStream - * @param parameters - * @param measurements - * @param timeSeriesName - * @param chartStyle - * @param chartLables - * @throws IOException - * @throws TechnicalChartException + * Creates a chart and writes it to <i>outputStream</i>. + * + * @param outputStream The stream used to write the chart to. + * @param parameters A collection with parameters. + * @param measurements A collection with measurements. + * @param dates A collection with dates. + * @param chartLables The labels used to decorate the chart. + * @param context The CallContext. + * @param uuid The UUID of the current artifact. + * @param exportFormat The format the chart used to be exported as. + * @param locale The Locale to specify the language. + * @param width The width of the chart. + * @param height The height of the chart. + * @param linesVisible A boolean property to determine the visibility of + * lines connecting two datapoins. + * @param shapesVisible A boolean property to determine the visibility of + * datapoints. + * @param callContext The CallContext object. + * @throws IOException if an error occured while writing to output stream. + * @throws TechnicalChartException if an error occured while chart creation. */ protected void createChart( OutputStream outputStream, @@ -642,6 +790,25 @@ } + /** + * Creates a chart and writes it as pdf to <i>outputStream</i>. + * + * @param outputStream The stream used to write the chart to. + * @param parameters A collection with parameters. + * @param measurements A collection with measurements. + * @param dates A collection with dates. + * @param chartLables The labels used to decorate the chart. + * @param uuid The UUID of the current artifact. + * @param exportFormat The format the chart used to be exported as. + * @param landscape A boolean property to determine the alignment of the + * chart. + * @param linesVisible A boolean property to determine the visibility of + * lines connecting two datapoins. + * @param shapesVisible A boolean property to determine the visibility of + * datapoints. + * @param locale The Locale to specify the language. + * @param context The CallContext object. + */ protected void createPDF( OutputStream outputStream, Collection parameters, @@ -685,6 +852,24 @@ } + /** + * Creates a chart and writes it as svg to <i>outputStream</i>. + * + * @param outputStream The stream used to write the chart to. + * @param parameters A collection with parameters. + * @param measurements A collection with measurements. + * @param dates A collection with dates. + * @param chartLables The labels used to decorate the chart. + * @param uuid The UUID of the current artifact. + * @param locale The Locale to specify the language. + * @param width The width of the chart. + * @param height The height of the chart. + * @param linesVisible A boolean property to determine the visibility of + * lines connecting two datapoins. + * @param shapesVisible A boolean property to determine the visibility of + * datapoints. + * @param callContext The CallContext object. + */ protected void createSVG( OutputStream outputStream, Collection parameters, @@ -729,6 +914,26 @@ } + /** + * This method creates a chart and returns it. In normal case, this is the + * only method to be overriden by subclasses to create other types of + * charts. + * + * @param chartLables Labels used to decorate the chart. + * @param theme The theme used to adjust the look of the chart. + * @param parameters A collection with parameters this chart contains. + * @param measurements A collection with measurement this chart contains. + * @param dates A collection with dates this chart contains. + * @param result The data collection used to be displayed in this chart. + * @param locale The Locale used to determine the language. + * @param uuid The uuid of the current artifact. + * @param linesVisible A boolean property to determine the visibility of + * lines connecting two points in a chart (not used in this chart type). + * @param shapesVisible A boolean property to determine the visiblity of + * datapoints in this chart (not used in this chart type). + * @param callContext The CallContext object. + * @return a timeseries chart. + */ protected Chart getChart( ChartLabels chartLables, ChartTheme theme, @@ -775,6 +980,13 @@ return chart; } + + /** + * Fetches the ChartTheme from <i>callContext</i> and returns it. + * + * @param callContext CallContext objects storing a chart theme. + * @return a chart theme. + */ protected ChartTheme createStyle(CallContext callContext) { log.debug("Fetch chart theme from global context"); @@ -787,6 +999,14 @@ return theme; } + /** + * Creates a ChartLabels object storing different labels used to decorate a + * chart. + * + * @param locale The Locale object to adjust the language of labels. + * @param uuid The UUID of the current artifact. + * @return the chart labels. + */ protected ChartLabels createChartLabels(Locale locale, String uuid) { return new ChartLabels( createChartTitle(locale, uuid), @@ -800,17 +1020,39 @@ } + /** + * Creates and returns the chart title. + * + * @param locale The Locale used to adjust the language of the title. + * @param uuid The UUID of the current artifact. + * @return the name of the selected fis. + */ protected String createChartTitle(Locale locale, String uuid) { return getFisName(locale); } + /** + * Creates and returns the subtitle of a chart. + * + * @param locale The Locale used to adjust the language of the subtitle. + * @param uuid The UUID of the current artifact. + * @return the selected feature. + */ protected String createChartSubtitle(Locale locale, String uuid) { return getSelectedFeatureName(uuid); } + /** + * Creates and returns labels to decorate histograms. + * + * @param uuid The UUID of the current artifact. + * @param context The CallContext object. + * @param data An array storing strings. + * @return A ChartLabels object with the 1st string in <i>data</i> as title. + */ protected ChartLabels createHistogramLabels( String uuid, CallContext context, Object[] data) { @@ -818,6 +1060,12 @@ } + /** + * Returns the selected fis name. + * + * @param locale The Locale object used to adjust the language. + * @return the name of the fis. + */ protected String getFisName(Locale locale) { String returnValue = ""; InputData input = inputData.get("fisname"); @@ -835,6 +1083,14 @@ } + /** + * Returns the name of the selected object in the collection specified by + * <i>key</i>. + * + * @param uuid The UUID of the current artifat. + * @param key A key to specify a collection. + * @return the name of the selected item. + */ protected String getSelectedInputDataName(String uuid, String key) { Collection values = getCollection(key, uuid); @@ -853,13 +1109,32 @@ } + /** + * Returns a collection of selected parameters. + * + * @param uuid The UUID of the current artifact. + * @return selected parameters. + */ protected Collection<KeyValueDescibeData> getParameters(String uuid) { return this.getCollection(parameterValuesName, uuid); } + /** + * Returns a collection of selected measurements. + * + * @param uuid The UUID of the current artifact. + * @return selected measurements. + */ protected Collection<KeyValueDescibeData> getMeasurements(String uuid) { return this.getCollection(measuremenValueName, uuid); } + + /** + * Returns a collection of selected dates. + * + * @param uuid The UUID of the current artifact. + * @return selected dates. + */ protected Collection<KeyValueDescibeData> getDates(String uuid) { return this.getCollection(dateValueName,uuid); } @@ -921,9 +1196,15 @@ } } + /** - * @param collectionName - * @return + * Creates a <code>NamedArrayList</code> storing some <code> + * KeyValueDescibeData</code> objects found in the input data with the key + * <i>collectionName</i>. + * + * @param collectionName String to specify the input data. + * @param uuid The UUID of the current artifact. + * @return a collection with values from input data. */ protected Collection<KeyValueDescibeData> getCollection( String collectionName,