V2_0.java [src/java/m/wqm/wqm07_scpestslp] 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.wqm07_scpestslp;
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;
/**
* WQM-07: Pesticide Soil Leaching Potential
*
* @author Rumpal Sidhu
* @version 2.0
*/
@Name("WQM-07: Pesticide Soil Leaching Potential (PesticideSLP)")
@Description("This service computes pesticide soil leaching potential "
+ "for soil components in an area of analysis, and then computes "
+ "pesticide soil leaching potential representing the area of analysis. "
+ "The service primarily will consume data from the WQM-2 WQMSoilAttributes "
+ "service to compute soil pesticide leaching potential used later by "
+ "the WQM-13 service to compute threshold treatment level scores.")
@Path("m/pesticide_slp/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.calculatePesticideSLP();
pesticides.setResults(results());
pesticides.toWQM07Result();
}
}
}