Mercurial > dive4elements > river
changeset 9071:a561b882436d
create module bundu (Betrieb & Unterhaltung)
incl. original Fixierungsanalyse+Ausgelagerte Wasserspiegellage
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/doc/conf/artifacts/bundu.xml Wed May 16 11:08:56 2018 +0200 @@ -0,0 +1,337 @@ +<?xml version="1.0" encoding="UTF-8"?> +<artifact name="bundu"> + <states> + <state id="state.fix.river" description="state.fix.river" + helpText="help.state.fix.river" + state="org.dive4elements.river.artifacts.states.RiverSelect"> + <data name="river" type="String" /> + </state> + + <transition transition="org.dive4elements.river.artifacts.transitions.DefaultTransition"> + <from state="state.fix.river"/> + <to state="state.fix.calculation.mode"/> + </transition> + + <state id="state.fix.calculation.mode" + helpText="help.state.fix.calculation.mode" + description="state.fix.calcuation.mode" + state="org.dive4elements.river.artifacts.states.fixation.FixationSelect"> + <data name="calculation.mode" type="String"/> + </state> + + <transition transition="org.dive4elements.river.artifacts.transitions.DefaultTransition"> + <from state="state.fix.calculation.mode"/> + <to state="state.fix.location"/> + </transition> + + <state id="state.fix.location" description="state.fix.location" + helpText="help.state.fix.location" + state="org.dive4elements.river.artifacts.states.fixation.LocationSelect"> + <data name="ld_from" type="Double"/> + <data name="ld_to" type="Double"/> + <data name="ld_step" type="Double"/> + </state> + + <transition transition="org.dive4elements.river.artifacts.transitions.DefaultTransition"> + <from state="state.fix.location"/> + <to state="state.fix.period"/> + </transition> + + <state id="state.fix.period" description="state.fix.period" + helpText="help.state.fix.period" + state="org.dive4elements.river.artifacts.states.fixation.FixationPeriod"> + <data name="start" type="Long"/> + <data name="end" type="Long"/> + </state> + + <transition transition="org.dive4elements.river.artifacts.transitions.DefaultTransition"> + <from state="state.fix.period"/> + <to state="state.fix.gaugerange"/> + </transition> + + <state id="state.fix.gaugerange" description="state.fix.gaugerange" + helpText="help.state.fix.gaugerange" + state="org.dive4elements.river.artifacts.states.fixation.GaugeRange"> + <data name="q1" type="Integer"/> + <data name="q2" type="Integer"/> + </state> + + <transition transition="org.dive4elements.river.artifacts.transitions.DefaultTransition"> + <from state="state.fix.gaugerange"/> + <to state="state.fix.eventselect"/> + </transition> + + <state id="state.fix.eventselect" description="state.fix.eventselect" + helpText="help.state.fix.eventselect" + state="org.dive4elements.river.artifacts.states.fixation.EventSelect"> + <data name="events" type="intarray"/> + </state> + + <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> + <from state="state.fix.eventselect"/> + <to state="state.fix.analysis.referenceperiod"/> + <condition data="calculation.mode" value="calculation.analysis" + operator="equal"/> + </transition> + + <transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition"> + <from state="state.fix.eventselect"/> + <to state="state.fix.vollmer.function"/> + <condition data="calculation.mode" value="calculation.vollmer" + operator="equal"/> + </transition> + + <state id="state.fix.analysis.referenceperiod" + helpText="help.state.fix.analysis.referenceperiod" + description="state.fix.analysis.referenceperiod" + state="org.dive4elements.river.artifacts.states.fixation.ReferencePeriod"> + <data name="ref_start" type="Long"/> + <data name="ref_end" type="Long"/> + </state> + + <transition transition="org.dive4elements.river.artifacts.transitions.DefaultTransition"> + <from state="state.fix.analysis.referenceperiod"/> + <to state="state.fix.analysis.analysisperiods"/> + </transition> + + <state id="state.fix.analysis.analysisperiods" + helpText="help.state.fix.analysis.analysisperiods" + description="state.fix.analysis.analysisperiods" + state="org.dive4elements.river.artifacts.states.fixation.AnalysisPeriods"> + <data name="ana_data" type="String"/> + </state> + + <transition transition="org.dive4elements.river.artifacts.transitions.DefaultTransition"> + <from state="state.fix.analysis.analysisperiods"/> + <to state="state.fix.analysis.function"/> + </transition> + + <state id="state.fix.analysis.function" + helpText="help.state.fix.analysis.function" + description="state.fix.analysis.function" + state="org.dive4elements.river.artifacts.states.fixation.FunctionSelect"> + <data name="function" type="String"/> + </state> + + <transition transition="org.dive4elements.river.artifacts.transitions.DefaultTransition"> + <from state="state.fix.analysis.function"/> + <to state="state.fix.analysis.preprocessing"/> + </transition> + + <state id="state.fix.analysis.preprocessing" + helpText="help.state.fix.analysis.preprocessing" + description="state.fix.analysis.preprocessing" + state="org.dive4elements.river.artifacts.states.fixation.PreprocessingSelect"> + <data name="preprocessing" type="Boolean"/> + </state> + + <transition transition="org.dive4elements.river.artifacts.transitions.DefaultTransition"> + <from state="state.fix.analysis.preprocessing"/> + <to state="state.fix.analysis.compute"/> + </transition> + + <state id="state.fix.analysis.compute" + helpText="help.state.fix.analysis.compute" + description="state.fix.analysis.compute" + state="org.dive4elements.river.artifacts.states.fixation.FixAnalysisCompute"> + <outputmodes> + <outputmode name="fix_deltawt_export" description="output.fix_deltawt_export" mine-type="text/plain" type="export"> + <facets> + <facet name="csv" description="facet.fix_deltawt.csv" /> + </facets> + </outputmode> + <outputmode name="fix_parameters_export" description="output.fix_parameters_export" mine-type="text/plain" type="export"> + <facets> + <facet name="fix_parameters" description="facet.fix_parameters.csv" /> + </facets> + </outputmode> + <outputmode name="fix_wq_curve_at_export" description="output.fix_wq_curve_at_export" mime-type="text/plain" type="export"> + <facets> + <facet name="at" description="facet.fix_wq_curve_export.at"/> + </facets> + </outputmode> + <outputmode name="fix_wq_curve" description="output.fix_wq_curve" mine-type="image/png" type="chart"> + <facets> + <facet name="fix_sector_average_wq_0" description="Average values for Ws in Q sectors."/> + <facet name="fix_sector_average_wq_1" description="Average values for Ws in Q sectors."/> + <facet name="fix_sector_average_wq_2" description="Average values for Ws in Q sectors."/> + <facet name="fix_sector_average_wq_3" description="Average values for Ws in Q sectors."/> + <facet name="fix_analysis_events_wq" description="Raw event values used in the calculation"/> + <facet name="fix_reference_events_wq" description="Raw event values used in the calculation"/> + <facet name="fix_wq_curve" description="WQ curve"/> + <facet name="qsectors" description="qsectors."/> + <facet name="fix_outlier" description="The outliers"/> + <facet name="other.wqkms.q" description="W-Type of data" /> + <facet name="other.wqkms.w" description="W-Type of data" /> + <facet name="other.wkms" description="facet.other.wkms"/> + <facet name="other.wkms.marks" description="facet.other.wkms.makrs"/> + <facet name="other.wqkms" description="facet.other.wqkms"/> + <facet name="longitudinal_section.w" description="facet.longitudinal_section.w"/> + <facet name="other.wq" description="Point-like data like fixations"/> + <facet name="heightmarks_points" description="facet.other.wkms.heightmarks_points"/> + <facet name="discharge_curve.curve" description="facet.discharge_curve.curve"/> + <facet name="fix_wq_curve.manualpoints" description="Manual points"/> + <facet name="mainvalues.q" description="mainvalues.q"/> + <facet name="mainvalues.w" description="mainvalues.w"/> + </facets> + </outputmode> + <outputmode name="fix_deltawt_curve" description="output.fix_deltawt_curve" mine-type="image/png" type="chart"> + <facets> + <facet name="fix_sector_average_dwt_0" description="Average values for Ws in Q sectors."/> + <facet name="fix_sector_average_dwt_1" description="Average values for Ws in Q sectors."/> + <facet name="fix_sector_average_dwt_2" description="Average values for Ws in Q sectors."/> + <facet name="fix_sector_average_dwt_3" description="Average values for Ws in Q sectors."/> + <facet name="fix_analysis_events_dwt" description="Raw event values used in the calculation"/> + <facet name="fix_reference_events_dwt" description="Raw event values used in the calculation"/> + <facet name="fix_analysis_periods_dwt" description="Dateranges of analysis periods."/> + <facet name="fix_deviation_dwt" description="The standard variance"/> + <facet name="fix_deltawt_curve.manualpoints" description="Manual points"/> + <facet name="fix_reference_period_dwt" description="Reference period"/> + </facets> + </outputmode> + <outputmode name="fix_longitudinal_section_curve" description="output.fix_longitudinal_section_curve" mine-type="image/png" type="chart"> + <facets> + <facet name="fix_sector_average_ls_0" description="Average values for Ws in Q sectors."/> + <facet name="fix_sector_average_ls_1" description="Average values for Ws in Q sectors."/> + <facet name="fix_sector_average_ls_2" description="Average values for Ws in Q sectors."/> + <facet name="fix_sector_average_ls_3" description="Average values for Ws in Q sectors."/> + <facet name="fix_sector_average_ls_deviation_0" description="Average values for Ws in Q sectors."/> + <facet name="fix_sector_average_ls_deviation_1" description="Average values for Ws in Q sectors."/> + <facet name="fix_sector_average_ls_deviation_2" description="Average values for Ws in Q sectors."/> + <facet name="fix_sector_average_ls_deviation_3" description="Average values for Ws in Q sectors."/> + <facet name="longitudinal_section.annotations" description="facet.longitudinal_section.annotations"/> + <facet name="fix_deviation_ls" description="The standard variance"/> + <facet name="fix_analysis_events_ls" description="Average values for Ws in Q sectors."/> + <facet name="fix_reference_events_ls" description="Average values for Ws in Q sectors."/> + <facet name="fix_longitudinal_section_curve.manualpoints" description="Manual points"/> + <facet name="other.wqkms.q" description="W-Type of data" /> + <facet name="other.wqkms.w" description="W-Type of data" /> + </facets> + </outputmode> + <outputmode name="fix_derivate_curve" description="output.fix_derivate_curve" mine-type="image/png" type="chart"> + <facets> + <facet name="fix_derivate_curve" description="Derivate curve"/> + <facet name="fix_derivate_curve.manualpoints" description="Manual points"/> + </facets> + </outputmode> + <outputmode name="fix_report" description="output.fix_report.report" mime-type="text/plain" type="report"> + <facets> + <facet name="report" description="facet.fix.report" /> + </facets> + </outputmode> + </outputmodes> + </state> + + <state id="state.fix.vollmer.function" + helpText="help.state.fix.vollmer.function" + description="state.fix.vollmer.function" + state="org.dive4elements.river.artifacts.states.fixation.FunctionSelect"> + <data name="function" type="String"/> + </state> + + <transition transition="org.dive4elements.river.artifacts.transitions.DefaultTransition"> + <from state="state.fix.vollmer.function"/> + <to state="state.fix.vollmer.preprocessing"/> + </transition> + + <state id="state.fix.vollmer.preprocessing" + helpText="help.state.fix.vollmer.preprocessing" + description="state.fix.vollmer.preprocessing" + state="org.dive4elements.river.artifacts.states.fixation.PreprocessingSelect"> + <data name="preprocessing" type="Boolean"/> + </state> + + <transition transition="org.dive4elements.river.artifacts.transitions.DefaultTransition"> + <from state="state.fix.vollmer.preprocessing"/> + <to state="state.fix.vollmer.qs"/> + </transition> + + <state id="state.fix.vollmer.qs" description="state.fix.vollmer.qs" + helpText="help.state.fix.vollmer.qs" + state="org.dive4elements.river.artifacts.states.WQFixing"> + <data name="wq_isq" type="String" /> + <data name="wq_values" type="WQTriple" /> + </state> + + <transition transition="org.dive4elements.river.artifacts.transitions.DefaultTransition"> + <from state="state.fix.vollmer.qs"/> + <to state="state.fix.vollmer.compute"/> + </transition> + + <state id="state.fix.vollmer.compute" + helpText="help.state.fix.vollmer.compute" + description="state.fix.vollmer.compute" + state="org.dive4elements.river.artifacts.states.fixation.FixRealizingCompute"> + <outputmodes> + <outputmode name="longitudinal_section" description="output.longitudinal_section" mime-type="image/png" type="chart"> + <facets> + <facet name="longitudinal_section.w" description="facet.longitudinal_section.w"/> + <facet name="longitudinal_section.q" description="facet.longitudinal_section.q"/> + <facet name="w_differences" description="facet.w_differences"/> + <facet name="other.wkms" description="facet.other.wkms"/> + <facet name="other.wq" description="WQ-Type of data" /> + <facet name="other.wqkms" description="facet.other.wqkms"/> + <facet name="other.wqkms.q" description="W-Type of data" /> + <facet name="other.wqkms.w" description="W-Type of data" /> + <facet name="heightmarks_points" description="facet.other.wkms.heightmarks_points"/> + <facet name="longitudinal_section.annotations" description="facet.longitudinal_section.annotations"/> + <facet name="longitudinal_section.area" description="facet.longitudinal_section.area"/> + <facet name="longitudinal_section.manualpoints" description="Manuelle Punkte"/> + </facets> + </outputmode> + <outputmode name="fix_wq_curve" description="output.fix_wq_curve" mine-type="image/png" type="chart"> + <facets> + <facet name="fix_sector_average_wq_0" description="Average values for Ws in Q sectors."/> + <facet name="fix_sector_average_wq_1" description="Average values for Ws in Q sectors."/> + <facet name="fix_sector_average_wq_2" description="Average values for Ws in Q sectors."/> + <facet name="fix_sector_average_wq_3" description="Average values for Ws in Q sectors."/> + <facet name="fix_analysis_events_wq" description="Raw event values used in the calculation"/> + <facet name="fix_wq_curve" description="WQ curve"/> + <facet name="fix_wq_ls" description="WQ LS curve"/> + <facet name="fix_outlier" description="The outliers"/> + <facet name="qsectors" description="qsectors."/> + <facet name="fix_events_wqkms" description="WQKMS-Type of data" /> + <facet name="other.wqkms.q" description="W-Type of data" /> + <facet name="other.wqkms.w" description="W-Type of data" /> + <facet name="other.wkms" description="facet.other.wqkms"/> + <facet name="other.wqkms" description="facet.other.wqkms"/> + <!--issue1383: facet name="longitudinal_section.w" description="facet.longitudinal_section.w"/--> + <facet name="other.wq" description="Point-like data like fixations"/> + <facet name="heightmarks_points" description="facet.other.wkms.heightmarks_points"/> + <facet name="discharge_curve.curve" description="facet.discharge_curve.curve"/> + <facet name="mainvalues.w" description="facet.fix_wq.mainvalues.w"/> + <facet name="mainvalues.q" description="facet.fix_wq.mainvalues.q"/> + </facets> + </outputmode> + <outputmode name="cross_section" description="output.cross_section" mime-type="image/png" type="chart"> + <facets> + <facet name="cross_section_water_line" description="facet.cross_section_water_line"/> + <facet name="cross_section" description="facet.cross_section"/> + <facet name="area" description="an area"/> + <facet name="cross_section.area" description="an area"/> + <facet name="cross_section.manualpoints" description="points"/> + <facet name="cross_section.manualline" description="line"/> + <facet name="hyk" description="hyks"/> + </facets> + </outputmode> + <outputmode name="fix_wq_curve_at_export" description="output.fix_wq_curve_at_export" mime-type="text/plain" type="export"> + <facets> + <facet name="at" description="facet.fix_wq_curve_export.at"/> + </facets> + </outputmode> + <outputmode name="fix_waterlevel_export" description="output.fix_waterlevel_export" mine-type="text/plain" type="export"> + <facets> + <facet name="csv" description="facet.waterlevel_export.csv" /> + <facet name="wst" description="facet.waterlevel_export.wst" /> + <facet name="pdf" description="facet.waterlevel_export.pdf" /> + </facets> + </outputmode> + <outputmode name="fix_report" description="output.fix_report.report" mime-type="text/plain" type="report"> + <facets> + <facet name="report" description="facet.fix.report" /> + </facets> + </outputmode> + </outputmodes> + </state> + </states> +</artifact>
--- a/artifacts/doc/conf/conf.xml Tue May 15 18:04:36 2018 +0200 +++ b/artifacts/doc/conf/conf.xml Wed May 16 11:08:56 2018 +0200 @@ -24,7 +24,8 @@ <!ENTITY discharge-defaults SYSTEM "generators/discharge-diagram-defaults.xml"> <!ENTITY sinfo_artifact SYSTEM "artifacts/sinfo.xml"> - <!ENTITY uinfo_artifact SYSTEM "artifacts/uinfo.xml"> + <!ENTITY uinfo_artifact SYSTEM "artifacts/uinfo.xml"> + <!ENTITY bundu_artifact SYSTEM "artifacts/bundu.xml"> ]> <artifact-database> <export-secret>YOUR_SECRET</export-secret> @@ -181,9 +182,10 @@ ttl="3600000" artifact="org.dive4elements.river.artifacts.uinfo.UINFOArtifact">org.dive4elements.artifactdatabase.DefaultArtifactFactory</artifact-factory> - <artifact-factory name="uinfo" description="Factory to create an artifact to be used in module uinfo." + <!-- BUNDU specific Artifacts --> + <artifact-factory name="bundu" description="Factory to create an artifact to be used in module bundu." ttl="3600000" - artifact="org.dive4elements.river.artifacts.uinfo.UINFOArtifact">org.dive4elements.artifactdatabase.DefaultArtifactFactory</artifact-factory> + artifact="org.dive4elements.river.artifacts.bundu.BUNDUArtifact">org.dive4elements.artifactdatabase.DefaultArtifactFactory</artifact-factory> <artifact-factory name="tkhxf" description="Factory to create an artifact used in sinfo datacage." ttl="3600000" @@ -329,6 +331,7 @@ &sinfo_artifact; &uinfo_artifact; + &bundu_artifact; </artifacts> &modules;
--- a/artifacts/doc/conf/modules.xml Tue May 15 18:04:36 2018 +0200 +++ b/artifacts/doc/conf/modules.xml Wed May 16 11:08:56 2018 +0200 @@ -1,24 +1,27 @@ <?xml version="1.0" encoding="UTF-8" ?> <modules> <module name="winfo" selected="true"> - <river name="Beispielfluss"/> + <river name="Beispielfluss" /> </module> - <module name="sinfo" group="module.group.ingwerds"> - <river name="Beispielfluss"/> + <module name="sinfo" group="module.group.ingwerds">^ + <river name="Beispielfluss" /> </module> <module name="minfo" group="module.group.ingwerds"> - <river name="Beispielfluss"/> + <river name="Beispielfluss" /> </module> <module name="uinfo" group="module.group.ingwerds"> - <river name="Beispielfluss"/> + <river name="Beispielfluss" /> + </module> + <module name="bundu" group="module.group.ingwerds"> + <river name="Beispielfluss" /> </module> <module name="new_map" group="module.group.bottom"> - <river name="Beispielfluss"/> + <river name="Beispielfluss" /> </module> <module name="new_chart" group="module.group.bottom"> - <river name="Beispielfluss"/> + <river name="Beispielfluss" /> </module> <module name="fixanalysis" group="module.group.bottom"> - <river name="Beispielfluss"/> + <river name="Beispielfluss" /> </module> </modules> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/BUNDUArtifact.java Wed May 16 11:08:56 2018 +0200 @@ -0,0 +1,81 @@ +/* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde + * Software engineering by + * Björnsen Beratende Ingenieure GmbH + * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt + * + * This file is Free Software under the GNU AGPL (>=v3) + * and comes with ABSOLUTELY NO WARRANTY! Check out the + * documentation coming with Dive4Elements River for details. + */ +package org.dive4elements.river.artifacts.bundu; + +import org.apache.commons.lang.StringUtils; +import org.dive4elements.artifactdatabase.state.FacetActivity; +import org.dive4elements.river.artifacts.D4EArtifact; + +/** + * The default BUNDU artifact. + * + * @author Gernot Belger + */ +public class BUNDUArtifact extends D4EArtifact { + + private static final long serialVersionUID = 1L; + + /** Error message that is thrown if no mode has been chosen. */ + private static final String ERROR_NO_CALCULATION_MODE = "error_feed_no_calculation_mode"; + + /** + * Error message that is thrown if an invalid calculation mode has been chosen. + */ + private static final String ERROR_INVALID_CALCULATION_MODE = "error_feed_invalid_calculation_mode"; + + /** The name of the artifact. */ + private static final String ARTIFACT_NAME = "bundu"; + + private static final String FIELD_RIVER = "river"; + + private static final String FIELD_MODE = "calculation_mode"; + + static { + // Active/deactivate facets. + // BEWARE: we can only define one activity for "sinfo", so we use the artifact + // as place for this + FacetActivity.Registry.getInstance().register(ARTIFACT_NAME, (artifact, facet, output) -> null); + } + + /** + * Default constructor, because it's serializable. + */ + public BUNDUArtifact() { + } + + /** + * Returns the name of the concrete artifact. + * + * @return the name of the concrete artifact. + */ + @Override + public String getName() { + return ARTIFACT_NAME; + } + + public BunduCalcMode getCalculationMode() { + + final String calc = getDataAsString(FIELD_MODE); + if (calc == null) { + throw new IllegalArgumentException(ERROR_NO_CALCULATION_MODE); + } + + try { + return BunduCalcMode.valueOf(StringUtils.trimToEmpty(calc).toLowerCase()); + } + catch (final Exception e) { + throw new IllegalArgumentException(ERROR_INVALID_CALCULATION_MODE, e); + } + } + + public String getRiver() { + return getDataAsString(FIELD_RIVER); + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/BunduCalcMode.java Wed May 16 11:08:56 2018 +0200 @@ -0,0 +1,15 @@ +/* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde + * Software engineering by + * Björnsen Beratende Ingenieure GmbH + * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt + * + * This file is Free Software under the GNU AGPL (>=v3) + * and comes with ABSOLUTELY NO WARRANTY! Check out the + * documentation coming with Dive4Elements River for details. + */ + +package org.dive4elements.river.artifacts.bundu; + +public enum BunduCalcMode { + bundu_bezugswst +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZoneAccessHelper.java Wed May 16 11:08:56 2018 +0200 @@ -0,0 +1,67 @@ +/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde + * Software engineering by + * Björnsen Beratende Ingenieure GmbH + * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt + * + * This file is Free Software under the GNU AGPL (>=v3) + * and comes with ABSOLUTELY NO WARRANTY! Check out the + * documentation coming with Dive4Elements River for details. + */ +package org.dive4elements.river.artifacts.uinfo.vegetationzones; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Domenico Nardi Tironi + * + */ +public class VegetationZoneAccessHelper { + // IMMER ABGLEICHEN MIT SuperVegZonesTablePanel.TABLE_CELL_SEPARATOR + private static final String TABLE_CELL_SEPARATOR = "TABLE_CELL_SEPARATOR"; + private static final String TABLE_ROW_SEPARATOR = "TABLE_ROW_SEPARATOR"; + private final String zoneName; + private final int min_day_overflow; + private final int max_day_overflow; + + public static List<VegetationZoneAccessHelper> parse(final String zonesRaw) { + final List<VegetationZoneAccessHelper> resultList = new ArrayList<>(); + + final List<String[]> results = new ArrayList<>(); + if (zonesRaw.contains(TABLE_ROW_SEPARATOR)) { + final String[] rows = zonesRaw.split(TABLE_ROW_SEPARATOR); + for (final String row : rows) { + if (row.contains(TABLE_CELL_SEPARATOR)) { + final String[] result = row.split(TABLE_CELL_SEPARATOR); + results.add(result); + } + } + } + for (final String[] zone : results) { + + final VegetationZoneAccessHelper helper = new VegetationZoneAccessHelper(zone[0], Integer.valueOf(zone[1]), Integer.valueOf(zone[2])); + resultList.add(helper); + } + + return resultList; + } + + private VegetationZoneAccessHelper(final String zone, final Integer min_day_overflow, final Integer max_day_overflow) { + // TODO Auto-generated constructor stub + this.zoneName = zone; + this.min_day_overflow = min_day_overflow; + this.max_day_overflow = max_day_overflow; + } + + public int getMax_day_overflow() { + return this.max_day_overflow; + } + + public String getZoneName() { + return this.zoneName; + } + + public int getMin_day_overflow() { + return this.min_day_overflow; + } +}
--- a/artifacts/src/main/resources/messages.properties Tue May 15 18:04:36 2018 +0200 +++ b/artifacts/src/main/resources/messages.properties Wed May 16 11:08:56 2018 +0200 @@ -752,6 +752,7 @@ module.fixanalysis = Fix Analysis module.new_map = New Map module.new_chart = New Chart +module.bundu = Betrieb und Unterhaltung load_diameter = Bedload Diameter bed_diameter = Bed Diameter @@ -1078,4 +1079,6 @@ uinfo.export.csv.meta.header.veg.dauerbis = \u00dcberflutungsdauer bis [d/a] predefineddepthevol.total.title = Gesamt: {0} -predefineddepthevol.peryear.title = J\u00e4hrlich: {0} \ No newline at end of file +predefineddepthevol.peryear.title = J\u00e4hrlich: {0} + +bundu_bezugswst = Bezugswasserst\u00e4nde \ No newline at end of file
--- a/artifacts/src/main/resources/messages_de.properties Tue May 15 18:04:36 2018 +0200 +++ b/artifacts/src/main/resources/messages_de.properties Wed May 16 11:08:56 2018 +0200 @@ -752,6 +752,7 @@ module.fixanalysis = Fixierungsanalyse module.new_map = Neue Karte module.new_chart = Neues Diagramm +module.bundu = Betrieb und Unterhaltung load_diameter = Geschiebedurchmesser bed_diameter = Sohldurchmesser @@ -1078,4 +1079,6 @@ uinfo.export.csv.meta.header.veg.dauerbis = \u00dcberflutungsdauer bis [d/a] predefineddepthevol.total.title = Gesamt: {0} -predefineddepthevol.peryear.title = J\u00e4hrlich: {0} \ No newline at end of file +predefineddepthevol.peryear.title = J\u00e4hrlich: {0} + +bundu_bezugswst = Bezugswasserst\u00e4nde \ No newline at end of file
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java Tue May 15 18:04:36 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.java Wed May 16 11:08:56 2018 +0200 @@ -1517,4 +1517,6 @@ String uinfo_vegetation_zones_to(); + String bundu(); + } \ No newline at end of file
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties Tue May 15 18:04:36 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties Wed May 16 11:08:56 2018 +0200 @@ -811,4 +811,6 @@ uinfo_vegetation_zone_label = Vegetationszone uinfo_vegetation_zones_label = Vegetationszonen uinfo_vegetation_zones_from = \u00dcfd von [d/a] -uinfo_vegetation_zones_to = \u00dcfd bis [d/a] \ No newline at end of file +uinfo_vegetation_zones_to = \u00dcfd bis [d/a] + +bundu = Betrieb und Unterhaltung \ No newline at end of file
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties Tue May 15 18:04:36 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties Wed May 16 11:08:56 2018 +0200 @@ -811,4 +811,6 @@ uinfo_vegetation_zone_label = Vegetationszone uinfo_vegetation_zones_label = Vegetationszonen uinfo_vegetation_zones_from = \u00dcfd von [d/a] -uinfo_vegetation_zones_to = \u00dcfd bis [d/a] \ No newline at end of file +uinfo_vegetation_zones_to = \u00dcfd bis [d/a] + +bundu = Betrieb und Unterhaltung \ No newline at end of file
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ParameterList.java Tue May 15 18:04:36 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ParameterList.java Wed May 16 11:08:56 2018 +0200 @@ -8,20 +8,11 @@ package org.dive4elements.river.client.client.ui; -import com.google.gwt.core.client.GWT; -import com.google.gwt.user.client.rpc.AsyncCallback; - -import com.smartgwt.client.types.Overflow; -import com.smartgwt.client.types.VerticalAlignment; -import com.smartgwt.client.types.VisibilityMode; -import com.smartgwt.client.util.SC; -import com.smartgwt.client.widgets.Canvas; -import com.smartgwt.client.widgets.layout.HLayout; -import com.smartgwt.client.widgets.layout.SectionStack; -import com.smartgwt.client.widgets.layout.SectionStackSection; -import com.smartgwt.client.widgets.layout.VLayout; -import com.smartgwt.client.widgets.tab.Tab; -import com.smartgwt.client.widgets.tab.events.TabSelectedHandler; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; import org.dive4elements.river.client.client.Config; import org.dive4elements.river.client.client.FLYS; @@ -53,6 +44,7 @@ import org.dive4elements.river.client.client.ui.stationinfo.MeasurementStationPanel; import org.dive4elements.river.client.shared.model.Artifact; import org.dive4elements.river.client.shared.model.ArtifactDescription; +import org.dive4elements.river.client.shared.model.BUNDUArtifact; import org.dive4elements.river.client.shared.model.Collection; import org.dive4elements.river.client.shared.model.Data; import org.dive4elements.river.client.shared.model.DataItem; @@ -69,19 +61,21 @@ import org.dive4elements.river.client.shared.model.UINFOArtifact; import org.dive4elements.river.client.shared.model.WINFOArtifact; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; +import com.google.gwt.core.client.GWT; +import com.google.gwt.user.client.rpc.AsyncCallback; +import com.smartgwt.client.types.Overflow; +import com.smartgwt.client.types.VerticalAlignment; +import com.smartgwt.client.types.VisibilityMode; +import com.smartgwt.client.util.SC; +import com.smartgwt.client.widgets.Canvas; +import com.smartgwt.client.widgets.layout.HLayout; +import com.smartgwt.client.widgets.layout.SectionStack; +import com.smartgwt.client.widgets.layout.SectionStackSection; +import com.smartgwt.client.widgets.layout.VLayout; +import com.smartgwt.client.widgets.tab.Tab; +import com.smartgwt.client.widgets.tab.events.TabSelectedHandler; - -public class ParameterList -extends Tab -implements StepBackHandler, StepForwardHandler, ParameterChangeHandler, - HasParameterChangeHandler, CollectionChangeHandler, - OutputModesChangeHandler, AdvanceHandler -{ +public class ParameterList extends Tab implements StepBackHandler, StepForwardHandler, ParameterChangeHandler, HasParameterChangeHandler, CollectionChangeHandler, OutputModesChangeHandler, AdvanceHandler { private static final long serialVersionUID = 5204784727239299980L; public static final String STYLENAME_OLD_PARAMETERS = "oldParameters"; @@ -90,21 +84,15 @@ protected FLYSConstants MSG = GWT.create(FLYSConstants.class); /** The ArtifactService used to communicate with the Artifact server. */ - protected ArtifactServiceAsync artifactService = - GWT.create(ArtifactService.class); + protected ArtifactServiceAsync artifactService = GWT.create(ArtifactService.class); /** The StepForwardService used to put data into an existing artifact. */ - protected StepForwardServiceAsync forwardService = - GWT.create(StepForwardService.class); + protected StepForwardServiceAsync forwardService = GWT.create(StepForwardService.class); /** The StepForwardService used to put data into an existing artifact. */ - protected AdvanceServiceAsync advanceService = - GWT.create(AdvanceService.class); + protected AdvanceServiceAsync advanceService = GWT.create(AdvanceService.class); - - protected ReportServiceAsync reportService = - GWT.create(ReportService.class); - + protected ReportServiceAsync reportService = GWT.create(ReportService.class); /** The list of ParameterizationChangeHandler. */ protected List<ParameterChangeHandler> parameterHandlers; @@ -117,7 +105,7 @@ protected List<DataList> old; protected Map<String, Canvas> oldStorage; - protected DataList current; + protected DataList current; protected UIProvider uiProvider; @@ -129,51 +117,45 @@ protected VLayout helperPanel; protected VLayout tablePanel; protected InfoPanel infoPanel; - protected Canvas reportPanel; + protected Canvas reportPanel; private SectionStack stack; - public ParameterList(FLYS flys, CollectionView cView, String title) { + public ParameterList(final FLYS flys, final CollectionView cView, final String title) { super(title); this.cView = cView; - this.flys = flys; + this.flys = flys; - parameterHandlers = new ArrayList<ParameterChangeHandler>(); - old = new ArrayList<DataList>(); - oldStorage = new TreeMap<String, Canvas>(); - topLayout = new VLayout(); - oldItems = new VLayout(); - currentItems = new VLayout(); - exportModes = new VLayout(); - report = new VLayout(); + this.parameterHandlers = new ArrayList<ParameterChangeHandler>(); + this.old = new ArrayList<DataList>(); + this.oldStorage = new TreeMap<String, Canvas>(); + this.topLayout = new VLayout(); + this.oldItems = new VLayout(); + this.currentItems = new VLayout(); + this.exportModes = new VLayout(); + this.report = new VLayout(); addParameterChangeHandler(this); init(); } - - public ParameterList( - FLYS flys, - CollectionView cView, - String title, - Artifact artifact) - { + public ParameterList(final FLYS flys, final CollectionView cView, final String title, final Artifact artifact) { super(title); - this.cView = cView; - this.flys = flys; + this.cView = cView; + this.flys = flys; this.artifact = artifact; - parameterHandlers = new ArrayList<ParameterChangeHandler>(); - old = new ArrayList<DataList>(); - oldStorage = new TreeMap<String, Canvas>(); - topLayout = new VLayout(); - oldItems = new VLayout(); - currentItems = new VLayout(); - exportModes = new VLayout(); - report = new VLayout(); + this.parameterHandlers = new ArrayList<ParameterChangeHandler>(); + this.old = new ArrayList<DataList>(); + this.oldStorage = new TreeMap<String, Canvas>(); + this.topLayout = new VLayout(); + this.oldItems = new VLayout(); + this.currentItems = new VLayout(); + this.exportModes = new VLayout(); + this.report = new VLayout(); init(); @@ -182,156 +164,143 @@ setArtifact(artifact, false); } - protected void init() { - HLayout rootLayout = new HLayout(); + final HLayout rootLayout = new HLayout(); rootLayout.setMembersMargin(20); - VLayout left = new VLayout(); + final VLayout left = new VLayout(); - if (old == null || old.size() == 0) { - oldItems.setHeight(1); + if (this.old == null || this.old.size() == 0) { + this.oldItems.setHeight(1); } - oldItems.setMembersMargin(10); - oldItems.setStyleName(STYLENAME_OLD_PARAMETERS); - currentItems.setAlign(VerticalAlignment.TOP); + this.oldItems.setMembersMargin(10); + this.oldItems.setStyleName(STYLENAME_OLD_PARAMETERS); + this.currentItems.setAlign(VerticalAlignment.TOP); left.setMembersMargin(20); left.setWidth(300); - left.addMember(oldItems); - left.addMember(currentItems); - left.addMember(exportModes); - left.addMember(report); + left.addMember(this.oldItems); + left.addMember(this.currentItems); + left.addMember(this.exportModes); + left.addMember(this.report); - reportPanel = new Canvas(); - reportPanel.setHeight("*"); - report.addMember(reportPanel); + this.reportPanel = new Canvas(); + this.reportPanel.setHeight("*"); + this.report.addMember(this.reportPanel); rootLayout.addMember(left); rootLayout.addMember(createSectionStack()); - topLayout.addMember(rootLayout); - if (artifact == null) { - Canvas moduleSelection = renderNew(); + this.topLayout.addMember(rootLayout); + if (this.artifact == null) { + final Canvas moduleSelection = renderNew(); moduleSelection.setLayoutAlign(VerticalAlignment.TOP); - currentItems.addMember(moduleSelection); + this.currentItems.addMember(moduleSelection); } - setPane(topLayout); + setPane(this.topLayout); } - protected SectionStack createSectionStack() { - stack = new SectionStack(); - stack.setHeight100(); - stack.setCanResizeSections(true); - stack.setVisibilityMode(VisibilityMode.MULTIPLE); - stack.setOverflow(Overflow.SCROLL); + this.stack = new SectionStack(); + this.stack.setHeight100(); + this.stack.setCanResizeSections(true); + this.stack.setVisibilityMode(VisibilityMode.MULTIPLE); + this.stack.setOverflow(Overflow.SCROLL); // This canvas is used to render helper widgets. final SectionStackSection helperSection = new SectionStackSection(); helperSection.setExpanded(false); - helperSection.setTitle(MSG.helperPanelTitle()); - helperPanel = new VLayout() { + helperSection.setTitle(this.MSG.helperPanelTitle()); + this.helperPanel = new VLayout() { @Override - public void addMember(Canvas component) { + public void addMember(final Canvas component) { super.addMember(component); - stack.expandSection(helperSection.getID()); + ParameterList.this.stack.expandSection(helperSection.getID()); } @Override - public void removeMembers(Canvas[] components) { + public void removeMembers(final Canvas[] components) { super.removeMembers(components); helperSection.setExpanded(false); } }; - helperPanel.setWidth100(); - helperPanel.setHeight100(); - helperSection.setItems(helperPanel); + this.helperPanel.setWidth100(); + this.helperPanel.setHeight100(); + helperSection.setItems(this.helperPanel); // This canvas is used to render calculation results. final SectionStackSection tableSection = new SectionStackSection(); tableSection.setExpanded(false); - tableSection.setTitle(MSG.calcTableTitle()); - tablePanel = new VLayout() { + tableSection.setTitle(this.MSG.calcTableTitle()); + this.tablePanel = new VLayout() { @Override - public void addMember(Canvas component) { + public void addMember(final Canvas component) { super.addMember(component); tableSection.setExpanded(true); - if (stack.getSection(InfoPanel.SECTION_ID) != null) { - stack.getSection(InfoPanel.SECTION_ID).setExpanded(false); + if (ParameterList.this.stack.getSection(InfoPanel.SECTION_ID) != null) { + ParameterList.this.stack.getSection(InfoPanel.SECTION_ID).setExpanded(false); } } @Override - public void removeMembers(Canvas[] components) { + public void removeMembers(final Canvas[] components) { super.removeMembers(components); tableSection.setExpanded(false); } }; - tablePanel.setHeight100(); - tablePanel.setWidth100(); - tableSection.setItems(tablePanel); + this.tablePanel.setHeight100(); + this.tablePanel.setWidth100(); + tableSection.setItems(this.tablePanel); - stack.setSections(helperSection, tableSection); + this.stack.setSections(helperSection, tableSection); - return stack; + return this.stack; } - /** Sets and forwards artifact. */ - protected void setArtifact(Artifact artifact) { + protected void setArtifact(final Artifact artifact) { setArtifact(artifact, true); } - - protected void setArtifact(Artifact artifact, boolean forward) { - Artifact tmp = this.artifact; + protected void setArtifact(final Artifact artifact, final boolean forward) { + final Artifact tmp = this.artifact; this.artifact = artifact; if (forward) { - fireParameterChangeEvent( - tmp, this.artifact, ParameterChangeEvent.Type.FORWARD); - } - else { - fireParameterChangeEvent( - tmp, this.artifact, ParameterChangeEvent.Type.BACK); + fireParameterChangeEvent(tmp, this.artifact, ParameterChangeEvent.Type.FORWARD); + } else { + fireParameterChangeEvent(tmp, this.artifact, ParameterChangeEvent.Type.BACK); } } - /** * This method registers a new ParameterChangeHandler. * - * @param handler The new ParameterChangeHandler. + * @param handler + * The new ParameterChangeHandler. */ @Override - public void addParameterChangeHandler(ParameterChangeHandler handler) { + public void addParameterChangeHandler(final ParameterChangeHandler handler) { if (handler != null) { - parameterHandlers.add(handler); + this.parameterHandlers.add(handler); } } - /** * This method calls the <code>onParameterChange()</code> method of all * registered ParameterChangeHandler. */ - protected void fireParameterChangeEvent( - Artifact old, - Artifact newArt, - ParameterChangeEvent.Type type) - { - ParameterChangeEvent e = new ParameterChangeEvent(old, newArt, type); + protected void fireParameterChangeEvent(final Artifact old, final Artifact newArt, final ParameterChangeEvent.Type type) { + final ParameterChangeEvent e = new ParameterChangeEvent(old, newArt, type); - for (ParameterChangeHandler handler: parameterHandlers) { + for (final ParameterChangeHandler handler : this.parameterHandlers) { handler.onParameterChange(e); } } - /** * This method creates a Canvas displaying the plugins of FLYS combined with * a widget to select a river. @@ -339,110 +308,99 @@ * @return a Canvas that displays the supported plugins and rivers of FLYS. */ protected Canvas renderNew() { - River[] rivers = flys.getRivers(); - DataItem[] items = new DataItem[rivers.length]; + final River[] rivers = this.flys.getRivers(); + final DataItem[] items = new DataItem[rivers.length]; int i = 0; - for (River river: rivers) { - String name = river.getName(); - String mUuid = river.getModelUuid(); - items[i++] = new DefaultDataItem(name, null, mUuid); + for (final River river : rivers) { + final String name = river.getName(); + final String mUuid = river.getModelUuid(); + items[i++] = new DefaultDataItem(name, null, mUuid); } - Data data = new DefaultData( - "river", - MSG.river_selection(), - null, - items); + final Data data = new DefaultData("river", this.MSG.river_selection(), null, items); - LinkSelection widget = new LinkSelection(); - HasStepForwardHandlers handler = widget; + final LinkSelection widget = new LinkSelection(); + final HasStepForwardHandlers handler = widget; - widget.setContainer(helperPanel); + widget.setContainer(this.helperPanel); handler.addStepForwardHandler(new StepForwardHandler() { private static final long serialVersionUID = -6210719844707004860L; @Override - public void onStepForward(StepForwardEvent event) { + public void onStepForward(final StepForwardEvent event) { lockUI(); - Data[] data = event.getData(); + final Data[] data = event.getData(); - DataItem[] moduleItems = data[0].getItems(); - DataItem[] riversItems = data[1].getItems(); + final DataItem[] moduleItems = data[0].getItems(); + final DataItem[] riversItems = data[1].getItems(); - String module = moduleItems[0].getStringValue(); - String river = riversItems[0].getStringValue(); + final String module = moduleItems[0].getStringValue(); + final String river = riversItems[0].getStringValue(); if (module == null || river == null) { - GWT.log("ParameterList.renderNew(): module == null " - + "|| river == null"); + GWT.log("ParameterList.renderNew(): module == null " + "|| river == null"); unlockUI(); return; } final String newTitle = moduleItems[0].getLabel(); setTitle(newTitle); - Config config = Config.getInstance(); + final Config config = Config.getInstance(); final String locale = config.getLocale(); final Data[] feedData = new Data[] { data[1] }; - artifactService.create( - locale, module.toLowerCase(), null, - new AsyncCallback<Artifact>() { - @Override - public void onFailure(Throwable caught) { - unlockUI(); - GWT.log("Could not create the new artifact."); - SC.warn(FLYS.getExceptionString(MSG, caught)); - } - - @Override - public void onSuccess(Artifact artifact) { - GWT.log("Successfully created a new artifact."); + ParameterList.this.artifactService.create(locale, module.toLowerCase(), null, new AsyncCallback<Artifact>() { + @Override + public void onFailure(final Throwable caught) { + unlockUI(); + GWT.log("Could not create the new artifact."); + SC.warn(FLYS.getExceptionString(ParameterList.this.MSG, caught)); + } - forwardService.go(locale, artifact, feedData, - new AsyncCallback<Artifact>() { - @Override - public void onFailure(Throwable caught) { - unlockUI(); - GWT.log("Could not feed the artifact."); - SC.warn(caught.getMessage()); - } + @Override + public void onSuccess(final Artifact artifact) { + GWT.log("Successfully created a new artifact."); - @Override - public void onSuccess(Artifact artifact) { - GWT.log("Successfully feed the artifact."); - old.clear(); - cView.addArtifactToCollection(artifact); - setArtifact(artifact); - unlockUI(); - } - }); - } + ParameterList.this.forwardService.go(locale, artifact, feedData, new AsyncCallback<Artifact>() { + @Override + public void onFailure(final Throwable caught) { + unlockUI(); + GWT.log("Could not feed the artifact."); + SC.warn(caught.getMessage()); + } + + @Override + public void onSuccess(final Artifact artifact) { + GWT.log("Successfully feed the artifact."); + ParameterList.this.old.clear(); + ParameterList.this.cView.addArtifactToCollection(artifact); + setArtifact(artifact); + unlockUI(); + } + }); + } }); } }); - DataList list = new DataList(); + final DataList list = new DataList(); list.add(data); return widget.create(list); } - protected void clearOldData() { - old.clear(); + this.old.clear(); } - - public void addOldData(DataList old) { + public void addOldData(final DataList old) { addOldData(old, true); } - - public void addOldData(DataList old, boolean redraw) { + public void addOldData(final DataList old, final boolean redraw) { if (old != null) { this.old.add(old); } @@ -450,15 +408,13 @@ refreshOld(redraw); } - - public void addOldDatas(DataList[] old) { + public void addOldDatas(final DataList[] old) { addOldDatas(old, true); } - - public void addOldDatas(DataList[] old, boolean redraw) { + public void addOldDatas(final DataList[] old, final boolean redraw) { if (old != null && old.length > 0) { - for (DataList o: old) { + for (final DataList o : old) { if (o == null) { continue; } @@ -479,15 +435,14 @@ addOldData(null, true); } - - public boolean exists(DataList data) { + public boolean exists(final DataList data) { if (data == null) { return false; } - String stateName = data.getState(); + final String stateName = data.getState(); - for (DataList o: old) { + for (final DataList o : this.old) { if (stateName.equals(o.getState())) { return true; } @@ -496,34 +451,29 @@ return false; } - - public void setCurrentData(DataList current, UIProvider uiProvider) { - this.current = current; + public void setCurrentData(final DataList current, final UIProvider uiProvider) { + this.current = current; this.uiProvider = uiProvider; refreshCurrent(); } - - public void refreshOld(boolean redrawAll) { + public void refreshOld(final boolean redrawAll) { if (redrawAll) { refreshAllOld(); - } - else { - DataList dataList = old.get(old.size()-1); - String state = dataList.getState(); + } else { + final DataList dataList = this.old.get(this.old.size() - 1); + final String state = dataList.getState(); - if (oldStorage.get(state) == null) { - String provider = dataList.getUIProvider(); - UIProvider uiprovider = UIProviderFactory.getProvider( - provider, - flys.getCurrentUser()); + if (this.oldStorage.get(state) == null) { + final String provider = dataList.getUIProvider(); + final UIProvider uiprovider = UIProviderFactory.getProvider(provider, this.flys.getCurrentUser()); ((HasStepBackHandlers) uiprovider).addStepBackHandler(this); - Canvas c = uiprovider.createOld(dataList); + final Canvas c = uiprovider.createOld(dataList); if (c != null) { - oldStorage.put(dataList.getState(), c); - oldItems.addMember(c); + this.oldStorage.put(dataList.getState(), c); + this.oldItems.addMember(c); } } } @@ -531,280 +481,256 @@ updateOldHeight(); } - protected void refreshAllOld() { - List<String> not = new ArrayList<String>(); + final List<String> not = new ArrayList<String>(); - for (DataList data: old) { - String state = data.getState(); + for (final DataList data : this.old) { + final String state = data.getState(); - Canvas c = oldStorage.get(state); + final Canvas c = this.oldStorage.get(state); if (c != null) { not.add(state); } } - Map<String, Canvas> newOld = new TreeMap<String, Canvas>(); + final Map<String, Canvas> newOld = new TreeMap<String, Canvas>(); - Set<Map.Entry<String, Canvas>> entries = oldStorage.entrySet(); - for (Map.Entry<String, Canvas> entry: entries) { - String state = entry.getKey(); - Canvas value = entry.getValue(); + final Set<Map.Entry<String, Canvas>> entries = this.oldStorage.entrySet(); + for (final Map.Entry<String, Canvas> entry : entries) { + final String state = entry.getKey(); + final Canvas value = entry.getValue(); if (not.indexOf(state) < 0) { - oldItems.removeMember(value); - } - else { + this.oldItems.removeMember(value); + } else { newOld.put(state, value); } } - oldStorage = newOld; + this.oldStorage = newOld; } - protected void updateOldHeight() { - int minHeight = oldItems.getMinHeight(); + final int minHeight = this.oldItems.getMinHeight(); if (minHeight <= 20) { - oldItems.setHeight(20); - } - else { - oldItems.setHeight(minHeight); + this.oldItems.setHeight(20); + } else { + this.oldItems.setHeight(minHeight); } } - /** * Refreshes the part displaying the data of the current state. * The UI is created using the UIProvider stored in the Data object. */ public void refreshCurrent() { - currentItems.removeMembers(currentItems.getMembers()); + this.currentItems.removeMembers(this.currentItems.getMembers()); - if (current != null && uiProvider != null) { - Canvas c = uiProvider.create(current); - Canvas h = uiProvider.createHelpLink(current, null, this.flys); + if (this.current != null && this.uiProvider != null) { + final Canvas c = this.uiProvider.create(this.current); + final Canvas h = this.uiProvider.createHelpLink(this.current, null, this.flys); - HLayout wrapper = new HLayout(); + final HLayout wrapper = new HLayout(); wrapper.addMember(h); wrapper.addMember(c); - currentItems.addMember(wrapper); - } - else if (uiProvider != null) { - Canvas c = uiProvider.create(null); + this.currentItems.addMember(wrapper); + } else if (this.uiProvider != null) { + final Canvas c = this.uiProvider.create(null); c.setLayoutAlign(VerticalAlignment.TOP); - currentItems.addMember(c); - } - else { - currentItems.setHeight(1); + this.currentItems.addMember(c); + } else { + this.currentItems.setHeight(1); } - Canvas[] members = currentItems.getMembers(); + final Canvas[] members = this.currentItems.getMembers(); if (members == null || members.length == 0) { - currentItems.setHeight(1); - } - else { + this.currentItems.setHeight(1); + } else { int height = 0; - for (Canvas member: members) { + for (final Canvas member : members) { height += member.getHeight(); } - currentItems.setHeight(height); + this.currentItems.setHeight(height); } } - /** * This method is called if the user clicks on the 'next' button to advance * to the next state. * - * @param event The StepForwardEvent. + * @param event + * The StepForwardEvent. */ @Override - public void onStepForward(StepForwardEvent event) { + public void onStepForward(final StepForwardEvent event) { GWT.log("CollectionView - onStepForward()"); lockUI(); - Config config = Config.getInstance(); - String locale = config.getLocale(); + final Config config = Config.getInstance(); + final String locale = config.getLocale(); - forwardService.go(locale, artifact, event.getData(), - new AsyncCallback<Artifact>() { - @Override - public void onFailure(Throwable caught) { - unlockUI(); - GWT.log("Could not feed the artifact."); - SC.warn(FLYS.getExceptionString(MSG, caught)); - } + this.forwardService.go(locale, this.artifact, event.getData(), new AsyncCallback<Artifact>() { + @Override + public void onFailure(final Throwable caught) { + unlockUI(); + GWT.log("Could not feed the artifact."); + SC.warn(FLYS.getExceptionString(ParameterList.this.MSG, caught)); + } - @Override - public void onSuccess(Artifact artifact) { - GWT.log("Successfully feed the artifact."); - old.clear(); + @Override + public void onSuccess(final Artifact artifact) { + GWT.log("Successfully feed the artifact."); + ParameterList.this.old.clear(); - setArtifact(artifact, true); - unlockUI(); - } + setArtifact(artifact, true); + unlockUI(); + } }); } - /** * This method is used to remove all old items from this list after the user * has clicked the step back button. * - * @param e The StepBackEvent that holds the identifier of the target state. + * @param e + * The StepBackEvent that holds the identifier of the target state. */ @Override - public void onStepBack(StepBackEvent e) { + public void onStepBack(final StepBackEvent e) { lockUI(); - final String target = e.getTarget(); - - Config config = Config.getInstance(); - final String locale = config.getLocale(); + final String target = e.getTarget(); - advanceService.advance(locale, artifact, target, - new AsyncCallback<Artifact>() { - @Override - public void onFailure(Throwable caught) { - unlockUI(); - GWT.log("Could not go back to '" + target + "'"); - SC.warn(FLYS.getExceptionString(MSG, caught)); - } + final Config config = Config.getInstance(); + final String locale = config.getLocale(); - @Override - public void onSuccess(Artifact artifact) { - GWT.log("Successfully step back to '" + target + "'"); - - old.clear(); + this.advanceService.advance(locale, this.artifact, target, new AsyncCallback<Artifact>() { + @Override + public void onFailure(final Throwable caught) { + unlockUI(); + GWT.log("Could not go back to '" + target + "'"); + SC.warn(FLYS.getExceptionString(ParameterList.this.MSG, caught)); + } - setArtifact(artifact, false); - unlockUI(); - } + @Override + public void onSuccess(final Artifact artifact) { + GWT.log("Successfully step back to '" + target + "'"); + + ParameterList.this.old.clear(); + + setArtifact(artifact, false); + unlockUI(); } - ); + }); } - @Override public void onAdvance(final String target) { - Config config = Config.getInstance(); - final String locale = config.getLocale(); - - advanceService.advance(locale, artifact, target, - new AsyncCallback<Artifact>() { - @Override - public void onFailure(Throwable caught) { - GWT.log("Could not go to '" + target + "'"); - SC.warn(FLYS.getExceptionString(MSG, caught)); - } + final Config config = Config.getInstance(); + final String locale = config.getLocale(); - @Override - public void onSuccess(Artifact artifact) { - GWT.log("Successfully advanced to '" + target + "'"); - - old.clear(); + this.advanceService.advance(locale, this.artifact, target, new AsyncCallback<Artifact>() { + @Override + public void onFailure(final Throwable caught) { + GWT.log("Could not go to '" + target + "'"); + SC.warn(FLYS.getExceptionString(ParameterList.this.MSG, caught)); + } - setArtifact(artifact, true); - } + @Override + public void onSuccess(final Artifact artifact) { + GWT.log("Successfully advanced to '" + target + "'"); + + ParameterList.this.old.clear(); + + setArtifact(artifact, true); } - ); + }); } - /** * Implements the onCollectionChange() method to do update the GUI after the * parameterization has changed. * - * @param event The ParameterChangeEvent. + * @param event + * The ParameterChangeEvent. */ @Override - public void onParameterChange(ParameterChangeEvent event) { + public void onParameterChange(final ParameterChangeEvent event) { GWT.log("ParameterList.onParameterChange"); - Canvas[] c = helperPanel.getMembers(); + final Canvas[] c = this.helperPanel.getMembers(); if (c != null && c.length > 0) { - helperPanel.removeMembers(c); + this.helperPanel.removeMembers(c); } - Artifact art = event.getNewValue(); - ArtifactDescription desc = art.getArtifactDescription(); + final Artifact art = event.getNewValue(); + final ArtifactDescription desc = art.getArtifactDescription(); - DataList currentData = desc.getCurrentData(); + final DataList currentData = desc.getCurrentData(); if (currentData != null) { // the user has to enter some attributes - String uiProvider = currentData.getUIProvider(); - UIProvider provider = UIProviderFactory.getProvider( - uiProvider, - flys.getCurrentUser()); + final String uiProvider = currentData.getUIProvider(); + final UIProvider provider = UIProviderFactory.getProvider(uiProvider, this.flys.getCurrentUser()); - provider.setContainer(helperPanel); + provider.setContainer(this.helperPanel); provider.setArtifact(art); - provider.setCollection(cView.getCollection()); + provider.setCollection(this.cView.getCollection()); provider.setParameterList(this); ((HasStepForwardHandlers) provider).addStepForwardHandler(this); ((HasStepBackHandlers) provider).addStepBackHandler(this); setCurrentData(currentData, provider); - } - else { - String[] reachable = desc.getReachableStates(); + } else { + final String[] reachable = desc.getReachableStates(); if (reachable != null && reachable.length > 0) { // We have reached a final state with the option to step to // further to a next state. But in the current state, no user // data is required. - UIProvider ui = UIProviderFactory.getProvider("continue", null); + final UIProvider ui = UIProviderFactory.getProvider("continue", null); ui.setArtifact(art); - ui.setCollection(cView.getCollection()); + ui.setCollection(this.cView.getCollection()); ui.setParameterList(this); ((ContinuePanel) ui).addAdvanceHandler(this); setCurrentData(null, ui); - } - else { + } else { // we have reached a final state with no more user input setCurrentData(null, null); } } - // FIXME: we got a whole artifact framework to separate ui and backend stuff, but in the end.... we have switches over specific datatypes here... - if (art instanceof WINFOArtifact - || art instanceof SINFOArtifact - || art instanceof UINFOArtifact - || art instanceof FixAnalysisArtifact) { + // FIXME: we got a whole artifact framework to separate ui and backend stuff, but in the end.... we have switches over + // specific datatypes here... + if (art instanceof WINFOArtifact || art instanceof SINFOArtifact || art instanceof UINFOArtifact || art instanceof FixAnalysisArtifact + || art instanceof BUNDUArtifact) { createGaugePanel(); renderInfo(desc.getRiver(), desc.getOldData()); - } - else if (art instanceof MINFOArtifact) { + } else if (art instanceof MINFOArtifact) { createMeasurementStationPanel(); renderInfo(desc.getRiver(), desc.getOldData()); - } - else { + } else { removeInfoPanel(); } - addOldDatas( - desc.getOldData(), - event.getType() == ParameterChangeEvent.Type.BACK); + addOldDatas(desc.getOldData(), event.getType() == ParameterChangeEvent.Type.BACK); } - @Override - public void onCollectionChange(CollectionChangeEvent event) { - Collection c = event.getNewValue(); - Map<String, OutputMode> outs = c.getOutputModes(); - Set<String> keys = outs.keySet(); + public void onCollectionChange(final CollectionChangeEvent event) { + final Collection c = event.getNewValue(); + final Map<String, OutputMode> outs = c.getOutputModes(); + final Set<String> keys = outs.keySet(); - OutputMode[] outputs = new OutputMode[outs.size()]; + final OutputMode[] outputs = new OutputMode[outs.size()]; int idx = 0; - for (String outname: keys) { + for (final String outname : keys) { outputs[idx++] = outs.get(outname); } @@ -812,46 +738,43 @@ updateReportModes(c, getReportModes(outputs)); } - @Override - public void onOutputModesChange(OutputModesChangeEvent event) { + public void onOutputModesChange(final OutputModesChangeEvent event) { - Collection c = cView.getCollection(); + final Collection c = this.cView.getCollection(); if (c != null) { - OutputMode [] outs = event.getOutputModes(); + final OutputMode[] outs = event.getOutputModes(); updateExportModes(c, getExportModes(outs)); updateReportModes(c, getReportModes(outs)); } } + protected List<ReportMode> getReportModes(final OutputMode[] outs) { - protected List<ReportMode> getReportModes(OutputMode [] outs) { - - List<ReportMode> reports = new ArrayList<ReportMode>(); + final List<ReportMode> reports = new ArrayList<ReportMode>(); if (outs == null || outs.length == 0) { return reports; } - for (OutputMode out: outs) { + for (final OutputMode out : outs) { if (out instanceof ReportMode) { - reports.add((ReportMode)out); + reports.add((ReportMode) out); } } return reports; } - - protected List<ExportMode> getExportModes(OutputMode[] outs) { - List<ExportMode> exports = new ArrayList<ExportMode>(); + protected List<ExportMode> getExportModes(final OutputMode[] outs) { + final List<ExportMode> exports = new ArrayList<ExportMode>(); if (outs == null || outs.length == 0) { return exports; } - for (OutputMode out: outs) { + for (final OutputMode out : outs) { if (out instanceof ExportMode) { exports.add((ExportMode) out); } @@ -860,129 +783,119 @@ return exports; } - - protected void updateExportModes(Collection c, List<ExportMode> exports) { - int num = exports != null ? exports.size() : 0; + protected void updateExportModes(final Collection c, final List<ExportMode> exports) { + final int num = exports != null ? exports.size() : 0; GWT.log("Update export modes: " + num); - exportModes.removeMembers(exportModes.getMembers()); + this.exportModes.removeMembers(this.exportModes.getMembers()); if (exports.size() > 0) { - exportModes.addMember(new ExportPanel(c, exports)); - } - else { - exportModes.setHeight(1); + this.exportModes.addMember(new ExportPanel(c, exports)); + } else { + this.exportModes.setHeight(1); } } - protected void updateReportModes(Collection c, List<ReportMode> reports) { - int num = reports != null ? reports.size() : 0; + protected void updateReportModes(final Collection c, final List<ReportMode> reports) { + final int num = reports != null ? reports.size() : 0; GWT.log("Update report modes: " + num); if (num == 0) { - reportPanel.setContents(""); + this.reportPanel.setContents(""); return; } - Config config = Config.getInstance(); - String locale = config.getLocale(); + final Config config = Config.getInstance(); + final String locale = config.getLocale(); - String cid = c.identifier(); + final String cid = c.identifier(); - for (ReportMode report: reports) { + for (final ReportMode report : reports) { GWT.log("report '" + report.toString() + "'"); - reportService.report(cid, locale, report.getName(), - new AsyncCallback<String>() { - @Override - public void onFailure(Throwable caught) { - SC.warn(FLYS.getExceptionString(MSG, caught)); - } + this.reportService.report(cid, locale, report.getName(), new AsyncCallback<String>() { + @Override + public void onFailure(final Throwable caught) { + SC.warn(FLYS.getExceptionString(ParameterList.this.MSG, caught)); + } - @Override - public void onSuccess(String msg) { - setReportMessage(msg); - } - }); + @Override + public void onSuccess(final String msg) { + setReportMessage(msg); + } + }); } } - /** Sets content of reportPanel. */ protected void setReportMessage(String msg) { GWT.log("returned from service: " + msg); if (msg == null) { msg = ""; } - reportPanel.setContents(msg); + this.reportPanel.setContents(msg); } - /** * Adds a table to the parameterlist to show calculated data. * - * @param table The table data panel. + * @param table + * The table data panel. */ - public void setTable(TableDataPanel table) { + public void setTable(final TableDataPanel table) { removeTable(); - Canvas c = table.create(); + final Canvas c = table.create(); c.setHeight100(); c.setWidth100(); - tablePanel.addMember(c); + this.tablePanel.addMember(c); } - public boolean hasTable() { - Canvas[] members = tablePanel.getMembers(); + final Canvas[] members = this.tablePanel.getMembers(); return members != null && members.length > 0; } - /** * Removes the table from the parameter list. */ public void removeTable() { - Canvas[] members = tablePanel.getMembers(); + final Canvas[] members = this.tablePanel.getMembers(); if (members != null && members.length > 0) { - tablePanel.removeMembers(members); + this.tablePanel.removeMembers(members); } } - - public void registerCollectionViewTabHandler(TabSelectedHandler tsh) { + public void registerCollectionViewTabHandler(final TabSelectedHandler tsh) { this.cView.registerTabHandler(tsh); } - protected void lockUI() { - cView.lockUI(); + this.cView.lockUI(); } - protected void unlockUI() { - cView.unlockUI(); + this.cView.unlockUI(); } - private void createGaugePanel() { GWT.log("ParameterList - createGaugePanel"); - if (infoPanel == null) { - infoPanel = new GaugePanel(flys); - infoPanel.setWidth100(); - infoPanel.setHeight100(); + if (this.infoPanel == null) { + this.infoPanel = new GaugePanel(this.flys); + this.infoPanel.setWidth100(); + this.infoPanel.setHeight100(); } } private void createMeasurementStationPanel() { GWT.log("ParameterList - createMeasurementStationPanel"); - if (infoPanel == null) { - infoPanel = new MeasurementStationPanel(flys); - infoPanel.setWidth100(); - infoPanel.setHeight100(); + if (this.infoPanel == null) { + this.infoPanel = new MeasurementStationPanel(this.flys); + this.infoPanel.setWidth100(); + this.infoPanel.setHeight100(); } } @@ -990,14 +903,14 @@ GWT.log("ParameterList - showInfoPanel"); /* Don't add InfoPanel twice */ - SectionStackSection info = stack.getSection(InfoPanel.SECTION_ID); + SectionStackSection info = this.stack.getSection(InfoPanel.SECTION_ID); if (info == null) { info = new SectionStackSection(); - info.setTitle(infoPanel.getSectionTitle()); + info.setTitle(this.infoPanel.getSectionTitle()); info.setID(InfoPanel.SECTION_ID); info.setName(InfoPanel.SECTION_ID); - info.setItems(infoPanel); - stack.addSection(info, 0); + info.setItems(this.infoPanel); + this.stack.addSection(info, 0); } info.setExpanded(true); @@ -1006,29 +919,27 @@ private void hideInfoPanel() { GWT.log("ParameterList - hideInfoPanel"); - if (infoPanel != null) { - infoPanel.hide(); + if (this.infoPanel != null) { + this.infoPanel.hide(); } } private void removeInfoPanel() { GWT.log("ParameterList - removeInfoPanel"); - SectionStackSection exists = stack.getSection(InfoPanel.SECTION_ID); + final SectionStackSection exists = this.stack.getSection(InfoPanel.SECTION_ID); if (exists != null) { - stack.removeSection(InfoPanel.SECTION_ID); + this.stack.removeSection(InfoPanel.SECTION_ID); } } - - private void renderInfo(String river, DataList[] data) { + private void renderInfo(final String river, final DataList[] data) { GWT.log("ParameterList - renderInfo"); if (river != null) { showInfoPanel(); - infoPanel.setRiver(river); - infoPanel.setData(data); - } - else { + this.infoPanel.setRiver(river); + this.infoPanel.setData(data); + } else { GWT.log("ParameterList - renderInfo no river"); hideInfoPanel(); }
--- a/gwt-client/src/main/java/org/dive4elements/river/client/server/FLYSArtifactCreator.java Tue May 15 18:04:36 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/FLYSArtifactCreator.java Wed May 16 11:08:56 2018 +0200 @@ -13,30 +13,25 @@ import javax.xml.xpath.XPathConstants; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NodeList; - import org.apache.log4j.Logger; - -import org.dive4elements.artifacts.common.utils.XMLUtils; import org.dive4elements.artifacts.common.ArtifactNamespaceContext; - +import org.dive4elements.artifacts.common.utils.XMLUtils; import org.dive4elements.artifacts.httpclient.utils.ArtifactCreator; - import org.dive4elements.river.client.shared.model.Artifact; import org.dive4elements.river.client.shared.model.CalculationMessage; import org.dive4elements.river.client.shared.model.ChartArtifact; import org.dive4elements.river.client.shared.model.DefaultArtifact; import org.dive4elements.river.client.shared.model.FixAnalysisArtifact; import org.dive4elements.river.client.shared.model.GaugeDischargeCurveArtifact; +import org.dive4elements.river.client.shared.model.MINFOArtifact; import org.dive4elements.river.client.shared.model.MapArtifact; import org.dive4elements.river.client.shared.model.SINFOArtifact; -import org.dive4elements.river.client.shared.model.MINFOArtifact; import org.dive4elements.river.client.shared.model.StaticSQRelationArtifact; import org.dive4elements.river.client.shared.model.UINFOArtifact; import org.dive4elements.river.client.shared.model.WINFOArtifact; - +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; /** * An implementation of an {@link ArtifactCreator}. This class uses the document @@ -47,28 +42,25 @@ */ public class FLYSArtifactCreator implements ArtifactCreator { - private static final Logger log = - Logger.getLogger(FLYSArtifactCreator.class); + private static final Logger log = Logger.getLogger(FLYSArtifactCreator.class); - - /** The XPath to the artifact's uuid.*/ + /** The XPath to the artifact's uuid. */ public static final String XPATH_UUID = "/art:result/art:uuid/@art:value"; - /** The XPath to the artifact's hash value.*/ + /** The XPath to the artifact's hash value. */ public static final String XPATH_HASH = "/art:result/art:hash/@art:value"; - /** The XPath to the artifact's name value.*/ + /** The XPath to the artifact's name value. */ public static final String XPATH_NAME = "/art:result/art:name/@art:value"; - /** The XPath to the value that determines if the artifact is processing in - * background.*/ - public static final String XPATH_BACKGROUND_VALUE = - "/art:result/art:background-processing/@art:value"; + /** + * The XPath to the value that determines if the artifact is processing in + * background. + */ + public static final String XPATH_BACKGROUND_VALUE = "/art:result/art:background-processing/@art:value"; - /** The XPath that points to the (if existing) background messages.*/ - public static final String XPATH_BACKGROUND = - "/art:result/art:background-processing"; - + /** The XPath that points to the (if existing) background messages. */ + public static final String XPATH_BACKGROUND = "/art:result/art:background-processing"; /** * Creates a new instance of an {@link ArtifactCreator}. @@ -76,54 +68,50 @@ public FLYSArtifactCreator() { } - /** * This concreate implementation returns an instance of {@link Artifact} * that is used in the FLYS GWT Client code. * - * @param doc A document that describes the artifact that has been created - * in the artifact server. + * @param doc + * A document that describes the artifact that has been created + * in the artifact server. * * @return an instance if {@link Artifact}. */ - public Object create(Document doc) { - Artifact artifact = extractArtifact(doc); - artifact.setArtifactDescription( - ArtifactDescriptionFactory.createArtifactDescription(doc)); + @Override + public Object create(final Document doc) { + final Artifact artifact = extractArtifact(doc); + artifact.setArtifactDescription(ArtifactDescriptionFactory.createArtifactDescription(doc)); return artifact; } - /** * This method extracts the UUID und HASH information of the returned * artifact document. * - * @param doc The result of the CREATE operation. + * @param doc + * The result of the CREATE operation. * * @return an instance of an {@link Artifact}. */ - protected Artifact extractArtifact(Document doc) { + protected Artifact extractArtifact(final Document doc) { log.debug("FLYSArtifactCreator - extractArtifact()"); - String uuid = XMLUtils.xpathString( - doc, XPATH_UUID, ArtifactNamespaceContext.INSTANCE); + final String uuid = XMLUtils.xpathString(doc, XPATH_UUID, ArtifactNamespaceContext.INSTANCE); - String hash = XMLUtils.xpathString( - doc, XPATH_HASH, ArtifactNamespaceContext.INSTANCE); + final String hash = XMLUtils.xpathString(doc, XPATH_HASH, ArtifactNamespaceContext.INSTANCE); - String name = XMLUtils.xpathString( - doc, XPATH_NAME, ArtifactNamespaceContext.INSTANCE); + String name = XMLUtils.xpathString(doc, XPATH_NAME, ArtifactNamespaceContext.INSTANCE); - String backgroundStr = XMLUtils.xpathString( - doc, XPATH_BACKGROUND_VALUE, ArtifactNamespaceContext.INSTANCE); + final String backgroundStr = XMLUtils.xpathString(doc, XPATH_BACKGROUND_VALUE, ArtifactNamespaceContext.INSTANCE); boolean background = false; if (backgroundStr != null && backgroundStr.length() > 0) { background = Boolean.valueOf(backgroundStr); } - List<CalculationMessage> msg = parseBackgroundMessages(doc); + final List<CalculationMessage> msg = parseBackgroundMessages(doc); log.debug("NEW Artifact UUID: " + uuid); log.debug("NEW Artifact HASH: " + hash); @@ -136,7 +124,8 @@ name = name.trim(); - // FIXME: why do we have a super sophisticated artifact-framework if, in the end, module dependent stuff is still switched manually.... + // FIXME: why do we have a super sophisticated artifact-framework if, in the end, module dependent stuff is still + // switched manually.... if (name.equals("winfo")) { log.debug("+++++ NEW WINFO ARTIFACT."); return new WINFOArtifact(uuid, hash, background, msg); @@ -146,27 +135,27 @@ log.debug("+++++ NEW MAP ARTIFACT."); return new MapArtifact(uuid, hash, background, msg); } - + if (name.equals("new_chart")) { log.debug("+++++ NEW CHART ARTIFACT."); return new ChartArtifact(uuid, hash, background, msg); } - + if (name.equals("minfo")) { log.debug("+++++ NEW MINFO ARTIFACT."); return new MINFOArtifact(uuid, hash, background, msg); } - + if (name.equals("fixanalysis")) { log.debug("+++++ NEW FIXANALYSIS ARTIFACT."); return new FixAnalysisArtifact(uuid, hash, background, msg); } - + if (name.equals("gaugedischargecurve")) { log.debug("+++++ NEW GAUGEDISCHARGECURVE ARTIFACT."); return new GaugeDischargeCurveArtifact(uuid, hash, background, msg); } - + if (name.equals("staticsqrelation")) { log.debug("+++++ STATICSQRELATION ARTIFACT."); return new StaticSQRelationArtifact(uuid, hash, background, msg); @@ -178,28 +167,27 @@ } if (name.equals("uinfo")) { - log.debug("+++++ NEW UINFO ARTIFACT."); - return new UINFOArtifact(uuid, hash, background, msg); + log.debug("+++++ NEW UINFO ARTIFACT."); + return new UINFOArtifact(uuid, hash, background, msg); } - + if (name.equals("bundu")) { + log.debug("+++++ NEW BUNDU ARTIFACT."); + return new UINFOArtifact(uuid, hash, background, msg); + } return new DefaultArtifact(uuid, hash, background, msg); } + public static List<CalculationMessage> parseBackgroundMessages(final Document d) { + final NodeList list = (NodeList) XMLUtils.xpath(d, XPATH_BACKGROUND, XPathConstants.NODESET, ArtifactNamespaceContext.INSTANCE); - public static List<CalculationMessage> parseBackgroundMessages(Document d) { - NodeList list = (NodeList) XMLUtils.xpath( - d, XPATH_BACKGROUND, XPathConstants.NODESET, - ArtifactNamespaceContext.INSTANCE); - - int len = list != null ? list.getLength() : 0; + final int len = list != null ? list.getLength() : 0; log.debug("Found " + len + " background messages."); - List<CalculationMessage> res = new ArrayList<CalculationMessage>(len); + final List<CalculationMessage> res = new ArrayList<CalculationMessage>(len); for (int i = 0; i < len; i++) { - CalculationMessage msg = parseBackgroundMessage( - (Element) list.item(i)); + final CalculationMessage msg = parseBackgroundMessage((Element) list.item(i)); if (msg != null) { res.add(msg); @@ -209,25 +197,21 @@ return res; } + public static CalculationMessage parseBackgroundMessage(final Element e) { + final String steps = e.getAttribute("art:steps"); + final String currentStep = e.getAttribute("art:currentStep"); + final String message = e.getTextContent(); - public static CalculationMessage parseBackgroundMessage(Element e) { - String steps = e.getAttribute("art:steps"); - String currentStep = e.getAttribute("art:currentStep"); - String message = e.getTextContent(); - - int lenCurStep = currentStep != null ? currentStep.length() : 0; - int lenSteps = steps != null ? steps.length() : 0; - int lenMessage = message != null ? message.length() : 0; + final int lenCurStep = currentStep != null ? currentStep.length() : 0; + final int lenSteps = steps != null ? steps.length() : 0; + final int lenMessage = message != null ? message.length() : 0; if (lenSteps > 0 && lenMessage > 0 && lenCurStep > 0) { try { - return new CalculationMessage( - Integer.parseInt(steps), - Integer.parseInt(currentStep), - message); + return new CalculationMessage(Integer.parseInt(steps), Integer.parseInt(currentStep), message); } - catch (NumberFormatException nfe) { + catch (final NumberFormatException nfe) { nfe.printStackTrace(); } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/BUNDUArtifact.java Wed May 16 11:08:56 2018 +0200 @@ -0,0 +1,36 @@ +/* Copyright (C) 2017 by Bundesanstalt für Gewässerkunde + * Software engineering by Intevation GmbH + * + * This file is Free Software under the GNU AGPL (>=v3) + * and comes with ABSOLUTELY NO WARRANTY! Check out the + * documentation coming with Dive4Elements River for details. + */ + +package org.dive4elements.river.client.shared.model; + +import java.util.List; + +/** + * The BUNDU implementation of an Artifact. + * + * @author Gernot Belger + */ +public class BUNDUArtifact extends DefaultArtifact { + + /** The name of this artifact: 'bundu'. */ + private static final String NAME = "bundu"; + + /** Necessary for serialization */ + public BUNDUArtifact() { + } + + public BUNDUArtifact(final String uuid, final String hash, final boolean inBackground, final List<CalculationMessage> messages) { + super(uuid, hash, inBackground, messages); + } + + @Override + public String getName() { + return NAME; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gwt-client/src/main/webapp/WEB-INF/features.xml Tue May 15 18:04:36 2018 +0200 +++ b/gwt-client/src/main/webapp/WEB-INF/features.xml Wed May 16 11:08:56 2018 +0200 @@ -5,6 +5,7 @@ <ftr:feature>module:winfo</ftr:feature> <ftr:feature>module:minfo</ftr:feature> <ftr:feature>module:uinfo</ftr:feature> + <ftr:feature>module:bundu</ftr:feature> <ftr:feature>module:new_map</ftr:feature> <ftr:feature>module:new_chart</ftr:feature> <ftr:feature>module:fixanalysis</ftr:feature>