V1_0.java [src/java/m/cfa/flood] Revision: 584e7fe964a63c82a57c1c2693e9bb6fadc00272 Date: Thu Feb 04 15:37:35 MST 2016
package m.cfa.flood;
import csip.ModelDataService;
import java.io.File;
import javax.ws.rs.Path;
import oms3.annotations.Description;
import oms3.annotations.Name;
import oms3.annotations.VersionInfo;
import org.apache.commons.io.FileUtils;
@Name("flood")
@Description("flood")
@VersionInfo("1.0")
@Path("m/cfa/flood/1.0")
public class V1_0 extends ModelDataService {
guiFlood_Model model = new guiFlood_Model();
@Override
protected String process() throws Exception {
model.setMainFolder(getWorkspaceDir().toString());
model.setDatabase(getStringParam("database"));
model.setOrganizationName(getStringParam("org"));
model.setStationID(getStringParam("station_id"));
model.setStationName(getStringParam("station_name"));
model.setAnalysisType(getStringParam("analysis_type"));
model.setBeginDate(getStringParam("begin_date"));
model.setEndDate(getStringParam("end_date"));
model.setSkewness(getDoubleParam("skewness"));
model.setMeanSquareError(getDoubleParam("mean_square_error"));
model.setShowLargeFloods(getBooleanParam("show_large_floods"));
model.setPlotType(getBooleanParam("plot_type"));
model.setPlotReference(getBooleanParam("plot_ref"));
model.setUseSTORETretrieval(getBooleanParam("useSTORETretrieval"));
model.setSTORETdata(getStringParam("STORETdata"));
model.setMergeDatasets(getBooleanParam("merge_datasets"));
model.setMergeMethod(getStringParam("merge_method"));
model.setUserData(getStringParam("user_data"));
model.run();
return EXEC_OK;
}
@Override
protected void postProcess() throws Exception {
// files
putResult(new File(model.getGraph()));
// values
putResult("len", model.getLen());
putResult("start", model.getStart());
putResult("end", model.getEnd());
putResult("data_source", model.getDataSource());
String output = FileUtils.readFileToString(model.getOutput());
putResult("output", output);
putResult("graph", model.getGraph());
}
}