V2_0.java [src/java/m/wqm/wqm09_pesticidesarp] Revision: Date:
/*
* $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.
*/
package m.wqm.wqm09_pesticidesarp;
import csip.ModelDataService;
import csip.api.server.ServiceException;
import csip.annotations.Resource;
import javax.ws.rs.Path;
import csip.annotations.Description;
import csip.annotations.Name;
import java.sql.Connection;
import java.sql.SQLException;
import org.codehaus.jettison.json.JSONException;
import wqm.utils.DBResources;
import static wqm.utils.DBResources.WQM_ID;
import wqm.utils.Pesticides;
/**
* WQM-09: Pesticide Soil Adsorbed Runoff Potential
*
* @author Rumpal Sidhu
* @version 2.0
*/
@Name("WQM-09: Pesticide Soil Adsorbed Runoff Potential (PesticideSARP)")
@Description("This service computes pesticide soil adsorbed runoff potential "
+ "for soil components in an area of analysis, and then computes soil "
+ "adsorbed runoff potential representing the area of analysis. "
+ "The service primarily will consume data from the WQM-2 WQMSoilAttributes "
+ "service to compute pesticide soil adsorbed runoff potentials used "
+ "later by the WQM-13 to compute threshold treatment level scores.")
@Path("m/pesticide_sarp/2.0")
@Resource(from = DBResources.class)
public class V2_0 extends ModelDataService {
@Override
protected void doProcess() throws ServiceException, SQLException, JSONException {
try (Connection conn = resources().getJDBC(WQM_ID)) {
Pesticides pesticides = new Pesticides(conn);
pesticides.readAoAInput(getParamMap());
pesticides.calculatePesticideSARP();
pesticides.setResults(results());
pesticides.toWQM09Result();
}
}
}