V1_0.java [src/java/m/datadownload] Revision: default Date:
package m.datadownload;
import csip.ModelDataService;
import csip.api.server.PayloadParameter;
import csip.api.server.PayloadResults;
import csip.annotations.Description;
import csip.annotations.Name;
import csip.annotations.VersionInfo;
import javax.ws.rs.Path;
@Name("datadownload")
@Description("USGS, USGS wells, STORET, SNOTEL, CDWR, NCDC data download")
@VersionInfo("1.0")
@Path("m/datadownload/datadownload/1.0")
public class V1_0 extends ModelDataService {
guiDataDownloads model = new guiDataDownloads();
@Override
protected void preProcess() throws Exception {
model.setDirectory(workspace().getDir().toString());
PayloadParameter inputPayload = parameter();
model.setAttributeFile(inputPayload.getString("attribute_file"));
model.setBeginDate(inputPayload.getString("begin_date"));
model.setEndDate(inputPayload.getString("end_date"));
model.setUSGSflowTF(inputPayload.getBoolean("USGS_flow_true"));
model.setUSGSwqTF(inputPayload.getBoolean("USGS_wq_true"));
model.setUSGSfloodTF(inputPayload.getBoolean("USGS_flood_true"));
model.setUSGSstageDischargeTF(inputPayload.getBoolean("USGS_stagedischarge_true"));
model.setUSGSWellsDepthTF(inputPayload.getBoolean("USGSwells_depth_true"));
model.setUSGSWellsWatertableHeightTF(inputPayload.getBoolean("USGSwells_height_true"));
model.setUSGSWellwqTF(inputPayload.getBoolean("USGSwells_wq_true"));
model.setSTORETflowTF(inputPayload.getBoolean("STORET_flow_true"));
model.setSTORETwqTF(inputPayload.getBoolean("STORET_wq_true"));
model.setCDWRflowTF(inputPayload.getBoolean("CDWR_flow_true"));
model.setCDWRstageDischargeTF(inputPayload.getBoolean("CDWR_stagedischarge_true"));
model.setNADPannualDataTF(inputPayload.getBoolean("NADP_annual_true"));
model.setNADPmonthlyDataTF(inputPayload.getBoolean("NADP_monthly_true"));
model.setNADPweeklyDataTF(inputPayload.getBoolean("NADP_weekly_true"));
model.setCDSNflowTF(inputPayload.getBoolean("CDSN_flow_true"));
model.setCDSNwqTF(inputPayload.getBoolean("CDSN_wq_true"));
}
@Override
protected void doProcess() throws Exception {
model.run();
}
@Override
protected void postProcess() throws Exception {
PayloadResults resultPayload = results();
// files
resultPayload.put(model.getResults());
// values
resultPayload.put("output", "Output successfully created");
resultPayload.put("output_location", model.getResults().getName());
}
}