Package dao.tro

Examples of dao.tro.Airport


    }
    public void delete (long id) {
        super.delete(id);
    }
    public Airport showInformation(Long id) {
        Airport airport = new Airport();
        try {
            String query = "SELECT Countries.Name, Countries.Id FROM Airports INNER JOIN Countries ON Airports.InCountry=Countries.Id WHERE Airports.Id=?";
            PreparedStatement statement = connection.prepareStatement(query);
            statement.setLong(1, id);
            ResultSet resultSet = statement.executeQuery();
            resultSet.next();
            Long countryId = resultSet.getLong("Id");
            String countryName = resultSet.getString("Name");
            query = "SELECT Airports.Id, Airports.Name, Airports.GatesNumber FROM Airports WHERE Id=?";
            statement = connection.prepareStatement(query);
            statement.setLong(1, id);
            resultSet = statement.executeQuery();
            while(resultSet.next()) {
                airport.setId(id);
                airport.setGatesNumber(resultSet.getInt("GatesNumber"));
                Country country = new Country();
                country.setId(countryId);
                country.setName(countryName);
                airport.setInCountry(country);
                airport.setName(resultSet.getString("Name"));
            }
        } catch(SQLException e) {
            Logs.info("Ошибка выборки " + e);
        }
        return airport;
View Full Code Here


            String query = "SELECT Id, Name FROM Airports";
            PreparedStatement statement = connection.prepareStatement(query);
            ResultSet resultSet = statement.executeQuery();
            int listIterator = 0;
            while (resultSet.next()) {
                airportList.add(new Airport());
                airportList.get(listIterator).setName(resultSet.getString("Name"));
                airportList.get(listIterator).setId(resultSet.getLong("Id"));
                listIterator++;
            }
        } catch (SQLException e) {
View Full Code Here

        try {
             PreparedStatement statement = connection.prepareStatement(query);
             ResultSet resultSet = statement.executeQuery();
             int listIterator = 0;
             while((resultSet.next())&&(listIterator<airportCount)) {
                 airportList.add(new Airport());
                 airportList.get(listIterator).setName(resultSet.getString("Name"));
                 airportList.get(listIterator).setId(resultSet.getLong("Id"));
                 airportList.get(listIterator).setGatesNumber(resultSet.getInt("GatesNumber"));
                 airportList.get(listIterator).setInCountry(new Country());
                 airportList.get(listIterator).getInCountry().setName(resultSet.getString("CName"));
View Full Code Here

            //заносим их в список
            int listIterator = 0;
            while (resultSet.next()) {
                flightList.add(new Flight());
                flightList.get(listIterator).setId(resultSet.getLong("Id"));
                flightList.get(listIterator).setDepartureAirport(new Airport());
                flightList.get(listIterator).getDepartureAirport().setId(departureAirportId);
                flightList.get(listIterator).getDepartureAirport().setName(departureAirportName);
                flightList.get(listIterator).setDestinationAirport(new Airport());
                flightList.get(listIterator).getDestinationAirport().setId(resultSet.getLong("destinationAirport"));
                flightList.get(listIterator).getDestinationAirport().setName(resultSet.getString("AName"));
                flightList.get(listIterator).setGate(resultSet.getInt("Gate"));
                listIterator++;
            }
View Full Code Here

            //заносим их в список
            int listIterator =0;
            while (resultSet.next()) {
                flightList.add(new Flight());
                flightList.get(listIterator).setId(resultSet.getLong("Id"));
                flightList.get(listIterator).setDepartureAirport(new Airport());
                flightList.get(listIterator).getDepartureAirport().setId(resultSet.getLong("departureAirport"));
                flightList.get(listIterator).getDepartureAirport().setName(resultSet.getString("AName"));
                flightList.get(listIterator).setDestinationAirport(new Airport());
                flightList.get(listIterator).getDestinationAirport().setId(destinationAirportId);
                flightList.get(listIterator).getDestinationAirport().setName(destinationAirportName);
                flightList.get(listIterator).setGate(resultSet.getInt("Gate"));
                listIterator++;
            }
View Full Code Here

                    " ON Airports.Id=Flights.destinationAirport WHERE Flights.Id=?";
            statement = connection.prepareStatement(query);
            statement.setLong(1, id);
            resultSet = statement.executeQuery();
            resultSet.next();
            flight.setDepartureAirport(new Airport());
            flight.getDepartureAirport().setId(resultSet.getLong("departureAirport"));
            flight.getDepartureAirport().setName(departureAirportName);
            flight.setId(resultSet.getLong("id"));
            flight.setDestinationAirport(new Airport());
            flight.getDestinationAirport().setId(resultSet.getLong("destinationAirport"));
            flight.getDestinationAirport().setName(resultSet.getString("Name"));
            flight.setGate(resultSet.getInt("Gate"));
            flight.setT(resultSet.getTimestamp("t"));
        } catch(SQLException e) {
View Full Code Here

            //создаем список из [flightCount] аэропортов
            int listIterator =0;
            while ((departureResultSet.next())&&(destinationResultSet.next())&&(listIterator<flightCount)) {
                flightList.add(new Flight());
                flightList.get(listIterator).setId(destinationResultSet.getLong("Id"));
                flightList.get(listIterator).setDepartureAirport(new Airport());
                flightList.get(listIterator).getDepartureAirport().setId(departureResultSet.getLong("AID"));
                flightList.get(listIterator).getDepartureAirport().setName(departureResultSet.getString("Name"));
                flightList.get(listIterator).setDestinationAirport(new Airport());
                flightList.get(listIterator).getDestinationAirport().setId(destinationResultSet.getLong("AID"));
                flightList.get(listIterator).getDestinationAirport().setName(destinationResultSet.getString("Name"));
                flightList.get(listIterator).setGate(destinationResultSet.getInt("Gate"));
                flightList.get(listIterator).setT(destinationResultSet.getTimestamp("t"));
                listIterator++;
View Full Code Here

TOP

Related Classes of dao.tro.Airport

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.