Displaying differences for changeset
 
display as  

src/java/m/wqm/nuttechscores/Input.java

@@ -1,9 +1,9 @@
-
 package m.wqm.nuttechscores;
 
 /**
  *
  * @author Kontham Srinivas Reddy
+ * @update Rumpal Sidhu
  */
 public class Input {
 
@@ -11,13 +11,14 @@
     int plan_techn_id;
     String plan_techn_discrim_type;
     String plan_techn_discrim;
-    public Input(int AoAid,int plan_techn_id,String plan_techn_discrim_type,String plan_techn_discrim)
-    {
-        this.AoAid=AoAid;
-        this.plan_techn_id=plan_techn_id;
-        this.plan_techn_discrim_type=plan_techn_discrim_type;
-        this.plan_techn_discrim=plan_techn_discrim;
-        
+
+    public Input(int AoAid, int plan_techn_id, String plan_techn_discrim_type,
+            String plan_techn_discrim) {
+        this.AoAid = AoAid;
+        this.plan_techn_id = plan_techn_id;
+        this.plan_techn_discrim_type = plan_techn_discrim_type;
+        this.plan_techn_discrim = plan_techn_discrim;
+
     }
-    
+
 }

src/java/m/wqm/nuttechscores/Result1.java

@@ -3,37 +3,42 @@
 /**
  *
  * @author Srinivas Reddy Kontham
+ * @ Update Rumpal Sidhu
  */
+public class Result1 {
 
-public class Result1 
-{
-            int nleach_techn_score=0;
-            int nleach_avoid_techn_score=0;
-            int nleach_control_techn_score=0;
-            int nleach_trap_techn_score=0;
-            int nsurf_techn_score=0;
-            int nsurf_avoid_techn_score=0;
-            int nsurf_control_techn_score=0;
-            int nsurf_trap_techn_score=0;
-            int psurf_techn_score=0;
-            int psurf_avoid_techn_score=0;
-            int psurf_control_techn_score=0;
-            int psurf_trap_techn_score=0;
-            int AoAid;
-    public Result1(int AoAid,int nleach_techn_score,int nsurf_techn_score,int psurf_techn_score,int nleach_avoid_techn_score,int nleach_control_techn_score,int nleach_trap_techn_score,int nsurf_avoid_techn_score,int nsurf_control_techn_score,int nsurf_trap_techn_score,int psurf_avoid_techn_score,int psurf_control_techn_score,int psurf_trap_techn_score)
-    {
-         this.nleach_techn_score=nleach_techn_score;
-         this.nleach_avoid_techn_score=nleach_avoid_techn_score;
-         this.nleach_control_techn_score=nleach_control_techn_score;
-         this.nleach_trap_techn_score=nleach_trap_techn_score;
-         this.nsurf_techn_score=nsurf_techn_score;
-         this.nsurf_avoid_techn_score=nsurf_avoid_techn_score;
-         this.nsurf_control_techn_score=nsurf_control_techn_score;
-         this.nsurf_trap_techn_score=nsurf_trap_techn_score;
-         this.psurf_techn_score=psurf_techn_score;
-         this.psurf_avoid_techn_score=psurf_avoid_techn_score;
-         this.psurf_control_techn_score=psurf_control_techn_score;
-         this.psurf_trap_techn_score=psurf_trap_techn_score;
-         this.AoAid=AoAid;
+    int nleach_techn_score = 0;
+    int nleach_avoid_techn_score = 0;
+    int nleach_control_techn_score = 0;
+    int nleach_trap_techn_score = 0;
+    int nsurf_techn_score = 0;
+    int nsurf_avoid_techn_score = 0;
+    int nsurf_control_techn_score = 0;
+    int nsurf_trap_techn_score = 0;
+    int psurf_techn_score = 0;
+    int psurf_avoid_techn_score = 0;
+    int psurf_control_techn_score = 0;
+    int psurf_trap_techn_score = 0;
+    int AoAid;
+
+    public Result1(int AoAid, int nleach_techn_score, int nsurf_techn_score, 
+            int psurf_techn_score, int nleach_avoid_techn_score, 
+            int nleach_control_techn_score, int nleach_trap_techn_score, 
+            int nsurf_avoid_techn_score, int nsurf_control_techn_score, 
+            int nsurf_trap_techn_score, int psurf_avoid_techn_score, 
+            int psurf_control_techn_score, int psurf_trap_techn_score) {
+        this.nleach_techn_score = nleach_techn_score;
+        this.nleach_avoid_techn_score = nleach_avoid_techn_score;
+        this.nleach_control_techn_score = nleach_control_techn_score;
+        this.nleach_trap_techn_score = nleach_trap_techn_score;
+        this.nsurf_techn_score = nsurf_techn_score;
+        this.nsurf_avoid_techn_score = nsurf_avoid_techn_score;
+        this.nsurf_control_techn_score = nsurf_control_techn_score;
+        this.nsurf_trap_techn_score = nsurf_trap_techn_score;
+        this.psurf_techn_score = psurf_techn_score;
+        this.psurf_avoid_techn_score = psurf_avoid_techn_score;
+        this.psurf_control_techn_score = psurf_control_techn_score;
+        this.psurf_trap_techn_score = psurf_trap_techn_score;
+        this.AoAid = AoAid;
     }
 }

src/java/m/wqm/nuttechscores/V1_0.java

@@ -1,9 +1,9 @@
-
 package m.wqm.nuttechscores;
 
 /**
  *
  * @author SrinivasReddy kontham
+ * @ update Rumpal Sidhu
  */
 import csip.ModelDataService;
 import static csip.ModelDataService.EXEC_OK;
@@ -18,185 +18,218 @@
 import java.sql.*;
 import java.util.concurrent.*;
 
-@Name("(NutTechScores)")
+@Name("WQM-14:(NutTechScores)")
 @Description("Nutrient Technique Scores")
 @Path("m/nut_tech_scores/1.0")
 
-public class V1_0 extends ModelDataService
-{
-    ArrayList<Input> components=new ArrayList<>(); // store the set of all input soilcomponents as objects
-    ArrayList<Result1> result1=new ArrayList<>();  // store the result as objects
-            int nleach_techn_score=0;
-            int nleach_avoid_techn_score=0;
-            int nleach_control_techn_score=0;
-            int nleach_trap_techn_score=0;
-            int nsurf_techn_score=0;
-            int nsurf_avoid_techn_score=0;
-            int nsurf_control_techn_score=0;
-            int nsurf_trap_techn_score=0;
-            int psurf_techn_score=0;
-            int psurf_avoid_techn_score=0;
-            int psurf_control_techn_score=0;
-            int psurf_trap_techn_score=0;
-            int AoAid;
+public class V1_0 extends ModelDataService {
+
+    //SQL params names here for quick modification
+    private final String USER = "postgres";
+    private final String PASS = "admin";
+    private final String HOST = "localhost";
+    private final String PORT = "5432";
+    private final String DBNAME = "postgres";
+    private final String JDBC_TYPE = "jdbc:postgresql://";
+    private final String CONNECTION = JDBC_TYPE + HOST + ":" + PORT + "/" + DBNAME;
+    private final String CLASS_NAME = "org.postgresql.Driver";
+
+    private ArrayList<Input> components; // store the set of all input soilcomponents as objects
+    private ArrayList<Result1> result1;  // store the result as objects
+    private int aoaId;
+
     @Override
-        // reading the inputs from the json file into input object and placing it in the arraylist
-        protected void preProcess() throws Exception {
+    // reading the inputs from the json file into input object and placing it in the arraylist
+    protected void preProcess() throws Exception {
+        components = new ArrayList<>();
         JSONArray groups = getJSONArrayParam("pestcomponents");
-            for(int i=0;i<groups.length();i++)
-            {
-                Map<String, JSONObject> group = JSONUtils.preprocess(groups.getJSONArray(i));
+        for (int i = 0; i < groups.length(); i++) {
+            Map<String, JSONObject> group = JSONUtils.preprocess(groups.getJSONArray(i));
+            aoaId = JSONUtils.getIntParam(group, "AoAid", 0);
+            int plan_techn_id = JSONUtils.getIntParam(group, "plan_techn_id", 0);
+            String plan_techn_discrim_type = JSONUtils.getStringParam(group, "plan_techn_discrim_type", "err");
+            String plan_techn_discrim = JSONUtils.getStringParam(group, "plan_techn_discrim", "err");
+            Input input = new Input(aoaId, plan_techn_id, plan_techn_discrim_type, plan_techn_discrim);
+            components.add(input);
+        }
+    }
 
-                
-                AoAid = JSONUtils.getIntParam(group, "AoAid", 0);
-                int  plan_techn_id=JSONUtils.getIntParam(group,"plan_techn_id",0);
-                String plan_techn_discrim_type=JSONUtils.getStringParam(group,"plan_techn_discrim_type","err");
-                String plan_techn_discrim=JSONUtils.getStringParam(group,"plan_techn_discrim","err");
-                Input input=new Input(AoAid,plan_techn_id,plan_techn_discrim_type,plan_techn_discrim);
-                components.add(input);
+    @Override
+    protected String process() throws Exception {
+        result1 = new ArrayList<>();
+        Connection conn = null;
+        Statement statement = null;
+        try {
+            Class.forName(CLASS_NAME);
+            conn = DriverManager.getConnection(CONNECTION, USER, PASS);
+            conn.setAutoCommit(false);
+            statement = conn.createStatement();
+
+            int nleach_techn_score = 0;
+            int nleach_avoid_techn_score = 0;
+            int nleach_control_techn_score = 0;
+            int nleach_trap_techn_score = 0;
+            int nsurf_techn_score = 0;
+            int nsurf_avoid_techn_score = 0;
+            int nsurf_control_techn_score = 0;
+            int nsurf_trap_techn_score = 0;
+            int psurf_techn_score = 0;
+            int psurf_avoid_techn_score = 0;
+            int psurf_control_techn_score = 0;
+            int psurf_trap_techn_score = 0;
+
+            for (Input ip : components) {
+                String query = "SELECT nut_tech_score FROM wqm_nutrient_technique_scores "
+                        + "WHERE nutrient_technique_id = " + ip.plan_techn_id
+                        + " AND wqm_concern ='Nitrogen in Ground Water';";
+                ResultSet resultset = statement.executeQuery(query);
+                while (resultset.next()) {
+                    int techn_score = resultset.getInt("nut_tech_score");
+                    nleach_techn_score += techn_score;
+                }
+
+                query = "SELECT nut_tech_score FROM wqm_nutrient_technique_scores "
+                        + "WHERE nutrient_technique_id= " + ip.plan_techn_id
+                        + " AND wqm_concern = 'Nitrogen in Ground Water' AND mode_of_action = 'Avoid';";
+                resultset = statement.executeQuery(query);
+                while (resultset.next()) {
+                    int avoid_techn_score = resultset.getInt("nut_tech_score");
+                    nleach_avoid_techn_score += avoid_techn_score;
+                }
+
+                query = "SELECT nut_tech_score FROM wqm_nutrient_technique_scores "
+                        + "WHERE nutrient_technique_id = " + ip.plan_techn_id
+                        + " AND wqm_concern = 'Nitrogen in Ground Water' AND mode_of_action = 'Control';";
+                resultset = statement.executeQuery(query);
+                while (resultset.next()) {
+                    int control_techn_score = resultset.getInt("nut_tech_score");
+                    nleach_control_techn_score += control_techn_score;
+                }
+
+                query = "SELECT nut_tech_score FROM wqm_nutrient_technique_scores "
+                        + "WHERE nutrient_technique_id = " + ip.plan_techn_id
+                        + " AND wqm_concern = 'Nitrogen in Ground Water' AND mode_of_action = 'Trap';";
+                resultset = statement.executeQuery(query);
+                while (resultset.next()) {
+                    int trap_techn_score = resultset.getInt("nut_tech_score");
+                    nleach_trap_techn_score += trap_techn_score;
+                }
+
+                //  #Compute nutrient technique mitigation scores for Nitrogen in Surface Water concern and increment total scores           
+                query = "SELECT nut_tech_score FROM wqm_nutrient_technique_scores "
+                        + "WHERE nutrient_technique_id = " + ip.plan_techn_id
+                        + " AND wqm_concern = 'Nitrogen in Surface Water';";
+                resultset = statement.executeQuery(query);
+                while (resultset.next()) {
+                    int techn_score = resultset.getInt("nut_tech_score");
+                    nsurf_techn_score += techn_score;
+                }
+
+                query = "SELECT nut_tech_score FROM wqm_nutrient_technique_scores "
+                        + "WHERE nutrient_technique_id = " + ip.plan_techn_id
+                        + " AND wqm_concern = 'Nitrogen in Surface Water' AND mode_of_action = 'Avoid';";
+                resultset = statement.executeQuery(query);
+                while (resultset.next()) {
+                    int avoid_techn_score = resultset.getInt("nut_tech_score");
+                    nsurf_avoid_techn_score += avoid_techn_score;
+                }
+
+                query = "SELECT nut_tech_score FROM wqm_nutrient_technique_scores "
+                        + "WHERE nutrient_technique_id = " + ip.plan_techn_id
+                        + " AND wqm_concern = 'Nitrogen in Surface Water' AND mode_of_action = 'Control';";
+                resultset = statement.executeQuery(query);
+                while (resultset.next()) {
+                    int control_techn_score = resultset.getInt("nut_tech_score");
+                    nsurf_control_techn_score += control_techn_score;
+                }
+
+                query = "SELECT nut_tech_score FROM wqm_nutrient_technique_scores "
+                        + "WHERE nutrient_technique_id = " + ip.plan_techn_id
+                        + " AND wqm_concern = 'Nitrogen in Surface Water' AND mode_of_action = 'Trap';";
+                resultset = statement.executeQuery(query);
+                while (resultset.next()) {
+                    int trap_techn_score = resultset.getInt("nut_tech_score");
+                    nsurf_trap_techn_score += trap_techn_score;
+                }
+
+                //#Compute nutrient technique mitigation scores for Phosphorus in Surface Water concern and increment total scores            
+                query = "SELECT nut_tech_score FROM wqm_nutrient_technique_scores "
+                        + "WHERE nutrient_technique_id = " + ip.plan_techn_id
+                        + " AND wqm_concern = 'Phosphorous in Surface Water'"
+                        + " AND tech_discrim_type ='" + ip.plan_techn_discrim_type
+                        + "' AND tech_discrim = '" + ip.plan_techn_discrim + "';";
+                resultset = statement.executeQuery(query);
+                while (resultset.next()) {
+                    int techn_score = resultset.getInt("nut_tech_score");
+                    psurf_techn_score += techn_score;
+                }
+
+                query = "SELECT nut_tech_score FROM wqm_nutrient_technique_scores "
+                        + "WHERE nutrient_technique_id = " + ip.plan_techn_id
+                        + " AND wqm_concern = 'Phosphorus in Surface Water' AND mode_of_action = 'Avoid';";
+                resultset = statement.executeQuery(query);
+                while (resultset.next()) {
+                    int avoid_techn_score = resultset.getInt("nut_tech_score");
+                    psurf_avoid_techn_score += avoid_techn_score;
+                }
+
+                query = "SELECT nut_tech_score FROM wqm_nutrient_technique_scores "
+                        + "WHERE nutrient_technique_id = " + ip.plan_techn_id
+                        + "AND wqm_concern = 'Phosphorus in Surface Water' AND mode_of_action = 'Control';";
+                resultset = statement.executeQuery(query);
+                while (resultset.next()) {
+                    int control_techn_score = resultset.getInt("nut_tech_score");
+                    psurf_control_techn_score += control_techn_score;
+                }
+
+                query = "SELECT nut_tech_score FROM wqm_nutrient_technique_scores "
+                        + "WHERE nutrient_technique_id = " + ip.plan_techn_id
+                        + " AND wqm_concern = 'Phosphorus in Surface Water' AND mode_of_action = 'Trap';";
+                resultset = statement.executeQuery(query);
+                while (resultset.next()) {
+                    int trap_techn_score = resultset.getInt("nut_tech_score");
+                    psurf_trap_techn_score += trap_techn_score;
+                }
+            }
+            Result1 result = new Result1(aoaId, nleach_techn_score, nsurf_techn_score, psurf_techn_score, nleach_avoid_techn_score, nleach_control_techn_score, nleach_trap_techn_score, nsurf_avoid_techn_score, nsurf_control_techn_score, nsurf_trap_techn_score, psurf_avoid_techn_score, psurf_control_techn_score, psurf_trap_techn_score);
+            result1.add(result);
+
+        } catch (SQLException se) {
+            LOG.info("Did not open database for WQM-4!");
+            LOG.info(se.getMessage());
+        } finally {
+            if (statement != null) {
+                statement.close();
+            }
+            if (conn != null) {
+                conn.close();
             }
         }
-        @Override
-        protected String process() throws Exception
-        {
-            Connection conn = null;
-            Statement statement = null;
-            Class.forName("org.postgresql.Driver");
-            conn = DriverManager.getConnection("jdbc:postgresql://localhost:5432/postgres", "postgres", "admin");
-            conn.setAutoCommit(false);
-            statement = conn.createStatement();
-            
-            for(Input ip:components)
-            {
-                String query="SELECT nut_tech_score FROM wqm_nutrient_technique_scores WHERE nutrient_technique_id="+ip.plan_techn_id+"AND wqm_concern="+"'"+"Nitrogen in Ground Water"+"'";
-                ResultSet results = statement.executeQuery(query);
-        //        #Compute nutrient technique mitigation scores for Nitrogen in Ground Water concern and increment total scores
-                while (results.next())
-                {
-                   int techn_score=results.getInt("nut_tech_score");
-                   nleach_techn_score=nleach_techn_score+techn_score;
-                }
-                query="SELECT nut_tech_score FROM wqm_nutrient_technique_scores WHERE nutrient_technique_id="+ip.plan_techn_id+"AND wqm_concern="+"'"+"Nitrogen in Ground Water"+"' AND mode_of_action='"+"Avoid"+"'";
-                results = statement.executeQuery(query);
-                
-                while (results.next())
-                {
-                   int avoid_techn_score=results.getInt("nut_tech_score");
-                   nleach_avoid_techn_score=nleach_avoid_techn_score+avoid_techn_score;
-                }
-                query="SELECT nut_tech_score FROM wqm_nutrient_technique_scores WHERE nutrient_technique_id="+ip.plan_techn_id+"AND wqm_concern="+"'"+"Nitrogen in Ground Water"+"' AND mode_of_action='"+"Control"+"'";
-                results = statement.executeQuery(query);
-                
-                while (results.next())
-                {
-                   int control_techn_score=results.getInt("nut_tech_score");
-                   nleach_control_techn_score=nleach_avoid_techn_score+control_techn_score;
-                }
-                query="SELECT nut_tech_score FROM wqm_nutrient_technique_scores WHERE nutrient_technique_id="+ip.plan_techn_id+"AND wqm_concern="+"'"+"Nitrogen in Ground Water"+"' AND mode_of_action='"+"Trap"+"'";
-                results = statement.executeQuery(query);
-                
-                while (results.next())
-                {
-                   int trap_techn_score=results.getInt("nut_tech_score");
-                   nleach_trap_techn_score=nleach_avoid_techn_score+trap_techn_score;
-                }
-                
-    //  #Compute nutrient technique mitigation scores for Nitrogen in Surface Water concern and increment total scores           
-                query="SELECT nut_tech_score FROM wqm_nutrient_technique_scores WHERE nutrient_technique_id="+ip.plan_techn_id+"AND wqm_concern="+"'"+"Nitrogen in Surface Water"+"'";
-                results = statement.executeQuery(query);
-                while (results.next())
-                {
-                   int techn_score=results.getInt("nut_tech_score");
-                   nsurf_techn_score=nsurf_techn_score+techn_score;
-                }
-                query="SELECT nut_tech_score FROM wqm_nutrient_technique_scores WHERE nutrient_technique_id="+ip.plan_techn_id+"AND wqm_concern="+"'"+"Nitrogen in Surface Water"+"' AND mode_of_action='"+"Avoid"+"'";
-                results = statement.executeQuery(query);
-                
-                while (results.next())
-                {
-                   int avoid_techn_score=results.getInt("nut_tech_score");
-                   nsurf_avoid_techn_score=nsurf_avoid_techn_score+avoid_techn_score;
-                }
-                query="SELECT nut_tech_score FROM wqm_nutrient_technique_scores WHERE nutrient_technique_id="+ip.plan_techn_id+"AND wqm_concern="+"'"+"Nitrogen in Surface Water"+"' AND mode_of_action='"+"Control"+"'";
-                results = statement.executeQuery(query);
-                
-                while (results.next())
-                {
-                   int control_techn_score=results.getInt("nut_tech_score");
-                   nsurf_control_techn_score=nsurf_avoid_techn_score+control_techn_score;
-                }
-                query="SELECT nut_tech_score FROM wqm_nutrient_technique_scores WHERE nutrient_technique_id="+ip.plan_techn_id+"AND wqm_concern="+"'"+"Nitrogen in Surface Water"+"' AND mode_of_action='"+"Trap"+"'";
-                results = statement.executeQuery(query);
-                
-                while (results.next())
-                {
-                   int trap_techn_score=results.getInt("nut_tech_score");
-                   nsurf_trap_techn_score=nsurf_avoid_techn_score+trap_techn_score;
-                }
-    //#Compute nutrient technique mitigation scores for Phosphorus in Surface Water concern and increment total scores            
-                 query="SELECT nut_tech_score FROM wqm_nutrient_technique_scores WHERE nutrient_technique_id="+ip.plan_techn_id+"AND wqm_concern="+"'"+"Phosphorous in Surface Water"+"' AND tech_discrim_type='"+ip.plan_techn_discrim_type+"' AND tech_discrim='"+ip.plan_techn_discrim+"'";
-                results = statement.executeQuery(query);
-                while (results.next())
-                {
-                   int techn_score=results.getInt("nut_tech_score");
-                   psurf_techn_score=psurf_techn_score+techn_score;
-                }
-                query="SELECT nut_tech_score FROM wqm_nutrient_technique_scores WHERE nutrient_technique_id="+ip.plan_techn_id+"AND wqm_concern="+"'"+"Phosphorus in Surface Water"+"' AND mode_of_action='"+"Avoid"+"'";
-                results = statement.executeQuery(query);
-                
-                while (results.next())
-                {
-                   int avoid_techn_score=results.getInt("nut_tech_score");
-                   psurf_avoid_techn_score=psurf_avoid_techn_score+avoid_techn_score;
-                }
-                query="SELECT nut_tech_score FROM wqm_nutrient_technique_scores WHERE nutrient_technique_id="+ip.plan_techn_id+"AND wqm_concern="+"'"+"Phosphorus in Surface Water"+"' AND mode_of_action='"+"Control"+"'";
-                results = statement.executeQuery(query);
-                
-                while (results.next())
-                {
-                   int control_techn_score=results.getInt("nut_tech_score");
-                   psurf_control_techn_score=psurf_avoid_techn_score+control_techn_score;
-                }
-                query="SELECT nut_tech_score FROM wqm_nutrient_technique_scores WHERE nutrient_technique_id="+ip.plan_techn_id+"AND wqm_concern="+"'"+"Phosphorus in Surface Water"+"' AND mode_of_action='"+"Trap"+"'";
-                results = statement.executeQuery(query);
-                
-                while (results.next())
-                {
-                   int trap_techn_score=results.getInt("nut_tech_score");
-                   psurf_trap_techn_score=psurf_avoid_techn_score+trap_techn_score;
-                }
-                        
-            }
-            Result1 result=new Result1(AoAid,nleach_techn_score,nsurf_techn_score,psurf_techn_score,nleach_avoid_techn_score,nleach_control_techn_score,nleach_trap_techn_score,nsurf_avoid_techn_score,nsurf_control_techn_score,nsurf_trap_techn_score,psurf_avoid_techn_score,psurf_control_techn_score,psurf_trap_techn_score);
-            result1.add(result);
-            return EXEC_OK;
+        return EXEC_OK;
+    }
+
+    @Override
+    //writing the results back to JSON
+    protected void postProcess() throws Exception {
+        JSONArray result1Arr = new JSONArray();
+        for (Result1 rs1 : result1) {
+            JSONArray tmpArr = new JSONArray();
+            tmpArr.put(JSONUtils.dataDesc("AoAId", rs1.AoAid, "Area of Analysis Identifier"));
+            tmpArr.put(JSONUtils.dataDesc("nleach_techn_score", rs1.nleach_techn_score, "nutrient management technique mitigation score for nitrogen in ground water concern"));
+            tmpArr.put(JSONUtils.dataDesc("nsurf_techn_score", rs1.nsurf_techn_score, "nutrient management technique mitigation score for nitrogen in surface water concern"));
+            tmpArr.put(JSONUtils.dataDesc("psurf_techn_score", rs1.psurf_techn_score, "nutrient management technique mitigation score for phosphorus in surface water concern"));
+            tmpArr.put(JSONUtils.dataDesc("nleach_avoid_techn_score", rs1.nleach_avoid_techn_score, "integer, nutrient management technique mitigation score for avoiding excess nitrogen use or application and loss to groundwater"));
+            tmpArr.put(JSONUtils.dataDesc("nleach_control_techn_score", rs1.nleach_control_techn_score, "nutrient management technique mitigation score for controlling in-field nitrogen losses to groundwater"));
+            tmpArr.put(JSONUtils.dataDesc("nleach_trap_techn_score", rs1.nleach_trap_techn_score, "nutrient management technique mitigation score for trapping excess nitrogen and keeping it from groundwater"));
+            tmpArr.put(JSONUtils.dataDesc("nsurf_avoid_techn_score", rs1.nsurf_avoid_techn_score, "nutrient management technique mitigation score for avoiding excess nitrogen use or application and loss to surface water"));
+            tmpArr.put(JSONUtils.dataDesc("nsurf_control_techn_score", rs1.nsurf_control_techn_score, "nutrient management technique mitigation score for controlling in-field nitrogen losses to surface water runoff"));
+            tmpArr.put(JSONUtils.dataDesc("nsurf_trap_techn_score", rs1.nsurf_trap_techn_score, "nutrient management technique mitigation score for trapping excess nitrogen and keeping it from surface water"));
+            tmpArr.put(JSONUtils.dataDesc("psurf_avoid_techn_score", rs1.psurf_avoid_techn_score, "nutrient management technique mitigation score for avoiding excess phosphorus use or application and loss to surface water"));
+            tmpArr.put(JSONUtils.dataDesc("psurf_control_techn_score", rs1.psurf_control_techn_score, "nutrient management technique mitigation score for controlling in-field phosphorus losses to surface water runoff"));
+            tmpArr.put(JSONUtils.dataDesc("psurf_trap_techn_score", rs1.psurf_trap_techn_score, "nutrient management technique mitigation score for trapping excess phophorus and keeping it from surface water"));
+            result1Arr.put(JSONUtils.dataDesc("Nutrient Technique Scores", tmpArr, "AoANutScores"));
         }
-         @Override
-        //writing the results back to JSON
-    protected void postProcess() throws Exception 
-    {
-                JSONArray result1Arr = new JSONArray();
-                 for(Result1 rs1:result1)
-                {
-                    JSONArray tmpArr = new JSONArray();
-                    tmpArr.put(JSONUtils.dataDesc("AoAId", AoAid, "Area of Analysis Identifier"));
-                    tmpArr.put(JSONUtils.dataDesc("nleach_techn_score", rs1.nleach_techn_score, "nutrient management technique mitigation score for nitrogen in ground water concern"));
-                    tmpArr.put(JSONUtils.dataDesc("nsurf_techn_score", rs1.nsurf_techn_score, "nutrient management technique mitigation score for nitrogen in surface water concern"));
-                    tmpArr.put(JSONUtils.dataDesc("psurf_techn_score", rs1.psurf_techn_score, "nutrient management technique mitigation score for phosphorus in surface water concern"));
-                    tmpArr.put(JSONUtils.dataDesc("nleach_avoid_techn_score", rs1.nleach_avoid_techn_score, "integer, nutrient management technique mitigation score for avoiding excess nitrogen use or application and loss to groundwater"));
-                    tmpArr.put(JSONUtils.dataDesc("nleach_control_techn_score", rs1.nleach_control_techn_score, "nutrient management technique mitigation score for controlling in-field nitrogen losses to groundwater"));
-                    tmpArr.put(JSONUtils.dataDesc("nleach_trap_techn_score", rs1.nleach_trap_techn_score, "nutrient management technique mitigation score for trapping excess nitrogen and keeping it from groundwater"));
-                    tmpArr.put(JSONUtils.dataDesc("nsurf_avoid_techn_score", rs1.nsurf_avoid_techn_score, "nutrient management technique mitigation score for avoiding excess nitrogen use or application and loss to surface water"));
-                    tmpArr.put(JSONUtils.dataDesc("nsurf_control_techn_score", rs1.nsurf_control_techn_score, "nutrient management technique mitigation score for controlling in-field nitrogen losses to surface water runoff"));
-                    tmpArr.put(JSONUtils.dataDesc("nsurf_trap_techn_score", rs1.nsurf_trap_techn_score, "nutrient management technique mitigation score for trapping excess nitrogen and keeping it from surface water"));
-                    tmpArr.put(JSONUtils.dataDesc("psurf_avoid_techn_score", rs1.psurf_avoid_techn_score, "nutrient management technique mitigation score for avoiding excess phosphorus use or application and loss to surface water"));
-                    tmpArr.put(JSONUtils.dataDesc("psurf_control_techn_score", rs1.psurf_control_techn_score, "nutrient management technique mitigation score for controlling in-field phosphorus losses to surface water runoff"));
-                    tmpArr.put(JSONUtils.dataDesc("psurf_trap_techn_score", rs1.psurf_trap_techn_score, "nutrient management technique mitigation score for trapping excess phophorus and keeping it from surface water"));
-                    result1Arr.put(JSONUtils.dataDesc("Nutrient Technique Scores", tmpArr, "AoANutScores"));
-                }
-                
-                putResult("operation", result1Arr);    
+        putResult("operation", result1Arr);
     }
-    
 
 }

src/java/m/wqm/nuttechscores/V1_0.json

@@ -1,151 +1,143 @@
 {
- "metainfo": {
- },
- "parameter": [
-  {
-   "name": "pestcomponents",
-   "value": [
-    [
-     {
-      "name": "AoAid",
-      "value": 1,
-      "Description":"Area of Analysis Identifier"
-      
-     },
-     {
-      "name": "plan_techn_id",
-      "value": 1,
-      "Description":"nutrient management technique identifier corresponding to nutrient_technique_score_id value in WQM data mart"
-     },
-     {
-      "name": "plan_techn_discrim_type",
-      "value": "",
-      "Description":"type of discriminator for varying nutrient management technique scores; value is “soil test result” otherwise NULL"
-     },
-     {
-      "name": "plan_techn_discrim",
-      "value": "",
-      "Description":"value of the discriminator:  HIGH,MEDIUM, LOW, NO SOIL TEST"
-     }
-     
-    ],
-    
-    [
-    {
-      "name": "AoAid",
-      "value": 1,
-      "Description":"Area of Analysis Identifier"
-      
-     },
-     {
-      "name": "plan_techn_id",
-      "value": 5,
-      "Description":"nutrient management technique identifier corresponding to nutrient_technique_score_id value in WQM data mart"
-     },
-     {
-      "name": "plan_techn_discrim_type",
-      "value": "",
-      "Description":"type of discriminator for varying nutrient management technique scores; value is “soil test result” otherwise NULL"
-     },
-     {
-      "name": "plan_techn_discrim",
-      "value": "",
-      "Description":"value of the discriminator:  HIGH,MEDIUM, LOW, NO SOIL TEST"
-     }
-    ],
-    [
+    "metainfo": {
+    },
+    "parameter": [
         {
-      "name": "AoAid",
-      "value": 1,
-      "Description":"Area of Analysis Identifier"
-      
-     },
-     {
-      "name": "plan_techn_id",
-      "value": 8,
-      "Description":"nutrient management technique identifier corresponding to nutrient_technique_score_id value in WQM data mart"
-     },
-     {
-      "name": "plan_techn_discrim_type",
-      "value": "Soil test result",
-      "Description":"type of discriminator for varying nutrient management technique scores; value is “soil test result” otherwise NULL"
-     },
-     {
-      "name": "plan_techn_discrim",
-      "value": "Medium",
-      "Description":"value of the discriminator:  HIGH,MEDIUM, LOW, NO SOIL TEST"
-     }
-    ],
-    [
-        {
-      "name": "AoAid",
-      "value": 1,
-      "Description":"Area of Analysis Identifier"
-      
-     },
-     {
-      "name": "plan_techn_id",
-      "value": 14,
-      "Description":"nutrient management technique identifier corresponding to nutrient_technique_score_id value in WQM data mart"
-     },
-     {
-      "name": "plan_techn_discrim_type",
-      "value": "",
-      "Description":"type of discriminator for varying nutrient management technique scores; value is “soil test result” otherwise NULL"
-     },
-     {
-      "name": "plan_techn_discrim",
-      "value": "",
-      "Description":"value of the discriminator:  HIGH,MEDIUM, LOW, NO SOIL TEST"
-     }
-    ],
-    [
-        {
-      "name": "AoAid",
-      "value": 1,
-      "Description":"Area of Analysis Identifier"
-      
-     },
-     {
-      "name": "plan_techn_id",
-      "value": 2,
-      "Description":"nutrient management technique identifier corresponding to nutrient_technique_score_id value in WQM data mart"
-     },
-     {
-      "name": "plan_techn_discrim_type",
-      "value": "",
-      "Description":"type of discriminator for varying nutrient management technique scores; value is “soil test result” otherwise NULL"
-     },
-     {
-      "name": "plan_techn_discrim",
-      "value": "",
-      "Description":"value of the discriminator:  HIGH,MEDIUM, LOW, NO SOIL TEST"
-     }
-    ],
-    [
-        {
-      "name": "AoAid",
-      "value": 1,
-      "Description":"Area of Analysis Identifier"
-      
-     },
-     {
-      "name": "plan_techn_id",
-      "value": 9,
-      "Description":"nutrient management technique identifier corresponding to nutrient_technique_score_id value in WQM data mart"
-     },
-     {
-      "name": "plan_techn_discrim_type",
-      "value": "",
-      "Description":"type of discriminator for varying nutrient management technique scores; value is “soil test result” otherwise NULL"
-     },
-     {
-      "name": "plan_techn_discrim",
-      "value": "",
-      "Description":"value of the discriminator:  HIGH,MEDIUM, LOW, NO SOIL TEST"
-     }
+            "name": "pestcomponents",
+            "value": [
+                [
+                    {
+                        "name": "AoAid",
+                        "value": 1,
+                        "Description": "Area of Analysis Identifier"
+                    },
+                    {
+                        "name": "plan_techn_id",
+                        "value": 1,
+                        "Description": "nutrient management technique identifier corresponding to nutrient_technique_score_id value in WQM data mart"
+                    },
+                    {
+                        "name": "plan_techn_discrim_type",
+                        "value": "",
+                        "Description": "type of discriminator for varying nutrient management technique scores; value is “soil test result” otherwise NULL"
+                    },
+                    {
+                        "name": "plan_techn_discrim",
+                        "value": "",
+                        "Description": "value of the discriminator:  HIGH,MEDIUM, LOW, NO SOIL TEST"
+                    }
+                ],
+                [
+                    {
+                        "name": "AoAid",
+                        "value": 1,
+                        "Description": "Area of Analysis Identifier"
+                    },
+                    {
+                        "name": "plan_techn_id",
+                        "value": 5,
+                        "Description": "nutrient management technique identifier corresponding to nutrient_technique_score_id value in WQM data mart"
+                    },
+                    {
+                        "name": "plan_techn_discrim_type",
+                        "value": "",
+                        "Description": "type of discriminator for varying nutrient management technique scores; value is “soil test result” otherwise NULL"
+                    },
+                    {
+                        "name": "plan_techn_discrim",
+                        "value": "",
+                        "Description": "value of the discriminator:  HIGH,MEDIUM, LOW, NO SOIL TEST"
+                    }
+                ],
+                [
+                    {
+                        "name": "AoAid",
+                        "value": 1,
+                        "Description": "Area of Analysis Identifier"
+                    },
+                    {
+                        "name": "plan_techn_id",
+                        "value": 8,
+                        "Description": "nutrient management technique identifier corresponding to nutrient_technique_score_id value in WQM data mart"
+                    },
+                    {
+                        "name": "plan_techn_discrim_type",
+                        "value": "Soil test result",
+                        "Description": "type of discriminator for varying nutrient management technique scores; value is “soil test result” otherwise NULL"
+                    },
+                    {
+                        "name": "plan_techn_discrim",
+                        "value": "Medium",
+                        "Description": "value of the discriminator:  HIGH,MEDIUM, LOW, NO SOIL TEST"
+                    }
+                ],
+                [
+                    {
+                        "name": "AoAid",
+                        "value": 1,
+                        "Description": "Area of Analysis Identifier"
+                    },
+                    {
+                        "name": "plan_techn_id",
+                        "value": 14,
+                        "Description": "nutrient management technique identifier corresponding to nutrient_technique_score_id value in WQM data mart"
+                    },
+                    {
+                        "name": "plan_techn_discrim_type",
+                        "value": "",
+                        "Description": "type of discriminator for varying nutrient management technique scores; value is “soil test result” otherwise NULL"
+                    },
+                    {
+                        "name": "plan_techn_discrim",
+                        "value": "",
+                        "Description": "value of the discriminator:  HIGH,MEDIUM, LOW, NO SOIL TEST"
+                    }
+                ],
+                [
+                    {
+                        "name": "AoAid",
+                        "value": 1,
+                        "Description": "Area of Analysis Identifier"
+                    },
+                    {
+                        "name": "plan_techn_id",
+                        "value": 2,
+                        "Description": "nutrient management technique identifier corresponding to nutrient_technique_score_id value in WQM data mart"
+                    },
+                    {
+                        "name": "plan_techn_discrim_type",
+                        "value": "",
+                        "Description": "type of discriminator for varying nutrient management technique scores; value is “soil test result” otherwise NULL"
+                    },
+                    {
+                        "name": "plan_techn_discrim",
+                        "value": "",
+                        "Description": "value of the discriminator:  HIGH,MEDIUM, LOW, NO SOIL TEST"
+                    }
+                ],
+                [
+                    {
+                        "name": "AoAid",
+                        "value": 1,
+                        "Description": "Area of Analysis Identifier"
+                    },
+                    {
+                        "name": "plan_techn_id",
+                        "value": 9,
+                        "Description": "nutrient management technique identifier corresponding to nutrient_technique_score_id value in WQM data mart"
+                    },
+                    {
+                        "name": "plan_techn_discrim_type",
+                        "value": "",
+                        "Description": "type of discriminator for varying nutrient management technique scores; value is “soil test result” otherwise NULL"
+                    },
+                    {
+                        "name": "plan_techn_discrim",
+                        "value": "",
+                        "Description": "value of the discriminator:  HIGH,MEDIUM, LOW, NO SOIL TEST"
+                    }
+                ]
+            ]
+        }
     ]
-   ]
-  }
- ]
 }