}
}
public static void updateRoute() {
Route route;
try {
route = mapper.readValue(params.get("body"), Route.class);
if(route.id == null || Route.findById(route.id) == null)
badRequest();
// check if gtfsRouteId is specified, if not create from DB id
if(route.gtfsRouteId == null)
route.gtfsRouteId = "ROUTE_" + route.id.toString();
Route updatedRoute = Route.em().merge(route);
updatedRoute.save();
renderJSON(Api.toJson(updatedRoute, false));
} catch (Exception e) {
e.printStackTrace();
badRequest();