173174175176177178179180181182183
RouteType routeType; try { routeType = mapper.readValue(params.get("body"), RouteType.class); routeType.save(); renderJSON(Api.toJson(routeType, false)); } catch (Exception e) { e.printStackTrace(); badRequest(); }
193194195196197198199200201202203
if(routeType.id == null ||RouteType.findById(routeType.id) == null) badRequest(); RouteType updatedRouteType = RouteType.em().merge(routeType); updatedRouteType.save(); renderJSON(Api.toJson(updatedRouteType, false)); } catch (Exception e) { e.printStackTrace(); badRequest();
160161162163164165166167168169170
else { routeType = new RouteType(); routeType.gtfsRouteType = type; routeType.description = type.name(); routeType.save(); return routeType; } }