V1_0.java [src/java/m/wqm/wqm_27] Revision: default Date:
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package m.wqm.wqm_27;
/*
* $Id$
*
* This file is part of the Cloud Services Integration Platform (CSIP),
* a Model-as-a-Service framework, API, and application suite.
*
* 2012-2017, OMSLab, Colorado State University.
*
* OMSLab licenses this file to you under the MIT license.
* See the LICENSE file in the project root for more information.
*/
import csip.Config;
import csip.ModelDataService;
import csip.api.server.ServiceException;
import csip.annotations.Resource;
import java.sql.Connection;
import java.sql.SQLException;
import javax.ws.rs.Path;
import csip.annotations.Description;
import csip.annotations.Name;
import org.codehaus.jettison.json.JSONException;
import wqm.utils.DBResources;
import static wqm.utils.DBResources.WQM_ID;
import wqm.utils.Pesticides;
/**
*
* @author <a href="mailto:shaun.case@colostate.edu">Shaun Case</a>
*
*/
@Name("WQM-27: RSPestHazRating")
@Description("Combined pesticide service: Integrates soils data from WQM-02 with WQM-04/07/08/09/10/11.")
@Path("m/wqm/rs_pest_hazrating/1.0")
@Resource(from = DBResources.class)
public class V1_0 extends ModelDataService {
private Pesticides pesticides;
static {
if (null == Pesticides.WQM_02_Service_URI) {
Pesticides.WQM_02_Service_URI = Config.getString("csip.wqmsoilparams.uri", "");
}
}
/**
* doProcess()
*
* Main process function inherited from ModelDataServices
*
*
* @author <a href="mailto:shaun.case@colostate.edu">Shaun Case</a>
*
* @throws org.codehaus.jettison.json.JSONException
* @throws csip.api.server.ServiceException
*/
@Override
protected void doProcess() throws ServiceException, JSONException, SQLException {
try( Connection conn = resources().getJDBC(WQM_ID)){
pesticides = new Pesticides(conn , getParamMap(), results());
// Get all Soils data needed first
pesticides.getSoilData();
// Call these in order as some results feed input needs of later ones.
// WQM-04
pesticides.calculatePesticideLossPotentials();
// WQM-07
pesticides.calculatePesticideSLP();
// WQM-08
pesticides.calculatePesticideSSRP();
// WQM-09
pesticides.calculatePesticideSARP();
// WQM-10
pesticides.calculateSoilPestLossPot();
// WQM-11
pesticides.calculatePestHazRating();
pesticides.toWQM27Result();
}
}
}