V1_0.java [src/java/m/cfa/regionalfdc] Revision: 584e7fe964a63c82a57c1c2693e9bb6fadc00272  Date: Thu Feb 04 15:37:35 MST 2016
package m.cfa.regionalfdc;

import csip.ModelDataService;
import java.io.File;
import javax.ws.rs.Path;
import oms3.annotations.Description;
import oms3.annotations.Name;
import oms3.annotations.VersionInfo;

@Name("regionalfdc")
@Description("regionalfdc")
@VersionInfo("1.0")
@Path("m/cfa/regionalfdc/1.0")
public class V1_0 extends ModelDataService {

    guiRegionalFDC_Model model = new guiRegionalFDC_Model();

    @Override
    protected String process() throws Exception {
        model.setMainFolder(getWorkspaceDir().toString());
        model.setDatabases(getStringParam("databases"));
        model.setStationIDs(getStringParam("station_ids"));
        model.setStationNames(getStringParam("station_names"));
        model.setNormalizingMetricName(getStringParam("normalizing_metric_name"));
        model.setNormalizingMetrics(getStringParam("normalizing_metrics"));
        model.setFlowDurationCurves(getStringParam("flow_duration_curves"));
        
        model.run();
        return EXEC_OK;
    }
    
    @Override
    protected void postProcess() throws Exception {
        // files
        putResult(new File(model.getGraph()),
                  model.getRegionalFDC_results(),
                  //Below are the result graph files for use by JHighCharts on eRAMS for duplicating the above graphs
                  model.getRegionalFDCgraphOutput());

        // values
        putResult("summary_table", model.getSummaryTable());
        putResult("regional_flow_duration_curve", model.getRegionalFDC());
        putResult("units", model.getUnits());
        putResult("graph", model.getGraph());
        putResult("result_file", model.getRegionalFDC_results().getName());
        
        //Get result files for JSHighCharts
        String graphDataFiles = model.getRegionalFDCgraphOutput().getName();
        putResult("graph_data_files", graphDataFiles);
    }
}