Package acme.dataapp

Examples of acme.dataapp.FlightController


        // Returns the message of the day for Acme Airlines
        MOTD motd = MOTD.getInstance();
        res = motd.getRandomMessageOfTheDay();
       
      } else if (path.contains("/api/fc/all")) {
        FlightController fc = FlightController.getInstance();
        res = fc.getAllFlightStatus();
       
      } else if (path.contains("/api/fc/")) {
        int idx = path.indexOf("/api/fc/") + "/api/fc/".length();
        String flightId = path.substring(idx);
        FlightController fc = FlightController.getInstance();
        String status = fc.getFlightStatus(flightId);
        res.put("status", status);

      } else if (path.contains("/api/myflights/")) { //-
        // gets flights for users
        Principal prin = request.getUserPrincipal();
View Full Code Here


      if (path.contains("/api/flight")) {
        // adds a new flight to the flights controller
        JSONObject flightObj = new JSONObject(request.getInputStream());

        FlightController fc = FlightController.getInstance();
        String flightId = (String) flightObj.get("flightId");
        String state = (String) flightObj.get("state");
        fc.addFlight(flightId, state);
        res.put("result", "added");

      } else if (path.contains("/api/flights")) {
        // adds a flight status
        Flights fs = Flights.getInstance();
        JSONObject o = new JSONObject(request.getInputStream());
        String flight = (String) o.get("flight");
        String depart = (String) o.get("depart");
        String arrive = (String) o.get("arrive");
        String time = (String) o.get("time");
        String flightTime = (String) o.get("flighttime");
        fs.add(flight, depart, arrive, time, flightTime);
        res.put("result", "added");

      } else if (path.contains("/api/addmyflight")) {

      } else if (path.contains("/api/login")) {

        // Manages the Login without the ugly basic popup window
        JSONObject loginObj = new JSONObject(request.getInputStream());
        String user = (String) loginObj.get("username");
        String pass = (String) loginObj.get("password");

        // Logs in the user
//        request.login(user, pass);

        if (request.getUserPrincipal().getName().compareTo(user) == 0) {
          res.put("status", "loggedin");
        } else {
          res.put("status", "error in login");
        }
      } else if (path.contains("/api/fc/")) {
        // Creates a new flight status
        JSONObject o = new JSONObject(request.getInputStream());
        String flightId = o.getString("flightId");
        String state = o.getString("state");
        FlightController fc = FlightController.getInstance();
        fc.addFlight(flightId, state);
        res.put("result", "added");
      } else if (path.contains("/api/myflights/")) {
        // Adds a flight
        Principal prin = request.getUserPrincipal();
        if (prin != null) {
View Full Code Here

      } else if (path.contains("/api/fc/")) {
        // deletes a new flight status
        JSONObject o = new JSONObject(request.getInputStream());
        String flightId = o.getString("flightId");
        FlightController fc = FlightController.getInstance();
        fc.removeFlightStatus(flightId);
        res.put("result", "deleted");
      } else if (path.contains("/api/myflights/")) {
        // gets all flight requests
        Principal prin = request.getUserPrincipal();
View Full Code Here

      else if (path.contains("/api/fc/")) {
        // Creates a new flight status
        JSONObject o = new JSONObject(request.getInputStream());
        String flightId = o.getString("flightId");
        String state = o.getString("state");
        FlightController fc = FlightController.getInstance();
        fc.updateFlightStatus(flightId, state);
        res.put("result", "updated");
      }

      else if (path.contains("/api/myflights/")) {
        // updates a flight
View Full Code Here

TOP

Related Classes of acme.dataapp.FlightController

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.