Displaying differences for changeset
 
display as  

src/java/m/wqm/pestlosspot/Input.java

@@ -1,27 +1,26 @@
-
 package m.wqm.pestlosspot;
 
 /**
  *
  * @author Srinivas Reddy Kontham
+ * @update Rumpal Sidhu
  */
-public class Input
-{
+public class Input {
+
     int operation_id;
     int AoAId;
     String op_pest_id;
     String app_rate;
     String app_area;
     String app_method;
-    
-    public Input(int AoAId,int operation_id,String op_pest_id,String app_rate,String app_area,String app_method)
-    {
-        this.AoAId=AoAId;
-        this.operation_id=operation_id;
-        this.op_pest_id=op_pest_id;
-        this.app_rate=app_rate;
-        this.app_area=app_area;
-        this.app_method=app_method;
-       
+
+    public Input(int AoAId, int operation_id, String op_pest_id, String app_rate, String app_area, String app_method) {
+        this.AoAId = AoAId;
+        this.operation_id = operation_id;
+        this.op_pest_id = op_pest_id;
+        this.app_rate = app_rate;
+        this.app_area = app_area;
+        this.app_method = app_method;
+
     }
 }

src/java/m/wqm/pestlosspot/Result1.java

@@ -3,46 +3,52 @@
 /**
  *
  * @author Kontham Srinivas Reddy
+ * @ Update Rumpal Sidhu
  */
-public class Result1 
-{
-                    int operation_id;
-                    int AoAId;
-                    String op_pest_id;
-                    String app_rate;
-                    String app_area;
-                    String app_method; 
-                    String ai_name="";
-                    Double ai_ph=0.0;
-                    Double ai_sol=0.0;
-                    Double ai_koc=0.0;
-                    Double ai_hl=0.0;
-                    Double ai_fishtox=0.0;
-                    String ai_fishtoxtype="";
-                    Double ai_humtox=0.0;
-                    String ai_humtoxtype="";
-                    String ai_plp;
-                    String ai_psrp;
-                    String ai_parp;
-                public Result1(int AoAId,int operation_id,String op_pest_id,String app_rate,String ai_name,Double ai_ph, Double ai_hl, Double ai_koc,Double ai_sol,Double humtox,String humtoxtype,Double fishtox,String fishtoxtype,String ai_plp,String ai_psrp,String ai_parp,String op_app_area,String op_app_method)
-                {
-                    this.AoAId=AoAId;
-                    this.operation_id=operation_id;
-                    this.op_pest_id=op_pest_id;
-                    this.app_rate=app_rate;
-                    this.ai_name=ai_name;
-                    this.ai_ph=ai_ph;
-                    this.ai_hl=ai_hl;
-                    this.ai_koc=ai_koc;
-                    this.ai_sol=ai_sol;
-                    this.ai_humtox=humtox;
-                    this.ai_humtoxtype=humtoxtype;
-                    this.ai_fishtox=fishtox;
-                    this.ai_fishtoxtype=fishtoxtype;
-                    this.ai_plp=ai_plp;
-                    this.ai_psrp=ai_psrp;
-                    this.ai_parp=ai_parp;
-                    this.app_area=op_app_area;
-                    this.app_method=op_app_method;
-                }
+public class Result1 {
+
+    int operation_id;
+    int AoAId;
+    String op_pest_id;
+    String app_rate;
+    String app_area;
+    String app_method;
+    String ai_name = "";
+    Double ai_ph = 0.0;
+    Double ai_sol = 0.0;
+    Double ai_koc = 0.0;
+    Double ai_hl = 0.0;
+    Double ai_fishtox = 0.0;
+    String ai_fishtoxtype = "";
+    Double ai_humtox = 0.0;
+    String ai_humtoxtype = "";
+    String ai_plp;
+    String ai_psrp;
+    String ai_parp;
+
+    public Result1(int AoAId, int operation_id, String op_pest_id, 
+            String app_rate, String ai_name, Double ai_ph, 
+            Double ai_hl, Double ai_koc, Double ai_sol, Double humtox, 
+            String humtoxtype, Double fishtox, String fishtoxtype, 
+            String ai_plp, String ai_psrp, String ai_parp, 
+            String op_app_area, String op_app_method) {
+        this.AoAId = AoAId;
+        this.operation_id = operation_id;
+        this.op_pest_id = op_pest_id;
+        this.app_rate = app_rate;
+        this.ai_name = ai_name;
+        this.ai_ph = ai_ph;
+        this.ai_hl = ai_hl;
+        this.ai_koc = ai_koc;
+        this.ai_sol = ai_sol;
+        this.ai_humtox = humtox;
+        this.ai_humtoxtype = humtoxtype;
+        this.ai_fishtox = fishtox;
+        this.ai_fishtoxtype = fishtoxtype;
+        this.ai_plp = ai_plp;
+        this.ai_psrp = ai_psrp;
+        this.ai_parp = ai_parp;
+        this.app_area = op_app_area;
+        this.app_method = op_app_method;
+    }
 }

src/java/m/wqm/pestlosspot/V1_0.java

@@ -1,5 +1,5 @@
+package m.wqm.pestlosspot;
 
-package m.wqm.pestlosspot;
 import csip.ModelDataService;
 import java.util.ArrayList;
 import javax.ws.rs.Path;
@@ -11,235 +11,256 @@
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.ResultSet;
+import java.sql.SQLException;
 import java.sql.Statement;
 import java.util.Map;
+
 /**
  *
  * @ Srinivas
+ * @ Update Rumpal Sidhu
  */
 @Name("WQM-4")
 @Description("Pesticide Attributes (WQMPestAttr)")
 @Path("m/pestlosspot/1.0")
 
-public class V1_0 extends ModelDataService{
-    
-  
+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";
+
     //JSONArray getArray
-    ArrayList<Input> components=new ArrayList<>(); // store the set of all input soilcomponents as objects
-    ArrayList<Result1> result1=new ArrayList<>();  // store the result as objects
+    private ArrayList<Input> components; // store the set of all input soilcomponents as objects
+    private ArrayList<Result1> result1;  // store the result as objects
+
     @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));
-                int AoAId = JSONUtils.getIntParam(group, "AoAId", 0);
-                int operation_id=JSONUtils.getIntParam(group,"operation_id",0);
-                String op_pest_id=JSONUtils.getStringParam(group,"op_pest_id","err");
-                String app_rate=JSONUtils.getStringParam(group,"app_rate","err");
-                String app_area=JSONUtils.getStringParam(group,"app_area","err");
-                String app_method=JSONUtils.getStringParam(group,"app_method","err");
-                Input input=new Input(AoAId,operation_id,op_pest_id,app_rate,app_area,app_method);
-                components.add(input);
+        for (int i = 0; i < groups.length(); i++) {
+            Map<String, JSONObject> group = JSONUtils.preprocess(groups.getJSONArray(i));
+            int AoAId = JSONUtils.getIntParam(group, "AoAId", 0);
+            int operation_id = JSONUtils.getIntParam(group, "operation_id", 0);
+            String op_pest_id = JSONUtils.getStringParam(group, "op_pest_id", "err");
+            String app_rate = JSONUtils.getStringParam(group, "app_rate", "err");
+            String app_area = JSONUtils.getStringParam(group, "app_area", "err");
+            String app_method = JSONUtils.getStringParam(group, "app_method", "err");
+            Input input = new Input(AoAId, operation_id, op_pest_id, app_rate, app_area, app_method);
+            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();
+
+            for (Input ip : components) {
+                String ai_name = "";
+                double ai_ph = 0.0;
+                double ai_sol = 0.0;
+                double ai_koc = 0.0;
+                double ai_hl = 0.0;
+                double ai_fishtox = 0.0;
+                String ai_fishtoxtype = "";
+                double ai_humtox = 0.0;
+                String ai_humtoxtype = "";
+
+                String query = "SELECT * FROM wqm_pesticides WHERE \"PC_CODE\"='" + ip.op_pest_id + "';";
+                ResultSet results = statement.executeQuery(query);
+                while (results.next()) {
+                    ai_name = results.getString("AI_NAME");
+                    ai_ph = results.getDouble("PH");
+                    ai_hl = results.getDouble("SOIL_HL_RV");
+                    ai_koc = results.getDouble("KOC_RV");
+                    ai_sol = results.getDouble("SOL_RV");
+                    ai_humtox = results.getDouble("HUMAN_TOX_PPB");
+                    ai_humtoxtype = results.getString("HUMAN_TOX_TYPE");
+                    ai_fishtox = results.getDouble("FISH_TOX_PPB");
+                    ai_fishtoxtype = results.getString("FISH_TOX_TYPE");
+                }
+
+                //     #Compute pesticide leaching potential fore each operation pesticide
+                double log_val = Math.log10(ai_hl) * (4 - Math.log10(ai_koc));
+                String ai_plp;
+                if (log_val >= 2.8) {
+                    if (ip.app_area.equals("Banded")
+                            || ip.app_method.equals("Foliar Application")
+                            || ip.app_rate.equals("LOW")) {
+                        ai_plp = "INTERMEDIATE";
+                    } else if (ip.app_area.equals("Spot Treatment")
+                            || ip.app_rate.equals("ULTRA LOW")) {
+                        ai_plp = "LOW";
+                    } else {
+                        ai_plp = "HIGH";
+                    }
+                } else if (log_val < 0.0 || (ai_sol < 1 && ai_hl <= 1)) {
+                    ai_plp = "VERY LOW";
+                } else if (log_val <= 1.8) {
+                    if (ip.app_area.equals("Banded")
+                            || ip.app_area.equals("Spot Treatment")
+                            || ip.app_method.equals("Foliar Application")
+                            || ip.app_rate.equals("LOW")
+                            || ip.app_rate.equals("ULTRA LOW")) {
+                        ai_plp = "VERY LOW";
+                    } else {
+                        ai_plp = "LOW";
+                    }
+                } else {
+                    if (ip.app_area.equals("Banded")
+                            || ip.app_method.equals("Foliar Application")
+                            || ip.app_rate.equals("LOW")) {
+                        ai_plp = "LOW";
+                    } else if (ip.app_area.equals("Spot Treatment")
+                            || ip.app_rate.equals("ULTRA LOW")) {
+                        ai_plp = "VERY LOW";
+                    } else {
+                        ai_plp = "INTERMEDIATE";
+                    }
+                }
+
+                String ai_psrp;
+                //   #Compute pesticide solution runoff potential for each operation pesticide
+                if ((ai_sol >= 1 && ai_hl > 35 && ai_koc < 100000)
+                        || (ai_sol >= 10 && ai_sol < 100 && ai_koc <= 700)) {
+                    if (ip.app_area.equals("Banded")
+                            || ip.app_method.equals("Foliar Application")
+                            || ip.app_method.equals("Soil Incorporated")
+                            || ip.app_rate.equals("LOW")) {
+                        ai_psrp = "INTERMEDIATE";
+                    } else if (ip.app_area.equals("Spot Treatment")
+                            || ip.app_rate.equals("ULTRA LOW")) {
+                        ai_psrp = "LOW";
+                    } else {
+                        ai_psrp = "HIGH";
+                    }
+                } else if ((ai_koc >= 100000)
+                        || (ai_koc >= 1000 && ai_hl <= 1)
+                        || (ai_sol < 0.5 && ai_hl < 35)) {
+                    if (ip.app_area.equals("Banded")
+                            || ip.app_area.equals("Spot Treatment")
+                            || ip.app_method.equals("Foliar Application")
+                            || ip.app_method.equals("Soil Incorporated")
+                            || ip.app_rate.equals("LOW")
+                            || ip.app_rate.equals("ULTRA LOW")) {
+                        ai_psrp = "VERY LOW";
+                    } else {
+                        ai_psrp = "LOW";
+                    }
+                } else {
+                    if (ip.app_area.equals("Banded")
+                            || ip.app_method.equals("Foliar Application")
+                            || ip.app_method.equals("Soil Incorporated")
+                            || ip.app_rate.equals("LOW")) {
+                        ai_psrp = "LOW";
+                    } else if (ip.app_area.equals("Spot Treatment")
+                            || ip.app_rate.equals("ULTRA LOW")) {
+                        ai_psrp = "VERY LOW";
+                    } else {
+                        ai_psrp = "INTERMEDIATE";
+                    }
+                }
+
+                //    #Compute pesticide adsorbed runoff potential for each operation pesticide
+                String ai_parp;
+                if ((ai_hl >= 40 && ai_koc >= 1000)
+                        || (ai_hl >= 40 && ai_koc >= 500 && ai_sol <= 0.5)) {
+                    if (ip.app_area.equals("Banded")
+                            || ip.app_method.equals("Foliar Application")
+                            || ip.app_method.equals("Soil Incorporate")
+                            || ip.app_rate.equals("LOW")) {
+                        ai_parp = "INTERMEDIATE";
+                    } else if (ip.app_area.equals("Spot Treatment")
+                            || ip.app_rate.equals("ULTRA LOW")) {
+                        ai_parp = "LOW";
+                    } else {
+                        ai_parp = "HIGH";
+                    }
+                } else if ((ai_hl <= 1) || (ai_hl <= 2 && ai_koc <= 500)
+                        || (ai_hl <= 4 && ai_koc <= 900 && ai_sol >= 0.5)
+                        || (ai_hl <= 40 && ai_koc <= 500 && ai_sol >= 0.5)
+                        || (ai_hl <= 50 && ai_koc <= 900 && ai_sol >= 2)) {
+                    if (ip.app_area.equals("Banded")
+                            || ip.app_area.equals("Spot Treatment")
+                            || ip.app_method.equals("Foliar Application")
+                            || ip.app_method.equals("Soil Incorporated")
+                            || ip.app_rate.equals("LOW")
+                            || ip.app_rate.equals("ULTRA LOW")) {
+                        ai_parp = "VERY LOW";
+                    } else {
+                        ai_parp = "LOW";
+                    }
+                } else {
+                    if (ip.app_area.equals("Banded")
+                            || ip.app_method.equals("Foliar Application")
+                            || ip.app_method.equals("Soil Incorporated")
+                            || ip.app_rate.equals("LOW")) {
+                        ai_parp = "VERY LOW";
+                    } else {
+                        ai_parp = "INTERMEDIATE";
+                    }
+                }
+                Result1 result = new Result1(ip.AoAId, ip.operation_id,
+                        ip.op_pest_id, ip.app_rate, ai_name, ai_ph, ai_hl,
+                        ai_koc, ai_sol, ai_humtox, ai_humtoxtype, ai_fishtox,
+                        ai_fishtoxtype, ai_plp, ai_psrp, ai_parp,
+                        ip.app_area, ip.app_method);
+                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/wqm", "postgres", "admin");
-                conn.setAutoCommit(false);
-                statement = conn.createStatement();
-                    
-                for(Input ip:components)
-                {
-                    String pc_code="";
-                    String ai_name="";
-                    Double ai_ph=0.0;
-                    Double ai_sol=0.0;
-                    Double ai_koc=0.0;
-                    Double ai_hl=0.0;
-                    Double ai_fishtox=0.0;
-                    String ai_fishtoxtype="";
-                    Double ai_humtox=0.0;
-                    String ai_humtoxtype="";
-                
-                    String query="SELECT * FROM wqm_pesticides WHERE \"PC_CODE\"='"+ip.op_pest_id+"';";
-                    ResultSet results = statement.executeQuery(query);
-                    while (results.next())
-                    {
-                        pc_code=results.getString("PC_CODE");
-                        ai_name=results.getString("AI_NAME");
-                        ai_ph=results.getDouble("PH");
-                        ai_sol=results.getDouble("SOL_RV");
-                        ai_koc=results.getDouble("KOC_RV");
-                        ai_hl=results.getDouble("SOIL_HL_RV");
-                        ai_fishtox=results.getDouble("FISH_TOX_PPB");
-                        ai_fishtoxtype=results.getString("FISH_TOX_TYPE");
-                        ai_humtox=results.getDouble("HUMAN_TOX_PPB");
-                        ai_humtoxtype=results.getString("HUMAN_TOX_TYPE");
-                    }
-               //     #Compute pesticide leaching potential fore each operation pesticide
-                    double log_val=Math.log(ai_hl)*(4-Math.log(ai_koc));
-                    String ai_plp="";
-                    if(log_val>=2.8)
-                    {
-                        if(ip.app_area.equals("Banded")||ip.app_method.equals("Foliar Application")||ip.app_rate.equals("LOW"))
-                        {
-                            ai_plp="INTERMEDIATE";
-                        }
-                        else if(ip.app_area.equals("Spot Treatment")||ip.app_rate.equals("ULTRA LOW"))
-                        {
-                            ai_plp="LOW";
-                        }
-                        else
-                        {
-                            ai_plp="HIGH";
-                        }
-                        
-                    }
-                    else if(log_val<0.0 || (ai_sol<1 && ai_hl<=1))
-                    {
-                        ai_plp="VERY LOW";
-                    }
-                    else if(log_val<=1.8)
-                    {
-                        if(ip.app_area.equals("Banded")||ip.app_area.equals("Spot Treatment")||ip.app_method.equals("Foliar Application")||ip.app_rate.equals("LOW")||ip.app_rate.equals("ULTRA LOW"))
-                        {
-                            ai_plp="VERY LOW";
-                            
-                        }
-                        else
-                        {
-                            ai_plp="LOW";
-                        }
-                    }
-                    else
-                    {
-                        if(ip.app_area.equals("Banded")||ip.app_method.equals("Foliar Application")||ip.app_rate.equals("LOW"))
-                        {
-                            ai_plp="LOW";
-                        }
-                        else if(ip.app_area.equals("Spot Treatment")||ip.app_rate.equals("ULTRA LOW"))
-                        {
-                            ai_plp="VERY LOW";
-                        }
-                        else
-                        {
-                            ai_plp="INTERMEDIATE";
-                        }
-                            
-                    }String ai_psrp="";
-                 //   #Compute pesticide solution runoff potential for each operation pesticide
-                    if((ai_sol>=1 && ai_hl>35 && ai_koc <100000) ||(ai_sol >=10 && ai_hl <100 &&ai_koc <=700 ))
-                    {
-                        if(ip.app_area.equals("Banded")||ip.app_method.equals("Foliar Application")||ip.app_method.equals("Soil Incorporated") || ip.app_rate.equals("LOW"))
-                        {
-                            ai_psrp="INTERMEDIATE";
-                        }
-                        else if(ip.app_area.equals("Spot Treatment")||ip.app_rate.equals("ULTRA LOW"))
-                        {
-                            ai_plp="LOW";
-                        }
-                        else
-                        {
-                            ai_psrp="HIGH";
-                        }
-                    }
-                    else if((ai_koc>=100000)||(ai_koc>=1000 && ai_hl<=1)|| (ai_sol<0.5 && ai_hl<35))
-                    {
-                        if(ip.app_area.equals("Banded")||ip.app_area.equals("Spot Treatment")||ip.app_method.equals("Foliar Application")||ip.app_method.equals("Soil Incorporated")||ip.app_rate.equals("LOW")||ip.app_rate.equals("ULTRA LOW"))
-                        {
-                            ai_psrp="VERY LOW";
-                        }
-                        else
-                        {
-                            ai_psrp="LOW";
-                        }
-                    }
-                    else
-                    {
-                        if(ip.app_area.equals("Banded")||ip.app_method.equals("Foliar Application")||ip.app_method.equals("Soil Incorporated")||ip.app_rate.equals("LOW"))
-                        {
-                            ai_psrp="LOW";
-                        }
-                        else if(ip.app_area.equals("Spot Treatment")||ip.app_rate.equals("ULTRA LOW"))
-                        {
-                            ai_psrp="VERY LOW";
-                        }
-                        else
-                        {
-                            ai_psrp="INTERMEDIATE";
-                        }
-                    }
-                //    #Compute pesticide adsorbed runoff potential for each operation pesticide
-                    String ai_parp="";
-                    if((ai_hl>=40&&ai_koc>=1000)||(ai_hl>=40 &&ai_koc>=500 &&ai_sol<=0.5))
-                    {
-                        if(ip.app_area.equals("Banded")||ip.app_method.equals("Foliar Application")||ip.app_method.equals("Soil Incorporate")||ip.app_rate.equals("LOW"))
-                        {
-                            ai_parp="INTERMEDIATE";
-                        }
-                        else if(ip.app_area.equals("Spot Treatment")||ip.app_rate.equals("ULTRA LOW"))
-                        {
-                            ai_parp="LOW";
-                        }
-                        else
-                        {
-                            ai_parp="HIGH";
-                        }
-                        
-                    }
-                    else if((ai_hl<=1)||(ai_hl<=2 &&ai_koc<=500)||(ai_koc<=900 && ai_sol>=0.5)||(ai_hl<=40&&ai_koc<=500 && ai_sol>=0.5)||(ai_hl<=50 && ai_koc<=900 && ai_sol>=2))
-                    {
-                        if(ip.app_area.equals("Banded")||ip.app_area.equals("Spot Treatment")||ip.app_method.equals("Foliar Application")||ip.app_method.equals("Soil Incorporated")||ip.app_rate.equals("LOW")||ip.app_rate.equals("ULTRA LOW"))
-                        {
-                            ai_parp="VERY LOW";
-                        }
-                        else
-                        {
-                            ai_parp="LOW";
-                        }
-                    }
-                    Result1 result=new Result1(ip.AoAId,ip.operation_id,ip.op_pest_id,ip.app_rate,ai_name,ai_ph,ai_hl,ai_koc,ai_sol,ai_humtox,ai_humtoxtype,ai_fishtox,ai_fishtoxtype,ai_plp,ai_psrp,ai_parp,ip.app_area,ip.app_method); 
-                    result1.add(result);    
-               }
-                return EXEC_OK; 
-            }
-        @Override
-        //writing the results back to JSON
+        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("operation_id", rs1.operation_id, "Operation ID"));
-                  
-                    tmpArr.put(JSONUtils.dataDesc("op_pest_id", rs1.op_pest_id, "Pesticide Identifier (PC_CODE)"));
-                    tmpArr.put(JSONUtils.dataDesc("app_rate", rs1.app_rate, "Pesticide Application Rating"));
-                    tmpArr.put(JSONUtils.dataDesc("ai_name", rs1.ai_name, "Active Ingredient Name (AI_NAME)"));
-                    tmpArr.put(JSONUtils.dataDesc("ai_ph", rs1.ai_ph, "Active ingredient pH of associate properties (PH)"));
-                    tmpArr.put(JSONUtils.dataDesc("ai_hl", rs1.ai_hl, "Active ingredient field half life (HL)"));
-                    tmpArr.put(JSONUtils.dataDesc("ai_koc", rs1.ai_koc, "Active ingredient soil organic carbon sorption coefficient (KOC)"));
-                    tmpArr.put(JSONUtils.dataDesc("ai_sol", rs1.ai_sol, "Active ingredient solubility in water (SOL)"));
-                    tmpArr.put(JSONUtils.dataDesc("ai_humtox", rs1.ai_humtox, "Active ingredient human toxicity value – long term"));
-                   tmpArr.put(JSONUtils.dataDesc("ai_humtoxtype", rs1.ai_humtoxtype, "Active ingredient human toxicity type"));
-                   tmpArr.put(JSONUtils.dataDesc("ai_fistox", rs1.ai_fishtox, "Active ingredient maximum acceptable toxicant concentration-fish"));
-                   tmpArr.put(JSONUtils.dataDesc("ai_fishtoxtype", rs1.ai_fishtoxtype, "Active ingredient fish toxicity type"));
-                   tmpArr.put(JSONUtils.dataDesc("ai_plp", rs1.ai_plp, "Active ingredient pesticide leaching potential"));
-                   tmpArr.put(JSONUtils.dataDesc("ai_psrp", rs1.ai_psrp, "Active ingredient pesticide soil leaching potential"));
-                   tmpArr.put(JSONUtils.dataDesc("ai_parp", rs1.ai_parp, "Active ingredient pesticide adsorbed runoff potential"));
-                   tmpArr.put(JSONUtils.dataDesc("op_app_area", rs1.app_area, "Pesticide application operation area"));
-                   tmpArr.put(JSONUtils.dataDesc("op_app_method", rs1.app_method, "Pesticide application operation method"));
-                   result1Arr.put(JSONUtils.dataDesc("pesticide summary", tmpArr, "Pest"));
-                }
-                
-                putResult("operation", result1Arr);    
+        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("operation_id", rs1.operation_id, "Operation ID"));
+            tmpArr.put(JSONUtils.dataDesc("op_pest_id", rs1.op_pest_id, "Pesticide Identifier (PC_CODE)"));
+            tmpArr.put(JSONUtils.dataDesc("app_rate", rs1.app_rate, "Pesticide Application Rating"));
+            tmpArr.put(JSONUtils.dataDesc("ai_name", rs1.ai_name, "Active Ingredient Name (AI_NAME)"));
+            tmpArr.put(JSONUtils.dataDesc("ai_ph", rs1.ai_ph, "Active ingredient pH of associate properties (PH)"));
+            tmpArr.put(JSONUtils.dataDesc("ai_hl", rs1.ai_hl, "Active ingredient field half life (HL)"));
+            tmpArr.put(JSONUtils.dataDesc("ai_koc", rs1.ai_koc, "Active ingredient soil organic carbon sorption coefficient (KOC)"));
+            tmpArr.put(JSONUtils.dataDesc("ai_sol", rs1.ai_sol, "Active ingredient solubility in water (SOL)"));
+            tmpArr.put(JSONUtils.dataDesc("ai_humtox", rs1.ai_humtox, "Active ingredient human toxicity value – long term"));
+            tmpArr.put(JSONUtils.dataDesc("ai_humtoxtype", rs1.ai_humtoxtype, "Active ingredient human toxicity type"));
+            tmpArr.put(JSONUtils.dataDesc("ai_fistox", rs1.ai_fishtox, "Active ingredient maximum acceptable toxicant concentration-fish"));
+            tmpArr.put(JSONUtils.dataDesc("ai_fishtoxtype", rs1.ai_fishtoxtype, "Active ingredient fish toxicity type"));
+            tmpArr.put(JSONUtils.dataDesc("ai_plp", rs1.ai_plp, "Active ingredient pesticide leaching potential"));
+            tmpArr.put(JSONUtils.dataDesc("ai_psrp", rs1.ai_psrp, "Active ingredient pesticide soil leaching potential"));
+            tmpArr.put(JSONUtils.dataDesc("ai_parp", rs1.ai_parp, "Active ingredient pesticide adsorbed runoff potential"));
+            tmpArr.put(JSONUtils.dataDesc("op_app_area", rs1.app_area, "Pesticide application operation area"));
+            tmpArr.put(JSONUtils.dataDesc("op_app_method", rs1.app_method, "Pesticide application operation method"));
+            result1Arr.put(JSONUtils.dataDesc("pesticide summary", tmpArr, "Pest"));
+        }
+        putResult("operation", result1Arr);
     }
