Displaying differences for changeset
 
display as  

src/java/m/hydraulics/channelgeometry/V1_0.java

@@ -4,6 +4,8 @@
 import csip.annotations.Name;
 import csip.annotations.VersionInfo;
 import csip.ModelDataService;
+import csip.PayloadParameter;
+import csip.PayloadResults;
 import hydraulics.ChannelGeometry;
 import javax.ws.rs.Path;
 
@@ -14,33 +16,38 @@
 public class V1_0 extends ModelDataService {
 
     ChannelGeometry model = new ChannelGeometry();
+    
+    @Override
+    protected void preProcess() throws Exception {
+        PayloadParameter inputPayload = parameter();
+        model.setDepthType(inputPayload.getString("depthType"));
+        model.setDepth(inputPayload.getDouble("depth"));
+        model.setIrregularGeometryTF(inputPayload.getBoolean("irregularGeometry"));
+        model.setBottomWidth(inputPayload.getDouble("bottomWidth"));
+        model.setSideSlope(inputPayload.getDouble("sideSlope"));
+        model.setDischarge(inputPayload.getDouble("discharge"));
+        model.setBedSlope(inputPayload.getDouble("bedSlope"));
+        model.setManningRoughness(inputPayload.getDouble("manningRoughness"));
+        model.setCrossSection(inputPayload.getString("crossSection"));
+    }
 
     @Override
     protected void doProcess() throws Exception {
-        model.setDepthType(getStringParam("depthType"));
-        model.setDepth(getDoubleParam("depth"));
-        model.setIrregularGeometryTF(getBooleanParam("irregularGeometry"));
-        model.setBottomWidth(getDoubleParam("bottomWidth"));
-        model.setSideSlope(getDoubleParam("sideSlope"));
-        model.setDischarge(getDoubleParam("discharge"));
-        model.setBedSlope(getDoubleParam("bedSlope"));
-        model.setManningRoughness(getDoubleParam("manningRoughness"));
-        model.setCrossSection(getStringParam("crossSection"));
-
         model.run();
     }
 
     @Override
     protected void postProcess() throws Exception {
+        PayloadResults resultPayload = results();
         // files
 
         // values
-        putResult("depth", model.getDepth());
-        putResult("area", model.getArea());
-        putResult("wettedPerimeter", model.getWettedPerimeter());
-        putResult("topWidth", model.getTopWidth());
-        putResult("hydraulicRadius", model.getHydraulicRadius());
-        putResult("hydraulicDepth", model.getHydraulicDepth());
-        putResult("warning", model.getWarningMessage());
+        resultPayload.put("depth", model.getDepth());
+        resultPayload.put("area", model.getArea());
+        resultPayload.put("wettedPerimeter", model.getWettedPerimeter());
+        resultPayload.put("topWidth", model.getTopWidth());
+        resultPayload.put("hydraulicRadius", model.getHydraulicRadius());
+        resultPayload.put("hydraulicDepth", model.getHydraulicDepth());
+        resultPayload.put("warning", model.getWarningMessage());
     }
 }

src/java/m/hydraulics/effectivedischarge/V1_0.java

@@ -4,6 +4,8 @@
 import csip.annotations.Name;
 import csip.annotations.VersionInfo;
 import csip.ModelDataService;
+import csip.PayloadParameter;
+import csip.PayloadResults;
 import java.io.File;
 import javax.ws.rs.Path;
 
@@ -14,45 +16,51 @@
 public class V1_0 extends ModelDataService {
 
     EffectiveDischarge model = new EffectiveDischarge();
+    
+    @Override
+    protected void preProcess() throws Exception {
+        model.setMainFolder(getWorkspaceDir().toString());
+        
+        PayloadParameter inputPayload = parameter();
+        model.setFlowDurationCurve(inputPayload.getString("flowDurationCurve"));
+        model.setManningRoughness(inputPayload.getDouble("manningRoughness"));
+        model.setCrossSection(inputPayload.getString("crossSection"));
+        model.setTransportType(inputPayload.getString("transportType"));
+        model.setWaterDensity(inputPayload.getDouble("rho"));
+        model.setWaterTemperature(inputPayload.getDouble("waterTemp"));
+        model.setWaterKinematicViscosity(inputPayload.getDouble("waterKinViscosity"));
+        model.setSedDensity(inputPayload.getDouble("rho_S"));
+        model.setGravelDensity(inputPayload.getDouble("rho_G"));
+        model.setSedDiameter(inputPayload.getDouble("diamSed"));
+        model.setGravelDiameter(inputPayload.getDouble("diamGravel"));
+        model.setSandFraction(inputPayload.getDouble("sandFraction"));
+        model.setSedD16(inputPayload.getDouble("d16"));
+        model.setSedD50(inputPayload.getDouble("d50"));
+        model.setSedD84(inputPayload.getDouble("d84"));
+        model.setR1(inputPayload.getDouble("R1"));
+        model.setR2(inputPayload.getDouble("R2"));
+        model.setRatingCurveUnits(inputPayload.getString("ratingCurveUnits"));
+        model.setChannelBottomWidth(inputPayload.getDouble("width"));
+        model.setChannelBedSlope(inputPayload.getDouble("bedSlope"));
+        model.setChannelEnergySlope(inputPayload.getDouble("energySlope"));
+        model.setChannelFrictionSlope(inputPayload.getDouble("frictionSlope"));
+        model.setNumberOfPoints(inputPayload.getInt("numberOfInterpolationPoints"));
+        model.setLogarithmicBins_TF(inputPayload.getBoolean("logarithmicBins_TF"));
+        model.setUScustomaryOutputUnits_TF(inputPayload.getBoolean("UScustomaryOutputUnits_TF"));
+    }
 
     @Override
     protected void doProcess() throws Exception {
-        model.setMainFolder(getWorkspaceDir().toString());
-        model.setFlowDurationCurve(getStringParam("flowDurationCurve"));
-        model.setManningRoughness(getDoubleParam("manningRoughness"));
-        model.setCrossSection(getStringParam("crossSection"));
-        model.setTransportType(getStringParam("transportType"));
-        model.setWaterDensity(getDoubleParam("rho"));
-        model.setWaterTemperature(getDoubleParam("waterTemp"));
-        model.setWaterKinematicViscosity(getDoubleParam("waterKinViscosity"));
-        model.setSedDensity(getDoubleParam("rho_S"));
-        model.setGravelDensity(getDoubleParam("rho_G"));
-        model.setSedDiameter(getDoubleParam("diamSed"));
-        model.setGravelDiameter(getDoubleParam("diamGravel"));
-        model.setSandFraction(getDoubleParam("sandFraction"));
-        model.setSedD16(getDoubleParam("d16"));
-        model.setSedD50(getDoubleParam("d50"));
-        model.setSedD84(getDoubleParam("d84"));
-        model.setR1(getDoubleParam("R1"));
-        model.setR2(getDoubleParam("R2"));
-        model.setRatingCurveUnits(getStringParam("ratingCurveUnits"));
-        model.setChannelBottomWidth(getDoubleParam("width"));
-        model.setChannelBedSlope(getDoubleParam("bedSlope"));
-        model.setChannelEnergySlope(getDoubleParam("energySlope"));
-        model.setChannelFrictionSlope(getDoubleParam("frictionSlope"));
-        model.setNumberOfPoints(getIntParam("numberOfInterpolationPoints"));
-        model.setLogarithmicBins_TF(getBooleanParam("logarithmicBins_TF"));
-        model.setUScustomaryOutputUnits_TF(getBooleanParam("UScustomaryOutputUnits_TF"));
-        
         model.run();
     }
     
     
     @Override
     protected void postProcess() throws Exception {
+        PayloadResults resultPayload = results();
         // files
         File wd = getWorkspaceDir();
-        putResult(new File(wd, model.getEffectiveDischargeGraph()),
+        resultPayload.put(new File(wd, model.getEffectiveDischargeGraph()),
                   new File(wd, model.getSedimentYieldGraph()),
                   new File(wd, model.getHistogram()),
                   new File(wd, model.getRatingCurveGraph_sediment()),
@@ -69,16 +77,16 @@
                   model.getRatingCurveOutput_hydRadius());
 
         // values
-        putResult("effectiveDischarge", model.getEffectiveDischarge());
-        putResult("halfLoadDischarge", model.getHalfLoadDischarge());
-        putResult("sedimentTransportUnits", model.getSedimentUnits());
-        putResult("effectiveDischargeGraph", model.getEffectiveDischargeGraph());
-        putResult("SedimentYieldGraph", model.getSedimentYieldGraph());
-        putResult("histogramGraph", model.getHistogram());
-        putResult("ratingCurveGraph_sediment", model.getRatingCurveGraph_sediment());
-        putResult("ratingCurveGraph_area", model.getRatingCurveGraph_area());
-        putResult("ratingCurveGraph_depth", model.getRatingCurveGraph_depth());
-        putResult("ratingCurveGraph_hydRadius", model.getRatingCurveGraph_hydRadius());
+        resultPayload.put("effectiveDischarge", model.getEffectiveDischarge());
+        resultPayload.put("halfLoadDischarge", model.getHalfLoadDischarge());
+        resultPayload.put("sedimentTransportUnits", model.getSedimentUnits());
+        resultPayload.put("effectiveDischargeGraph", model.getEffectiveDischargeGraph());
+        resultPayload.put("SedimentYieldGraph", model.getSedimentYieldGraph());
+        resultPayload.put("histogramGraph", model.getHistogram());
+        resultPayload.put("ratingCurveGraph_sediment", model.getRatingCurveGraph_sediment());
+        resultPayload.put("ratingCurveGraph_area", model.getRatingCurveGraph_area());
+        resultPayload.put("ratingCurveGraph_depth", model.getRatingCurveGraph_depth());
+        resultPayload.put("ratingCurveGraph_hydRadius", model.getRatingCurveGraph_hydRadius());
         
         //Get result files for JSHighCharts
         String graphDataFiles = model.getEffectiveDischargeOutput().getName() + "|" +  
@@ -88,6 +96,6 @@
                       model.getRatingCurveOutput_area().getName() + "|" +  
                       model.getRatingCurveOutput_depth().getName() + "|" +  
                       model.getRatingCurveOutput_hydRadius().getName();
-        putResult("graph_data_files", graphDataFiles);
+        resultPayload.put("graph_data_files", graphDataFiles);
     }
 }

src/java/m/hydraulics/sediment/V1_0.java

@@ -4,6 +4,8 @@
 import csip.annotations.Name;
 import csip.annotations.VersionInfo;
 import csip.ModelDataService;
+import csip.PayloadParameter;
+import csip.PayloadResults;
 import hydraulics.SedimentTransport;
 import javax.ws.rs.Path;
 
@@ -14,42 +16,47 @@
 public class V1_0 extends ModelDataService {
 
     SedimentTransport model = new SedimentTransport();
+    
+    @Override
+    protected void preProcess() throws Exception {
+        PayloadParameter inputPayload = parameter();
+        model.setTransportType(inputPayload.getString("transportType"));
+        model.setWaterDensity(inputPayload.getDouble("rho"));
+        model.setWaterTemperature(inputPayload.getDouble("waterTemp"));
+        model.setWaterKinematicViscosity(inputPayload.getDouble("waterKinViscosity"));
+        model.setSedDensity(inputPayload.getDouble("rho_S"));
+        model.setGravelDensity(inputPayload.getDouble("rho_G"));
+        model.setSedDiameter(inputPayload.getDouble("diamSed"));
+        model.setGravelDiameter(inputPayload.getDouble("diamGravel"));
+        model.setSandFraction(inputPayload.getDouble("sandFraction"));
+        model.setSedD16(inputPayload.getDouble("d16"));
+        model.setSedD50(inputPayload.getDouble("d50"));
+        model.setSedD84(inputPayload.getDouble("d84"));
+        model.setR1(inputPayload.getDouble("R1"));
+        model.setR2(inputPayload.getDouble("R2"));
+        model.setRatingCurveUnits(inputPayload.getString("ratingCurveUnits"));
+        model.setChannelDepth(inputPayload.getDouble("depth"));
+        model.setChannelBottomWidth(inputPayload.getDouble("width"));
+        model.setChannelArea(inputPayload.getDouble("area"));
+        model.setChannelHydraulicRadius(inputPayload.getDouble("hydRadius"));
+        model.setChannelDischarge(inputPayload.getDouble("discharge"));
+        model.setChannelBedSlope(inputPayload.getDouble("bedSlope"));
+        model.setChannelEnergySlope(inputPayload.getDouble("energySlope"));
+        model.setChannelFrictionSlope(inputPayload.getDouble("frictionSlope"));
+    }
 
     @Override
     protected void doProcess() throws Exception {
-        model.setTransportType(getStringParam("transportType"));
-        model.setWaterDensity(getDoubleParam("rho"));
-        model.setWaterTemperature(getDoubleParam("waterTemp"));
-        model.setWaterKinematicViscosity(getDoubleParam("waterKinViscosity"));
-        model.setSedDensity(getDoubleParam("rho_S"));
-        model.setGravelDensity(getDoubleParam("rho_G"));
-        model.setSedDiameter(getDoubleParam("diamSed"));
-        model.setGravelDiameter(getDoubleParam("diamGravel"));
-        model.setSandFraction(getDoubleParam("sandFraction"));
-        model.setSedD16(getDoubleParam("d16"));
-        model.setSedD50(getDoubleParam("d50"));
-        model.setSedD84(getDoubleParam("d84"));
-        model.setR1(getDoubleParam("R1"));
-        model.setR2(getDoubleParam("R2"));
-        model.setRatingCurveUnits(getStringParam("ratingCurveUnits"));
-        model.setChannelDepth(getDoubleParam("depth"));
-        model.setChannelBottomWidth(getDoubleParam("width"));
-        model.setChannelArea(getDoubleParam("area"));
-        model.setChannelHydraulicRadius(getDoubleParam("hydRadius"));
-        model.setChannelDischarge(getDoubleParam("discharge"));
-        model.setChannelBedSlope(getDoubleParam("bedSlope"));
-        model.setChannelEnergySlope(getDoubleParam("energySlope"));
-        model.setChannelFrictionSlope(getDoubleParam("frictionSlope"));
-
         model.run();
     }
 
     @Override
     protected void postProcess() throws Exception {
+        PayloadResults resultPayload = results();
         // files
 
         // values
-        putResult("sedimentTransport", model.getSedTransport(), null, model.getUnits());
-        putResult("units", model.getUnits());
+        resultPayload.put("sedimentTransport", model.getSedTransport(), null, model.getUnits());
+        resultPayload.put("units", model.getUnits());
     }
 }

src/java/m/hydraulics/standardstep/V1_0.java

@@ -4,6 +4,8 @@
 import csip.annotations.Name;
 import csip.annotations.VersionInfo;
 import csip.ModelDataService;
+import csip.PayloadParameter;
+import csip.PayloadResults;
 import java.io.File;
 import javax.ws.rs.Path;
 
@@ -14,33 +16,39 @@
 public class V1_0 extends ModelDataService {
 
     StandardStepMethod model = new StandardStepMethod();
+    
+    @Override
+    protected void preProcess() throws Exception {
+        //Also requires "reaches.txt" and "crossSections" input files
+        model.setMainFolder(getWorkspaceDir().toString());
+        
+        PayloadParameter inputPayload = parameter();
+        model.setBottomWidth(inputPayload.getDouble("bottomWidth"));
+        model.setSideSlope(inputPayload.getDouble("sideSlope"));
+        model.setDepth_DS(inputPayload.getDouble("depth"));
+        model.setDischarge_DS(inputPayload.getDouble("discharge"));
+        model.setManningRoughness(inputPayload.getDouble("manningRoughness"));
+        model.setBedSlope(inputPayload.getDouble("bedSlope"));
+        model.setSeepage(inputPayload.getDouble("seepage"));
+        model.setChannelLength(inputPayload.getDouble("channelLength"));
+        model.setNumberOfCrossSections(inputPayload.getInt("numberOfReaches"));
+        model.setIrregularGeometry(inputPayload.getBoolean("irregularGeometry"));
+        model.setDownstreamCalculation(inputPayload.getBoolean("downstreamCalculation"));
+        model.setUseThalwegElevation(inputPayload.getBoolean("useThalwegElevation"));
+        model.setCreateGraph(inputPayload.getBoolean("createGraph"));
+        model.setCreateSummaryFile(inputPayload.getBoolean("createSummaryFile"));
+    }
 
     @Override
     protected void doProcess() throws Exception {
-        //Also requires "reaches.txt" and "crossSections" input files
-        model.setMainFolder(getWorkspaceDir().toString());
-        model.setBottomWidth(getDoubleParam("bottomWidth"));
-        model.setSideSlope(getDoubleParam("sideSlope"));
-        model.setDepth_DS(getDoubleParam("depth"));
-        model.setDischarge_DS(getDoubleParam("discharge"));
-        model.setManningRoughness(getDoubleParam("manningRoughness"));
-        model.setBedSlope(getDoubleParam("bedSlope"));
-        model.setSeepage(getDoubleParam("seepage"));
-        model.setChannelLength(getDoubleParam("channelLength"));
-        model.setNumberOfCrossSections(getIntParam("numberOfReaches"));
-        model.setIrregularGeometry(getBooleanParam("irregularGeometry"));
-        model.setDownstreamCalculation(getBooleanParam("downstreamCalculation"));
-        model.setUseThalwegElevation(getBooleanParam("useThalwegElevation"));
-        model.setCreateGraph(getBooleanParam("createGraph"));
-        model.setCreateSummaryFile(getBooleanParam("createSummaryFile"));
-        
         model.run();
     }
 
     @Override
     protected void postProcess() throws Exception {
-        File wd = getWorkspaceDir();
-       putResult(new File(wd, model.getElevationGraph()),
+       PayloadResults resultPayload = results();
+       File wd = getWorkspaceDir();
+       resultPayload.put(new File(wd, model.getElevationGraph()),
                  new File(wd, model.getSummary()),
                  //Below are the result graph files for use by JHighCharts on eRAMS for duplicating the above graphs
                  model.getElevationGraphOutput());