Displaying differences for changeset
 
display as  

nbproject/build-impl.xml~

@@ -1007,8 +1007,8 @@
     <target depends="init,compile,compile-jsps,-pre-dist,-do-dist-with-manifest,-do-dist-without-manifest" name="do-dist"/>
     <target depends="init" if="dist.ear.dir" name="library-inclusion-in-manifest">
         <copyfiles files="${libs.CSIP-Jersey-2.16.classpath}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
+        <copyfiles files="${file.reference.Lmod2Rusle2.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${reference.csip-core.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
-        <copyfiles files="${file.reference.Lmod2Rusle2.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${file.reference.jsf-api.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${file.reference.jsf-impl.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${file.reference.postgresql-9.0-801.jdbc4.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
@@ -1115,8 +1115,8 @@
     </target>
     <target depends="init" name="library-inclusion-in-archive" unless="dist.ear.dir">
         <copyfiles files="${libs.CSIP-Jersey-2.16.classpath}" todir="${build.web.dir}/WEB-INF/lib"/>
+        <copyfiles files="${file.reference.Lmod2Rusle2.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
         <copyfiles files="${reference.csip-core.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
-        <copyfiles files="${file.reference.Lmod2Rusle2.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
         <copyfiles files="${file.reference.jsf-api.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
         <copyfiles files="${file.reference.jsf-impl.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
         <copyfiles files="${file.reference.postgresql-9.0-801.jdbc4.jar}" todir="${build.web.dir}/WEB-INF/lib"/>

nbproject/project.xml

@@ -16,11 +16,11 @@
                     <path-in-war>WEB-INF/lib</path-in-war>
                 </library>
                 <library dirs="200">
-                    <file>${file.reference.Lmod2Rusle2.jar}</file>
+                    <file>${reference.csip-core.jar}</file>
                     <path-in-war>WEB-INF/lib</path-in-war>
                 </library>
                 <library dirs="200">
-                    <file>${reference.csip-core.jar}</file>
+                    <file>${file.reference.Lmod2Rusle2.jar}</file>
                     <path-in-war>WEB-INF/lib</path-in-war>
                 </library>
                 <library dirs="200">

src/java/c/MsSQLGIS.java

@@ -2,7 +2,7 @@
 
 import csip.ModelDataService;
 import csip.ServiceException;
-import csip.annotations.Resource;
+import csip.annotations.*;
 import static csip.annotations.ResourceType.JDBC;
 import java.sql.Connection;
 import java.sql.ResultSet;
