Skip to content
Snippets Groups Projects
Commit 45ef21bb authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Added IPM Decisions model output format

parent 8322d29e
Branches
Tags
1 merge request!6Ipm decisions
......@@ -314,9 +314,28 @@ public class ModelResourceImpl implements ModelResource{
@Override
public Response runModelForIPMDecisions(@PathParam("modelId") String modelId, IPMDecisionsModelConfiguration config)
{
try
{
DataTransformer dt = new DataTransformer();
config.setConfigParameter("observations", dt.getVIPSWeatherData(config.getWeatherData()));
return this.runModel(modelId, config);
Model calledModel = ModelFactory.getInstance().getModelInstance(modelId);
calledModel.setConfiguration(config);
List<Result> results = calledModel.getResult();
return Response.ok().entity(dt.getIPMDecisionsModelOutput(results)).build();
}
catch(Exception ex)
{
Logger.getLogger(ModelResourceImpl.class.getName()).log(Level.SEVERE, null, ex);
if(ex instanceof ConfigValidationException){
throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST).entity(ex).build());
}
else
{
throw new WebApplicationException(Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(ex).build());
}
}
}
@Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment