Package models.transit

Examples of models.transit.RouteType


    public static void getRouteType(Long id) {
        try {
            if(id != null)
            {
              RouteType routeType = RouteType.findById(id);
                if(routeType != null)
                    renderJSON(Api.toJson(routeType, false));
                else
                    notFound();
            }
View Full Code Here


        }

    }

    public static void createRouteType() {
      RouteType routeType;

        try {
            routeType = mapper.readValue(params.get("body"), RouteType.class);

            routeType.save();
            renderJSON(Api.toJson(routeType, false));
        } catch (Exception e) {
            e.printStackTrace();
            badRequest();
        }
View Full Code Here

        }
    }


    public static void updateRouteType() {
      RouteType routeType;

        try {
          routeType = mapper.readValue(params.get("body"), RouteType.class);

            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();
View Full Code Here

    public static void deleteRouteType(Long id) {
        if(id == null)
            badRequest();

        RouteType routeType = RouteType.findById(id);

        if(routeType == null)
            badRequest();

        routeType.delete();

        ok();
    }
View Full Code Here

      }
     
      if(type == null)
      return null;
   
      RouteType routeType = RouteType.find("gtfsRouteType = ?", type).first();
     
      if(routeType != null)
        return routeType;
     
      else {
       
        routeType = new RouteType();
        routeType.gtfsRouteType = type;
        routeType.description = type.name();
        routeType.save();
       
        return routeType;
      }   
    }
View Full Code Here

TOP

Related Classes of models.transit.RouteType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.