comparison gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java @ 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 5dd94448538d
children bb7afd783321
comparison
equal deleted inserted replaced
803:feae2f9d6c6f 804:9058c08eac3a
84 * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> 84 * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
85 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> 85 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
86 */ 86 */
87 public class TimeSeriesOutputState extends OutputStateBase { 87 public class TimeSeriesOutputState extends OutputStateBase {
88 88
89 /**
90 * A boolean property to enable caching of charts after they have been
91 * created. This property can be adjusted via system property 'cache.chart'.
92 * 'true' of 'false' are valid options - defaults to 'false'.<br>
93 * <b>NOTE:</b> If chart caching is enabled, charts aren't sensible to
94 * changes in the parameterization anymore, after a first chart has been
95 * created for an artifact.
96 */
89 protected static final boolean CACHE_CHART = 97 protected static final boolean CACHE_CHART =
90 Boolean.parseBoolean(System.getProperty("cache.chart", "false")); 98 Boolean.parseBoolean(System.getProperty("cache.chart", "false"));
91 99
100 /**
101 * A field parsing a system property to adjust the alignment of pdf exports.
102 * The system property is 'export.pdf.landscape' and should be true or
103 * false. If this property is true, PDFs will be created in landscape
104 * format.
105 */
92 protected static final boolean PDF_FORMAT_LANDSCAPE = 106 protected static final boolean PDF_FORMAT_LANDSCAPE =
93 Boolean.parseBoolean(System.getProperty("export.pdf.landscape","true")); 107 Boolean.parseBoolean(System.getProperty("export.pdf.landscape","true"));
94 108
109 /**
110 * Supported image export formats.
111 */
95 protected static final String[] IMG_EXPORT_FORMAT = { 112 protected static final String[] IMG_EXPORT_FORMAT = {
96 "PNG", "JPEG", "GIF" 113 "PNG", "JPEG", "GIF"
97 }; 114 };
98 115
99 /** 116 /**
107 private static Logger log = Logger 124 private static Logger log = Logger
108 .getLogger(TimeSeriesOutputState.class); 125 .getLogger(TimeSeriesOutputState.class);
109 126
110 private List<TimeGap> timeGapDefinitions = null; 127 private List<TimeGap> timeGapDefinitions = null;
111 128
129 /**
130 * Key in resource bundle the x-axis title is stored.
131 */
112 protected String domainLable = "chart.timeseries.title.xaxis"; 132 protected String domainLable = "chart.timeseries.title.xaxis";
113 133
114 protected String featureValuesName = "featureid"; 134 protected String featureValuesName = "featureid";
115 protected String parameterValuesName = "parameterid"; 135 protected String parameterValuesName = "parameterid";
116 protected String measuremenValueName = "measurementid"; 136 protected String measuremenValueName = "measurementid";
117 protected String dateValueName = "dateid"; 137 protected String dateValueName = "dateid";
118 138
139
140 /**
141 * Array used to specify the columns used in csv exports.
142 */
119 public static final String [] TIMESERIES_CSV_PROFILE_COLUMNS = { 143 public static final String [] TIMESERIES_CSV_PROFILE_COLUMNS = {
120 "XORDINATE", 144 "XORDINATE",
121 "YORDINATE", 145 "YORDINATE",
122 "GROUP1", 146 "GROUP1",
123 "GROUP2", 147 "GROUP2",
124 "GROUP3" 148 "GROUP3"
125 }; 149 };
126 150
127 151
152 /**
153 * Column labels used in csv exports.
154 */
128 public static final String [] TIMESERIES_TIMESERIES_CSV_COLUMN_LABEL = { 155 public static final String [] TIMESERIES_TIMESERIES_CSV_COLUMN_LABEL = {
129 "Date/Time", 156 "Date/Time",
130 "Value", 157 "Value",
131 "ParameterID", 158 "ParameterID",
132 "MeasurementID", 159 "MeasurementID",
133 "TimeseriesID" 160 "TimeseriesID"
134 }; 161 };
135 162
163
164 /**
165 * Array used to specify the column in csv exports on meshes.
166 */
136 public static final String [] TIMESERIES_MESH_CSV_COLUMN_LABEL = { 167 public static final String [] TIMESERIES_MESH_CSV_COLUMN_LABEL = {
137 "Date/Time", 168 "Date/Time",
138 "Value", 169 "Value",
139 "ParameterID", 170 "ParameterID",
140 "FeatureID", 171 "FeatureID",
141 "MeshID" 172 "MeshID"
142 }; 173 };
143 174
175
176 /**
177 * Array used to specify the columns in odv exports.
178 */
144 public static final String [] TIMESERIES_ODV_PROFILE_NAMES = { 179 public static final String [] TIMESERIES_ODV_PROFILE_NAMES = {
145 "CRUISE", 180 "CRUISE",
146 "STATION", 181 "STATION",
147 "TYPE", 182 "TYPE",
148 "TIMEVALUE", 183 "TIMEVALUE",
151 "DEPTH", 186 "DEPTH",
152 "QF" 187 "QF"
153 }; 188 };
154 189
155 190
191 /**
192 * Column labels used in odv exports.
193 */
156 public static final String [] ODV_COLUMN_HEADER = { 194 public static final String [] ODV_COLUMN_HEADER = {
157 "Cruise", 195 "Cruise",
158 "Station", 196 "Station",
159 "Type", 197 "Type",
160 "yyyy-mm-dd hh:mm", 198 "yyyy-mm-dd hh:mm",
163 "Bot. Depth [m]", 201 "Bot. Depth [m]",
164 "Depth [m]", 202 "Depth [m]",
165 "QF" 203 "QF"
166 }; 204 };
167 205
206
168 /** 207 /**
169 * Profile for exporting data to odv 208 * Profile for exporting data to odv
170 */ 209 */
171 public static final Profile TIMESERIES_ODV_PROFILE = 210 public static final Profile TIMESERIES_ODV_PROFILE =
172 new DefaultProfile( 211 new DefaultProfile(
183 public TimeSeriesOutputState() { 222 public TimeSeriesOutputState() {
184 super(); 223 super();
185 } 224 }
186 225
187 226
227 /**
228 * Calls <code>getChartResult</code> which puts the data used for chart
229 * creation into cache. This redruces waiting periods after selecting an
230 * output type.
231 *
232 * @param uuid The UUID of the current artifact.
233 * @param context The CallContext object.
234 * @throws StateException if an error occured while fetching the data used
235 * for chart creation.
236 */
188 @Override 237 @Override
189 public void initialize(String uuid, CallContext context) 238 public void initialize(String uuid, CallContext context)
190 throws StateException 239 throws StateException
191 { 240 {
192 getChartResult(uuid, context); 241 getChartResult(uuid, context);
193 } 242 }
194 243
195 244
196 /** 245 /**
197 * @see de.intevation.gnv.transition.OutputTransition#out(java.lang.String, 246 * This out target has following modes:<br>
198 * java.util.Collection, java.io.OutputStream, java.lang.String, 247 * <ol>
199 * de.intevation.artifacts.CallMeta) 248 * <li>chart: Creates a chart displaying the data corresponding to the
249 * current parameterization. A chart has following export modes:<br>
250 * <ol>
251 * <li>img: Image representation of a chart.</li>
252 * <li>pdf: PDF representation of a chart.</li>
253 * <li>svg: SVG representation of a chart.</li>
254 * </ol>
255 * All selected parameters are drawn into a single chart.<br>
256 * </li>
257 * <li>histogram: Creates a histogram displaying the data corresponding to
258 * the current parameterization. A histogram has following export modes:<br>
259 * <ol>
260 * <li>img: Image representation of a histogram.</li>
261 * <li>pdf: PDF representation of a histogram.</li>
262 * <li>svg: SVG representation of a histogram.</li>
263 * </ol>
264 * A single histogram is created for each selected parameter.<br>
265 * </li>
266 * <li>statistic: Creates a statistic with important figures.</li>
267 * <li>csv: Creates a csv file.</li>
268 * <li>odv: Creates a odv file.</li>
269 * </ol>
270 *
271 * @param format Document which contains some export specific information.
272 * @param inputData Contains some meta information to adjust the export
273 * (e.g. width and height of a chart).
274 * @param outputStream The output stream used to return the export.
275 * @param uuid The UUID of the current artifact.
276 * @param callContext The CallContext object.
277 * @throws StateException if an error occured while creating the export
278 * object.
200 */ 279 */
201 public void out( 280 public void out(
202 Document format, 281 Document format,
203 Collection<InputData> inputData, 282 Collection<InputData> inputData,
204 OutputStream outputStream, 283 OutputStream outputStream,
435 throw new StateException(e); 514 throw new StateException(e);
436 } 515 }
437 } 516 }
438 517
439 518
519 /**
520 * Retrieves the export format (e.g. png, gif, jpeg).
521 *
522 * @param mime Export format specified by the incoming request.
523 * @return <i>mime</i> if it is supported - otherwise the first format in
524 * {@link #IMG_EXPORT_FORMAT}.
525 */
440 protected String getExportFormat(String mime) { 526 protected String getExportFormat(String mime) {
441 for(int i = 0; i < IMG_EXPORT_FORMAT.length; i++) { 527 for(int i = 0; i < IMG_EXPORT_FORMAT.length; i++) {
442 if (mime.trim().toUpperCase().indexOf(IMG_EXPORT_FORMAT[i]) > 0) 528 if (mime.trim().toUpperCase().indexOf(IMG_EXPORT_FORMAT[i]) > 0)
443 return IMG_EXPORT_FORMAT[i]; 529 return IMG_EXPORT_FORMAT[i];
444 } 530 }
446 // no format found relating to mimeType, default export as PNG 532 // no format found relating to mimeType, default export as PNG
447 return IMG_EXPORT_FORMAT[0]; 533 return IMG_EXPORT_FORMAT[0];
448 } 534 }
449 535
450 536
537 /**
538 * Returns a collection containing all selected KeyValueDescibeData objects
539 * of <i>parameters</i>.
540 *
541 * @param parameters A collection with KeyValueDescibeData objects.
542 * @return a collection cleaned from unselected objects.
543 * @deprecated
544 */
451 protected Collection getCleanedParameters(Collection parameters) { 545 protected Collection getCleanedParameters(Collection parameters) {
452 Iterator iter = parameters.iterator(); 546 Iterator iter = parameters.iterator();
453 Collection parameter = new Vector(parameters); 547 Collection parameter = new Vector(parameters);
454 while (iter.hasNext()) { 548 while (iter.hasNext()) {
455 KeyValueDescibeData data = (KeyValueDescibeData)iter.next(); 549 KeyValueDescibeData data = (KeyValueDescibeData)iter.next();
459 553
460 return parameter; 554 return parameter;
461 } 555 }
462 556
463 557
558 /**
559 * Calls {@link #getCleanedParameters(java.util.Collection)} with the
560 * collection returned by {@link #getParameters(java.lang.String)}.
561 *
562 * @param uuid The UUID of the current artifact.
563 * @return a cleaned collection.
564 */
464 protected Collection getCleanedParameters(String uuid) { 565 protected Collection getCleanedParameters(String uuid) {
465 return getCleanedParameters(getParameters(uuid)); 566 return getCleanedParameters(getParameters(uuid));
466 } 567 }
467 568
468 569
570 /**
571 * Create a csv file representing the data corresponding to the current
572 * parameterization.
573 *
574 * @param out The output stream used to export the csv file.
575 * @param results The data used for csv file creation.
576 * @throws UnsupportedEncodingException if the encoding is not supported.
577 * @throws IOException if an error occured while writing to output stream.
578 * @throws StateException if an error occured while creating the csv file.
579 */
469 protected void createCSV(OutputStream out, Collection<Result> results) 580 protected void createCSV(OutputStream out, Collection<Result> results)
470 throws UnsupportedEncodingException, IOException, StateException 581 throws UnsupportedEncodingException, IOException, StateException
471 { 582 {
472 Iterator iter = results.iterator(); 583 Iterator iter = results.iterator();
473 Result res = iter.hasNext() ? (Result) iter.next() : null; 584 Result res = iter.hasNext() ? (Result) iter.next() : null;
505 export.create(profile, out, results); 616 export.create(profile, out, results);
506 } 617 }
507 618
508 619
509 /** 620 /**
510 * TODO Result is not used at the moment. Change result with correct data. 621 * Create an odv file representing the data corresponding to the current
622 * parameterization.
623 *
624 * @param outputStream The output stream used to export the odv file.
625 * @param result The data used for odv file creation.
626 * @param uuid The UUID of the current artifact.
627 * @throws IOException if an error occured while writing to output stream.
628 * @throws StateException if an error occured while creating the odv file.
511 */ 629 */
512 protected void createODV(OutputStream outputStream, 630 protected void createODV(OutputStream outputStream,
513 Collection result, 631 Collection result,
514 String uuid) 632 String uuid)
515 throws IOException, StateException { 633 throws IOException, StateException {
522 log.error("#################### RESULT == NULL #################"); 640 log.error("#################### RESULT == NULL #################");
523 export.create(TIMESERIES_ODV_PROFILE, outputStream, result); 641 export.create(TIMESERIES_ODV_PROFILE, outputStream, result);
524 } 642 }
525 643
526 /** 644 /**
527 * @return 645 * Returns the statistic generator.
646 *
647 * @return the statistic generator.
528 */ 648 */
529 protected Statistics getStatisticsGenerator() { 649 protected Statistics getStatisticsGenerator() {
530 Statistics s = new TimeseriesStatistics(); 650 Statistics s = new TimeseriesStatistics();
531 return s; 651 return s;
532 } 652 }
533 653
654
655 /**
656 * Writes the statistic into an xml document.
657 *
658 * @param statistic Statistic to be written to xml document.
659 * @return the xml document containing the statistic.
660 */
534 protected Document writeStatistics2XML( Collection<StatisticSet> statistic) { 661 protected Document writeStatistics2XML( Collection<StatisticSet> statistic) {
535 ArtifactXMLUtilities xmlUtilities = new ArtifactXMLUtilities(); 662 ArtifactXMLUtilities xmlUtilities = new ArtifactXMLUtilities();
536 Document doc = XMLUtils.newDocument(); 663 Document doc = XMLUtils.newDocument();
537 if (statistic != null) { 664 if (statistic != null) {
538 Node statisticResults = xmlUtilities.createArtifactElement(doc, 665 @SuppressWarnings("static-access")
666 Node statisticResults = ArtifactXMLUtilities.createArtifactElement(doc,
539 "statistics"); 667 "statistics");
540 doc.appendChild(statisticResults); 668 doc.appendChild(statisticResults);
541 Iterator<StatisticSet> it = statistic.iterator(); 669 Iterator<StatisticSet> it = statistic.iterator();
542 while (it.hasNext()) { 670 while (it.hasNext()) {
543 StatisticSet set = it.next(); 671 StatisticSet set = it.next();
544 Element setElement = xmlUtilities.createArtifactElement(doc, 672 @SuppressWarnings("static-access")
673 Element setElement = ArtifactXMLUtilities.createArtifactElement(doc,
545 "statistic"); 674 "statistic");
546 setElement.setAttribute("name", set.getName()); 675 setElement.setAttribute("name", set.getName());
547 676
548 Iterator<Statistic> sit = set.getStatistics().iterator(); 677 Iterator<Statistic> sit = set.getStatistics().iterator();
549 while (sit.hasNext()){ 678 while (sit.hasNext()){
550 Statistic s = sit.next(); 679 Statistic s = sit.next();
551 Element result = xmlUtilities.createArtifactElement(doc, 680 @SuppressWarnings("static-access")
681 Element result = ArtifactXMLUtilities.createArtifactElement(doc,
552 "statistic-value"); 682 "statistic-value");
553 result.setAttribute("name", s.getKey()); 683 result.setAttribute("name", s.getKey());
554 result.setAttribute("value", s.getStringValue()); 684 result.setAttribute("value", s.getStringValue());
555 setElement.appendChild(result); 685 setElement.appendChild(result);
556 } 686 }
560 } 690 }
561 return doc; 691 return doc;
562 } 692 }
563 693
564 694
695 /**
696 * Returns the name of the selected feature.
697 *
698 * @param uuid The UUID of the current artifact.
699 * @return the name of the selectef feature.
700 */
565 protected String getSelectedFeatureName(String uuid) { 701 protected String getSelectedFeatureName(String uuid) {
566 Collection values = getCollection(featureValuesName, uuid); 702 Collection values = getCollection(featureValuesName, uuid);
567 703
568 if (values != null) { 704 if (values != null) {
569 Iterator it = values.iterator(); 705 Iterator it = values.iterator();
578 return ""; 714 return "";
579 } 715 }
580 716
581 717
582 /** 718 /**
583 * @param outputStream 719 * Creates a chart and writes it to <i>outputStream</i>.
584 * @param parameters 720 *
585 * @param measurements 721 * @param outputStream The stream used to write the chart to.
586 * @param timeSeriesName 722 * @param parameters A collection with parameters.
587 * @param chartStyle 723 * @param measurements A collection with measurements.
588 * @param chartLables 724 * @param dates A collection with dates.
589 * @throws IOException 725 * @param chartLables The labels used to decorate the chart.
590 * @throws TechnicalChartException 726 * @param context The CallContext.
727 * @param uuid The UUID of the current artifact.
728 * @param exportFormat The format the chart used to be exported as.
729 * @param locale The Locale to specify the language.
730 * @param width The width of the chart.
731 * @param height The height of the chart.
732 * @param linesVisible A boolean property to determine the visibility of
733 * lines connecting two datapoins.
734 * @param shapesVisible A boolean property to determine the visibility of
735 * datapoints.
736 * @param callContext The CallContext object.
737 * @throws IOException if an error occured while writing to output stream.
738 * @throws TechnicalChartException if an error occured while chart creation.
591 */ 739 */
592 protected void createChart( 740 protected void createChart(
593 OutputStream outputStream, 741 OutputStream outputStream,
594 Collection parameters, 742 Collection parameters,
595 Collection measurements, 743 Collection measurements,
640 height 788 height
641 ); 789 );
642 } 790 }
643 791
644 792
793 /**
794 * Creates a chart and writes it as pdf to <i>outputStream</i>.
795 *
796 * @param outputStream The stream used to write the chart to.
797 * @param parameters A collection with parameters.
798 * @param measurements A collection with measurements.
799 * @param dates A collection with dates.
800 * @param chartLables The labels used to decorate the chart.
801 * @param uuid The UUID of the current artifact.
802 * @param exportFormat The format the chart used to be exported as.
803 * @param landscape A boolean property to determine the alignment of the
804 * chart.
805 * @param linesVisible A boolean property to determine the visibility of
806 * lines connecting two datapoins.
807 * @param shapesVisible A boolean property to determine the visibility of
808 * datapoints.
809 * @param locale The Locale to specify the language.
810 * @param context The CallContext object.
811 */
645 protected void createPDF( 812 protected void createPDF(
646 OutputStream outputStream, 813 OutputStream outputStream,
647 Collection parameters, 814 Collection parameters,
648 Collection measurements, 815 Collection measurements,
649 Collection dates, 816 Collection dates,
683 50F, 50F, 50F, 50F 850 50F, 50F, 50F, 50F
684 ); 851 );
685 } 852 }
686 853
687 854
855 /**
856 * Creates a chart and writes it as svg to <i>outputStream</i>.
857 *
858 * @param outputStream The stream used to write the chart to.
859 * @param parameters A collection with parameters.
860 * @param measurements A collection with measurements.
861 * @param dates A collection with dates.
862 * @param chartLables The labels used to decorate the chart.
863 * @param uuid The UUID of the current artifact.
864 * @param locale The Locale to specify the language.
865 * @param width The width of the chart.
866 * @param height The height of the chart.
867 * @param linesVisible A boolean property to determine the visibility of
868 * lines connecting two datapoins.
869 * @param shapesVisible A boolean property to determine the visibility of
870 * datapoints.
871 * @param callContext The CallContext object.
872 */
688 protected void createSVG( 873 protected void createSVG(
689 OutputStream outputStream, 874 OutputStream outputStream,
690 Collection parameters, 875 Collection parameters,
691 Collection measurements, 876 Collection measurements,
692 Collection dates, 877 Collection dates,
727 912
728 log.debug("svg export finished."); 913 log.debug("svg export finished.");
729 } 914 }
730 915
731 916
917 /**
918 * This method creates a chart and returns it. In normal case, this is the
919 * only method to be overriden by subclasses to create other types of
920 * charts.
921 *
922 * @param chartLables Labels used to decorate the chart.
923 * @param theme The theme used to adjust the look of the chart.
924 * @param parameters A collection with parameters this chart contains.
925 * @param measurements A collection with measurement this chart contains.
926 * @param dates A collection with dates this chart contains.
927 * @param result The data collection used to be displayed in this chart.
928 * @param locale The Locale used to determine the language.
929 * @param uuid The uuid of the current artifact.
930 * @param linesVisible A boolean property to determine the visibility of
931 * lines connecting two points in a chart (not used in this chart type).
932 * @param shapesVisible A boolean property to determine the visiblity of
933 * datapoints in this chart (not used in this chart type).
934 * @param callContext The CallContext object.
935 * @return a timeseries chart.
936 */
732 protected Chart getChart( 937 protected Chart getChart(
733 ChartLabels chartLables, 938 ChartLabels chartLables,
734 ChartTheme theme, 939 ChartTheme theme,
735 Collection parameters, 940 Collection parameters,
736 Collection measurements, 941 Collection measurements,
773 } 978 }
774 979
775 return chart; 980 return chart;
776 } 981 }
777 982
983
984 /**
985 * Fetches the ChartTheme from <i>callContext</i> and returns it.
986 *
987 * @param callContext CallContext objects storing a chart theme.
988 * @return a chart theme.
989 */
778 protected ChartTheme createStyle(CallContext callContext) { 990 protected ChartTheme createStyle(CallContext callContext) {
779 log.debug("Fetch chart theme from global context"); 991 log.debug("Fetch chart theme from global context");
780 992
781 GNVArtifactContext context = 993 GNVArtifactContext context =
782 (GNVArtifactContext) callContext.globalContext(); 994 (GNVArtifactContext) callContext.globalContext();
785 GNVArtifactContext.CHART_TEMPLATE_KEY); 997 GNVArtifactContext.CHART_TEMPLATE_KEY);
786 998
787 return theme; 999 return theme;
788 } 1000 }
789 1001
1002 /**
1003 * Creates a ChartLabels object storing different labels used to decorate a
1004 * chart.
1005 *
1006 * @param locale The Locale object to adjust the language of labels.
1007 * @param uuid The UUID of the current artifact.
1008 * @return the chart labels.
1009 */
790 protected ChartLabels createChartLabels(Locale locale, String uuid) { 1010 protected ChartLabels createChartLabels(Locale locale, String uuid) {
791 return new ChartLabels( 1011 return new ChartLabels(
792 createChartTitle(locale, uuid), 1012 createChartTitle(locale, uuid),
793 createChartSubtitle(locale, uuid), 1013 createChartSubtitle(locale, uuid),
794 RessourceFactory.getInstance().getRessource( 1014 RessourceFactory.getInstance().getRessource(
798 ) 1018 )
799 ); 1019 );
800 } 1020 }
801 1021
802 1022
1023 /**
1024 * Creates and returns the chart title.
1025 *
1026 * @param locale The Locale used to adjust the language of the title.
1027 * @param uuid The UUID of the current artifact.
1028 * @return the name of the selected fis.
1029 */
803 protected String createChartTitle(Locale locale, String uuid) { 1030 protected String createChartTitle(Locale locale, String uuid) {
804 return getFisName(locale); 1031 return getFisName(locale);
805 1032
806 } 1033 }
807 1034
808 1035
1036 /**
1037 * Creates and returns the subtitle of a chart.
1038 *
1039 * @param locale The Locale used to adjust the language of the subtitle.
1040 * @param uuid The UUID of the current artifact.
1041 * @return the selected feature.
1042 */
809 protected String createChartSubtitle(Locale locale, String uuid) { 1043 protected String createChartSubtitle(Locale locale, String uuid) {
810 return getSelectedFeatureName(uuid); 1044 return getSelectedFeatureName(uuid);
811 } 1045 }
812 1046
813 1047
1048 /**
1049 * Creates and returns labels to decorate histograms.
1050 *
1051 * @param uuid The UUID of the current artifact.
1052 * @param context The CallContext object.
1053 * @param data An array storing strings.
1054 * @return A ChartLabels object with the 1st string in <i>data</i> as title.
1055 */
814 protected ChartLabels createHistogramLabels( 1056 protected ChartLabels createHistogramLabels(
815 String uuid, CallContext context, Object[] data) 1057 String uuid, CallContext context, Object[] data)
816 { 1058 {
817 return new ChartLabels((String) data[0], "", ""); 1059 return new ChartLabels((String) data[0], "", "");
818 } 1060 }
819 1061
820 1062
1063 /**
1064 * Returns the selected fis name.
1065 *
1066 * @param locale The Locale object used to adjust the language.
1067 * @return the name of the fis.
1068 */
821 protected String getFisName(Locale locale) { 1069 protected String getFisName(Locale locale) {
822 String returnValue = ""; 1070 String returnValue = "";
823 InputData input = inputData.get("fisname"); 1071 InputData input = inputData.get("fisname");
824 1072
825 if (input != null) { 1073 if (input != null) {
833 } 1081 }
834 return returnValue; 1082 return returnValue;
835 } 1083 }
836 1084
837 1085
1086 /**
1087 * Returns the name of the selected object in the collection specified by
1088 * <i>key</i>.
1089 *
1090 * @param uuid The UUID of the current artifat.
1091 * @param key A key to specify a collection.
1092 * @return the name of the selected item.
1093 */
838 protected String getSelectedInputDataName(String uuid, String key) { 1094 protected String getSelectedInputDataName(String uuid, String key) {
839 Collection values = getCollection(key, uuid); 1095 Collection values = getCollection(key, uuid);
840 1096
841 if (values != null) { 1097 if (values != null) {
842 Iterator it = values.iterator(); 1098 Iterator it = values.iterator();
851 } 1107 }
852 return null; 1108 return null;
853 } 1109 }
854 1110
855 1111
1112 /**
1113 * Returns a collection of selected parameters.
1114 *
1115 * @param uuid The UUID of the current artifact.
1116 * @return selected parameters.
1117 */
856 protected Collection<KeyValueDescibeData> getParameters(String uuid) { 1118 protected Collection<KeyValueDescibeData> getParameters(String uuid) {
857 return this.getCollection(parameterValuesName, uuid); 1119 return this.getCollection(parameterValuesName, uuid);
858 } 1120 }
859 1121
1122 /**
1123 * Returns a collection of selected measurements.
1124 *
1125 * @param uuid The UUID of the current artifact.
1126 * @return selected measurements.
1127 */
860 protected Collection<KeyValueDescibeData> getMeasurements(String uuid) { 1128 protected Collection<KeyValueDescibeData> getMeasurements(String uuid) {
861 return this.getCollection(measuremenValueName, uuid); 1129 return this.getCollection(measuremenValueName, uuid);
862 } 1130 }
1131
1132 /**
1133 * Returns a collection of selected dates.
1134 *
1135 * @param uuid The UUID of the current artifact.
1136 * @return selected dates.
1137 */
863 protected Collection<KeyValueDescibeData> getDates(String uuid) { 1138 protected Collection<KeyValueDescibeData> getDates(String uuid) {
864 return this.getCollection(dateValueName,uuid); 1139 return this.getCollection(dateValueName,uuid);
865 } 1140 }
866 1141
867 @Override 1142 @Override
919 } 1194 }
920 } 1195 }
921 } 1196 }
922 } 1197 }
923 1198
924 /** 1199
925 * @param collectionName 1200 /**
926 * @return 1201 * Creates a <code>NamedArrayList</code> storing some <code>
1202 * KeyValueDescibeData</code> objects found in the input data with the key
1203 * <i>collectionName</i>.
1204 *
1205 * @param collectionName String to specify the input data.
1206 * @param uuid The UUID of the current artifact.
1207 * @return a collection with values from input data.
927 */ 1208 */
928 protected Collection<KeyValueDescibeData> getCollection( 1209 protected Collection<KeyValueDescibeData> getCollection(
929 String collectionName, 1210 String collectionName,
930 String uuid) 1211 String uuid)
931 { 1212 {

http://dive4elements.wald.intevation.org