@@ -16,9 +16,6 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 import javax.ws.rs.Path;
-import oms3.annotations.Description;
-import oms3.annotations.Name;
-import oms3.annotations.VersionInfo;
 
 
 /*

src/java/d/rusle2/Climate1_1.java

@@ -9,11 +9,9 @@
 import csip.Config;
 import java.util.Date;
 import javax.ws.rs.Path;
-import oms3.annotations.Description;
-import oms3.annotations.Name;
-import oms3.annotations.VersionInfo;
 import csip.ModelDataService;
 import csip.ServiceException;
+import csip.annotations.*;
 import csip.annotations.Resource;
 import static csip.annotations.ResourceType.JDBC;
 import static d.rusle2.Climate1_1.DB;

src/java/d/soils/V1_21.java

@@ -12,11 +12,11 @@
 import csip.ServiceException;
 import java.io.IOException;
 import javax.ws.rs.*;
-import oms3.annotations.*;
 import org.apache.commons.io.IOUtils;
 import org.codehaus.jettison.json.JSONArray;
 import org.codehaus.jettison.json.JSONObject;
 import csip.ModelDataService;
+import csip.annotations.*;
 import csip.annotations.Resource;
 import static csip.annotations.ResourceType.JDBC;
 import csip.utils.JSONUtils;

src/java/m/ApplicationConfig.java

@@ -38,25 +38,9 @@
         resources.add(csip.QueryService.class);
         resources.add(csip.ReportService.class);
         resources.add(csip.UIService.class);
-        resources.add(d.rusle2.CMZ1_0.class);
-        resources.add(d.rusle2.CMZ1_1.class);
-        resources.add(d.rusle2.Climate1_0.class);
         resources.add(d.rusle2.Climate1_1.class);
-        resources.add(d.rusle2.IsCoord.class);
-        resources.add(d.rusle2.LanduseManagement.class);
-        resources.add(d.rusle2.LanduseManagementFilter.class);
-        resources.add(d.rusle2.SoilMappingCheck.class);
-        resources.add(d.rusle2.StateCounty1_0.class);
-        resources.add(d.rusle2.StateCounty2_0.class);
-        resources.add(d.soils.V1_1.class);
         resources.add(d.soils.V1_21.class);
         resources.add(m.rusle2.V1_31.class);
-        resources.add(m.rusle2.V2_0.class);
-        resources.add(m.rusle2.V2_1.class);
-        resources.add(m.rusle2.rusle2check.class);
-        resources.add(m.sci.V1_3.class);
-        resources.add(m.stir.V1_2.class);
         resources.add(m.weps.V1_3.class);
-        resources.add(m.weps.V1_4.class);
     }
 }

src/java/m/rusle2/V1_31.java

@@ -27,7 +27,6 @@
 import java.io.FileOutputStream;
 import java.util.*;
 import javax.ws.rs.*;
-import oms3.annotations.*;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang.StringEscapeUtils;
 import org.codehaus.jettison.json.JSONArray;
@@ -40,8 +39,8 @@
 import static csip.ModelDataService.REPORT_DIM;
 import static csip.ModelDataService.REPORT_NAME;
 import static csip.ModelDataService.REPORT_TYPE;
-import static csip.ModelDataService.REPORT_VALUE;
 import static csip.ModelDataService.VALUE;
+import csip.annotations.*;
 import static util.ErosionConst.*;
 
 import csip.utils.JSONUtils;
@@ -189,33 +188,32 @@
 
 
     @Override
-    protected JSONArray createResults() throws Exception {
-        JSONArray results = new JSONArray();
+    protected void postProcess() throws Exception {
         int errors = 0;
         for (int i = 0; i < operations.size(); i++) {
             String op = operations.get(i);
             if (isUrlReachable(op)) {
-                results.put(JSONUtils.dataDesc("OPERATION_" + (i + 1), op, "operation is valid"));
+                putResult("OPERATION_" + (i + 1), op, "operation is valid");
             } else {
-                results.put(JSONUtils.dataDesc("OPERATION_INVALID_" + (i + 1), op, "OPERATION IS MISSING!"));
+                putResult("OPERATION_INVALID_" + (i + 1), op, "OPERATION IS MISSING!");
                 errors++;
             }
         }
         for (int i = 0; i < vegetations.size(); i++) {
             String vege = vegetations.get(i);
             if (isUrlReachable(vege)) {
-                results.put(JSONUtils.dataDesc("VEGETATION_" + (i + 1), vege, "vegetation is valid"));
+                putResult("VEGETATION_" + (i + 1),vege,"vegetation is valid");
             } else {
-                results.put(JSONUtils.dataDesc("VEGETATION_INVALID_" + (i + 1), vege, "VEGETATION IS MISSING"));
+                putResult("VEGETATION_INVALID_" + (i + 1), vege, "VEGETATION IS MISSING");
                 errors++;
             }
         }
         for (int i = 0; i < residues.size(); i++) {
             String res = residues.get(i);
             if (isUrlReachable(res)) {
-                results.put(JSONUtils.dataDesc("RESIDUE_" + (i + 1), res, "residue is valid"));
+                putResult("RESIDUE_" + (i + 1), res, "residue is valid");
             } else {
-                results.put(JSONUtils.dataDesc("RESIDUE_INVALID_" + (i + 1), res, "RESIDUE IS MISSING"));
+                putResult("RESIDUE_INVALID_" + (i + 1), res, "RESIDUE IS MISSING");
                 errors++;
             }
         }
@@ -224,20 +222,19 @@
         String sout = FileUtils.readFileToString(stdout);
         for (String r : JSONUtils.getRequestedResults(getMetainfo())) {
             if ((errors > 0) && (r.equals(RES_SLOPE_DEGRAD))) {
-                results.put(JSONUtils.dataDesc(r, getResult(sout, r), R2_MISSING_XML_FILES_WARNING_MSG));
+                putResult(r, getResult(sout, r), R2_MISSING_XML_FILES_WARNING_MSG);
             } else {
-                results.put(JSONUtils.data(r, getResult(sout, r)));
+                putResult(r, getResult(sout, r));
             }
         }
         if (errors > 0) {
             appendMetainfoWarning(R2_MISSING_XML_FILES_WARNING_MSG);
         }
 
-        results.put(JSONUtils.data(KEY_CLIMATES, climate));
-        results.put(JSONUtils.data(KEY_SOILS, soil));
-        results.put(JSONUtils.data(KEY_MANAGEMENTS, mgmt));
+        putResult(KEY_CLIMATES, climate);
+        putResult(KEY_SOILS, soil);
+        putResult(KEY_MANAGEMENTS, mgmt);
 //      results.put(JSONUtils.data(KEY_ALT_R2DB, in_ALT_R2DB));
-        return results;
     }
 
 
@@ -653,62 +650,65 @@
 
 
     @Override
-    protected JSONArray createReport() throws Exception {
+    protected void doReport() throws Exception {
         String sReportJSON = FileUtils.readFileToString(getResourceFile(REPORT_JSON));
         JSONArray reportItemsFromTemplate = new JSONArray(sReportJSON);
-        JSONArray reportItemsOutput = new JSONArray();
+
         String sout = FileUtils.readFileToString(stdout);
 
         for (int i = 0; i < reportItemsFromTemplate.length(); i++) {
+            
             JSONObject obj = (JSONObject) reportItemsFromTemplate.get(i);
             String itemName = obj.getString(REPORT_NAME);
             String dimension = JSONUtils.getJSONString(obj, REPORT_DIM, null);
             String type = JSONUtils.getJSONString(obj, REPORT_TYPE, "");
+            String units = JSONUtils.getJSONString(obj, REPORT_UNITS, null);
+            String desc = JSONUtils.getJSONString(obj, REPORT_DESC, null);
             //LOG.info("Attempting to fetch results for:" + itemName);
             String value = getResult(sout, "\"" + itemName + "\"");
             //LOG.info("the value='" + value + "'");
             if ((value != null) && (value.equals("null"))) {
-                obj.put(REPORT_VALUE, (String) null);
+                putReport(itemName, value, desc, units);
                 // if there is no value, then item should be removed from the array
             } else {
                 if ((dimension != null) && (dimension.length() > 0) && (value != null) && (!value.equals("null"))) {
                     try {
-                        obj.put(REPORT_VALUE, new JSONArray(value));
-                    } catch (JSONException je) {
-                        obj = processReportElement(obj, type, value);
+                    putReport(itemName, new JSONArray(value), desc, units);
+                      
+                    } catch (JSONException je) { 
+                        processReportElement(itemName,dimension,units,desc, type, value);
                     }
                 } else {
-                    obj = processReportElement(obj, type, value);
+                    processReportElement(itemName,dimension,units,desc, type, value);
                 }
-                obj.remove(REPORT_TYPE);
-                reportItemsOutput.put(obj);
             }
+            if(dimension != null)
+                putReportMetaInfo(itemName,REPORT_DIM,new JSONArray(dimension));
         }
-        return reportItemsOutput;
     }
 
 
-    private JSONObject processReportElement(JSONObject obj, String type, String value) throws Exception {
+    // This is a gross signiture but due to csip report changes this is the easiest way to change it without losing Wes's logic.
+    private void processReportElement(String itemName, String dim, String units, String desc, String type, String value) throws Exception {
         if ((type.equals("TEXT")) || (type.equals("FILENAME")) || (type.equals("DATE"))) {
             // because the RomeShell returns escaped strings, and the JSONObject in Java re-escapes them
             // we have to remove one level of "escaping" !!! 
             String newString = StringEscapeUtils.unescapeJava(value);
-            obj.put(REPORT_VALUE, Services.removeFirstLastChar(newString));
+            putReport(itemName, Services.removeFirstLastChar(newString), desc, units);
         }
         if (type.equals("INTEGER") && (value != null) && (!value.equals("null")) && (!value.equals("\"\""))) {
-            obj.put("value", new Double(value).intValue());
+            putReport(itemName, new Double(value).intValue(), desc, units);
         }
         if (type.equals("REAL") && (value != null)) {
             if ((!value.equals("null")) && (!value.equals("\"\""))) {
-                obj.put(REPORT_VALUE, new Double(value).doubleValue());
+                putReport(itemName, Double.parseDouble(value), desc, units);
             }
             if (value.equals("\"\"")) {
-                obj.put(REPORT_VALUE, new Double(0).doubleValue());
+                putReport(itemName, new Double(0), desc, units);
             }
         }
         if (type.equals("")) {
-            obj.put(REPORT_VALUE, value);
+            putReport(itemName, value, desc, units);
         }
-        return obj;
     }
 }

src/java/m/weps/V1_3.java

@@ -11,6 +11,7 @@
 import csip.Executable;
 import csip.ModelDataService;
 import csip.ServiceException;
+import csip.annotations.*;
 import csip.annotations.Polling;
 import csip.annotations.Resource;
 import static csip.annotations.ResourceType.*;
@@ -28,9 +29,6 @@
 import javax.ws.rs.Path;
 import man2weps.WepsTranslator;
 import man2weps.mcrew.ManageData;
-import oms3.annotations.Description;
-import oms3.annotations.Name;
-import oms3.annotations.VersionInfo;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.IOUtils;
 import org.apache.http.HttpResponse;
@@ -889,9 +887,8 @@
 
 
     @Override
-    public JSONArray createResults() throws Exception {
+    public void postProcess() throws Exception {
         LOG.info("Create the WEPS results...");
-        JSONArray results = new JSONArray();
 
         FileReader fr = new FileReader(sessionWorkDir + "/sci_energy.out");
         BufferedReader bfr = new BufferedReader(fr);
@@ -915,20 +912,19 @@
         double windEros_tonAcreYear = Double.parseDouble(wo.windEros) * CONV_KGM2_TONACRE;
         double waterEros_tonAcreYear = Double.parseDouble(wo.waterEros) * CONV_KGM2_TONACRE;
 
-        results.put(JSONUtils.dataDesc(WEPS_RES_SOIL_COND_INDEX, wo.soilConditioningIndex, "total SCI (soil conditioning index)"));
-        results.put(JSONUtils.dataDesc(WEPS_RES_SCI_OM_FACTOR, wo.sciOmFactor, "SCI Organic Matter subfactor"));
-        results.put(JSONUtils.dataDesc(WEPS_RES_SCI_ER_FACTOR, wo.sciErFactor, "SCI Erosion Rate subfactor"));
-        results.put(JSONUtils.dataDesc(WEPS_RES_SCI_FO_FACTOR, wo.sciFoFactor, "SCI Field Operations subfactor"));
-        results.put(JSONUtils.dataUnitDesc(WEPS_RES_DIESEL_ENERGY, dieselEnergy_gallonsPerAcre, "gallon(Diesel)/acre", "energy used by management operations, expressed as fuel consumption equivalent"));
-        results.put(JSONUtils.dataUnitDesc(WEPS_RES_AVG_BIOMASS, averageBiomass_tonAcreYear, "ton/acre/year", "Average biomass"));
-        results.put(JSONUtils.dataUnitDesc(WEPS_RES_WIND_EROS, windEros_tonAcreYear, "ton/acre/year", "Wind erosion (computed by WEPS)"));
-        results.put(JSONUtils.dataUnitDesc(WEPS_RES_WATER_EROS, waterEros_tonAcreYear, "ton/acre/year", "Water erosion (external input)"));
-        results.put(JSONUtils.dataDesc(WEPS_RES_AVG_ALL_STIR, wo.avgAllStir, "Average STIR"));
-        results.put(JSONUtils.data(WEPS_SALTATION, wo.saltation));
-        results.put(JSONUtils.data(WEPS_SUSPENSION, wo.suspension));
-        results.put(JSONUtils.data(WEPS_PM10, wo.pm10));
+        putResult(WEPS_RES_SOIL_COND_INDEX, wo.soilConditioningIndex, "total SCI (soil conditioning index)");
+        putResult(WEPS_RES_SCI_OM_FACTOR, wo.sciOmFactor, "SCI Organic Matter subfactor");
+        putResult(WEPS_RES_SCI_ER_FACTOR, wo.sciErFactor, "SCI Erosion Rate subfactor");
+        putResult(WEPS_RES_SCI_FO_FACTOR, wo.sciFoFactor, "SCI Field Operations subfactor");
+        putResult(WEPS_RES_DIESEL_ENERGY, dieselEnergy_gallonsPerAcre, "SCI Field Operations subfactor");
+        putResult(WEPS_RES_AVG_BIOMASS, averageBiomass_tonAcreYear, "Average biomass", "ton/acre/year");
+        putResult(WEPS_RES_WIND_EROS, windEros_tonAcreYear, "Wind erosion (computed by WEPS)", "ton/acre/year");
+        putResult(WEPS_RES_WATER_EROS, waterEros_tonAcreYear, "Water erosion (external input)", "ton/acre/year");
+        putResult(WEPS_RES_AVG_ALL_STIR, wo.avgAllStir, "Average STIR");
+        putResult(WEPS_SALTATION, wo.saltation);
+        putResult(WEPS_SUSPENSION, wo.suspension);
+        putResult(WEPS_PM10, wo.pm10);
 
-        return results;
     }
 
 

src/java/m/weps/V1_3_1.java.orig

@@ -11,7 +11,6 @@
 import csip.annotations.*;
 import static csip.annotations.ResourceType.*;
 import csip.utils.JSONUtils;
-import oms3.annotations.*;
 import usda.weru.weps.reports.query.WepsConnection;
 import wepsreportdata.WepsReportData;
 import java.io.*;

src/java/m/weps/WeightsParser.java

@@ -9,7 +9,8 @@
 import java.util.List;
 import java.util.logging.Level;
 import java.util.logging.Logger;
-import oms3.annotations.*;
+import oms3.annotations.Execute;
+import oms3.annotations.In;
 import org.apache.commons.io.FileUtils;
 
 /**

web/META-INF/csip-conf.json

@@ -1,5 +1,5 @@
 {
-    "csip-erosion.version": "$version: 2.0.88 d33ce9ed6382 2017-05-08 Jakob23, built at 2018-02-12 10:14 by brad$",
+    "csip-erosion.version": "$version: 2.0.90 ddd0216b86c9 2018-05-24 Jakob23, built at 2018-05-24 16:08 by Brad$",
     "lmod.db": "jdbc:sqlserver:\/\/129.82.20.129:1433;databaseName=lmod_temp;user=lmod-rw;password=managements",
     "conservation_resources.db": "jdbc:sqlserver://129.82.20.129:1433;databaseName=conservation_resources;user=sa;password=csurams#1",
     "conservation_resources.database": "mssql",

web/WEB-INF/csip-conf.json

@@ -1,5 +1,5 @@
 {
-    "csip-erosion.version": "$version: 2.0.88 d33ce9ed6382 2017-05-08 Jakob23, built at 2018-02-12 10:14 by brad$",
+    "csip-erosion.version": "$version: 2.0.90 ddd0216b86c9 2018-05-24 Jakob23, built at 2018-05-24 16:08 by Brad$",
     "weps.version" : "1.3.9",
     "lmod.db": "jdbc:sqlserver:\/\/129.82.20.242:1433;databaseName=lmod_zedx;user=lmod-rw;password=managements",
     "conservation_resources.db": "jdbc:sqlserver://129.82.20.241:1433;databaseName=conservation_resources;user=sa;password=csurams#1",