-    }   
-    
-
+}

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

@@ -1,80 +1,215 @@
 {
- "metainfo": {
- },
- "parameter": [
-  {
-   "name": "pestcomponents",
-   "value": [
-    [
-     {
-      "name": "AoAId",
-      "value": 1,
-      "Description":"Area of Analysis Identifier"
-      
-     },
-     {
-      "name": "operation_id",
-      "value": 1,
-      "Description":"Pesticide application operation identifier"
-      
-     },
-     {
-      "name": "op_pest_id",
-      "value": "101101",
-      "Description":"Pesticide identifier, EPA Pesticide Chemical Code (PC_CODE)"
-     },
-     {
-      "name": "app_rate",
-      "value": "STANDARD",
-      "Description":"Pesticide application rate"
-     },
-     {
-      "name": "app_area",
-      "value": "Broadcast",
-      "Description":"Pesticide application operation area"
-     },
-     {
-      "name": "app_method",
-      "value": "Surface Applied",
-      "Description":"Pesticide application operation method"
-     }
-    ],
-    [
-     {
-      "name": "AoAId",
-      "value": 1,
-      "Description":"AoA Identifier"
-      
-     },
-     {
-      "name": "operation_id",
-      "value": 1,
-      "Description":"Pesticide application operation identifier"
-      
-     },
-     {
-      "name": "op_pest_id",
-      "value": "101702",
-      "Description":"Pesticide identifier, EPA Pesticide Chemical Code (PC_CODE)"
-     },
-     {
-      "name": "app_rate",
-      "value": "LOW",
-      "Description":"Pesticide application rate"
-     },
-     {
-      "name": "app_area",
-      "value": "Broadcast",
-      "Description":"Pesticide application operation area"
-     },
-     {
-      "name": "app_method",
-      "value": "Surface Applied",
-      "Description":"Pesticide application operation method"
-     }
+    "metainfo": {
+    },
+    "parameter": [
+        {
+            "name": "pestcomponents",
+            "value": [
+                [
+                    {
+                        "name": "AoAId",
+                        "value": 1,
+                        "Description": "Area of Analysis Identifier"
+
+                    },
+                    {
+                        "name": "operation_id",
+                        "value": 1,
+                        "Description": "Pesticide application operation identifier"
+
+                    },
+                    {
+                        "name": "op_pest_id",
+                        "value": "53501",
+                        "Description": "Pesticide identifier, EPA Pesticide Chemical Code (PC_CODE)"
+                    },
+                    {
+                        "name": "app_rate",
+                        "value": "Starndard Rate",
+                        "Description": "Pesticide application rate"
+                    },
+                    {
+                        "name": "app_area",
+                        "value": "Broadcast",
+                        "Description": "Pesticide application operation area"
+                    },
+                    {
+                        "name": "app_method",
+                        "value": "Surface Applied",
+                        "Description": "Pesticide application operation method"
+                    }
+                ],
+                [
+                    {
+                        "name": "AoAId",
+                        "value": 1,
+                        "Description": "Area of Analysis Identifier"
+
+                    },
+                    {
+                        "name": "operation_id",
+                        "value": 2,
+                        "Description": "Pesticide application operation identifier"
+
+                    },
+                    {
+                        "name": "op_pest_id",
+                        "value": "108801",
+                        "Description": "Pesticide identifier, EPA Pesticide Chemical Code (PC_CODE)"
+                    },
+                    {
+                        "name": "app_rate",
+                        "value": "Starndard Rate",
+                        "Description": "Pesticide application rate"
+                    },
+                    {
+                        "name": "app_area",
+                        "value": "Broadcast",
+                        "Description": "Pesticide application operation area"
+                    },
+                    {
+                        "name": "app_method",
+                        "value": "Surface Applied",
+                        "Description": "Pesticide application operation method"
+                    }
+                ],
+                [
+                    {
+                        "name": "AoAId",
+                        "value": 1,
+                        "Description": "Area of Analysis Identifier"
+
+                    },
+                    {
+                        "name": "operation_id",
+                        "value": 3,
+                        "Description": "Pesticide application operation identifier"
+
+                    },
+                    {
+                        "name": "op_pest_id",
+                        "value": "98301",
+                        "Description": "Pesticide identifier, EPA Pesticide Chemical Code (PC_CODE)"
+                    },
+                    {
+                        "name": "app_rate",
+                        "value": "Starndard Rate",
+                        "Description": "Pesticide application rate"
+                    },
+                    {
+                        "name": "app_area",
+                        "value": "Broadcast",
+                        "Description": "Pesticide application operation area"
+                    },
+                    {
+                        "name": "app_method",
+                        "value": "Surface Applied",
+                        "Description": "Pesticide application operation method"
+                    }
+                ], [
+                    {
+                        "name": "AoAId",
+                        "value": 1,
+                        "Description": "Area of Analysis Identifier"
+
+                    },
+                    {
+                        "name": "operation_id",
+                        "value": 4,
+                        "Description": "Pesticide application operation identifier"
+
+                    },
+                    {
+                        "name": "op_pest_id",
+                        "value": "105001",
+                        "Description": "Pesticide identifier, EPA Pesticide Chemical Code (PC_CODE)"
+                    },
+                    {
+                        "name": "app_rate",
+                        "value": "Starndard Rate",
+                        "Description": "Pesticide application rate"
+                    },
+                    {
+                        "name": "app_area",
+                        "value": "Broadcast",
+                        "Description": "Pesticide application operation area"
+                    },
+                    {
+                        "name": "app_method",
+                        "value": "Surface Applied",
+                        "Description": "Pesticide application operation method"
+                    }
+                ],
+                [
+                    {
+                        "name": "AoAId",
+                        "value": 1,
+                        "Description": "Area of Analysis Identifier"
+
+                    },
+                    {
+                        "name": "operation_id",
+                        "value": 5,
+                        "Description": "Pesticide application operation identifier"
+
+                    },
+                    {
+                        "name": "op_pest_id",
+                        "value": "128008",
+                        "Description": "Pesticide identifier, EPA Pesticide Chemical Code (PC_CODE)"
+                    },
+                    {
+                        "name": "app_rate",
+                        "value": "Starndard Rate",
+                        "Description": "Pesticide application rate"
+                    },
+                    {
+                        "name": "app_area",
+                        "value": "Broadcast",
+                        "Description": "Pesticide application operation area"
+                    },
+                    {
+                        "name": "app_method",
+                        "value": "Surface Applied",
+                        "Description": "Pesticide application operation method"
+                    }
+                ],
+                [
+                    {
+                        "name": "AoAId",
+                        "value": 1,
+                        "Description": "Area of Analysis Identifier"
+
+                    },
+                    {
+                        "name": "operation_id",
+                        "value": 6,
+                        "Description": "Pesticide application operation identifier"
+
+                    },
+                    {
+                        "name": "op_pest_id",
+                        "value": "81901",
+                        "Description": "Pesticide identifier, EPA Pesticide Chemical Code (PC_CODE)"
+                    },
+                    {
+                        "name": "app_rate",
+                        "value": "Starndard Rate",
+                        "Description": "Pesticide application rate"
+                    },
+                    {
+                        "name": "app_area",
+                        "value": "Broadcast",
+                        "Description": "Pesticide application operation area"
+                    },
+                    {
+                        "name": "app_method",
+                        "value": "Surface Applied",
+                        "Description": "Pesticide application operation method"
+                    }
+                ]
+            ]
+        }
     ]
-   ]
-  }
- ]
 }