/*This code was generated using the UMPLE modeling language!*/

package Airline;

import java.sql.Time;
import java.sql.Date;
import java.util.ArrayList;
import java.util.Iterator;
import Airline.json.*;
import Airline.flights.*;
import Airline.humanResources.*;

public class AirlineFacade {
  // Singleton instance.
  private static AirlineFacade theInstance;

  //System registry.
  AirlineRegistry registry = AirlineRegistry.getInstance();

  /**
   * Dummy constructor
   */
  private AirlineFacade() {
  }

  /**
   * Returns the only instance of the Facade.
   * 
   * @return
   */
  public static AirlineFacade getInstance() {
    if (theInstance == null)
      theInstance = new AirlineFacade();
    return theInstance;
  }

  public int constructAirline() {
    return registry.add(new Airline());
  }

  public JSONObject constructAirlineJSON() throws JSONException {
    Airline contextObj = new Airline();
    registry.add(contextObj);
    return contextObj.getAttributes();
  }

  /************
   * Method returns an iterator to the list of id's of the elements involved in this list.
   ***************/
  public Iterator getRegularFlightsFromAirline(int context) {
    ArrayList listOfIDs = new ArrayList();
    for (RegularFlight obj : ((Airline) registry.getValue(context))
      .getRegularFlights()) {
      listOfIDs.add(registry.getKey(obj));
    }
    return listOfIDs.iterator();
  }

  /************
   * Method returns an iterator to the list of id's of the elements involved in this list.
   ***************/
  public Iterator getPersonsFromAirline(int context) {
    ArrayList listOfIDs = new ArrayList();
    for (Person obj : ((Airline) registry.getValue(context)).getPersons()) {
      listOfIDs.add(registry.getKey(obj));
    }
    return listOfIDs.iterator();
  }

  public int addRegularFlightToAirline(int context, Time aTime,
    int aFlightNumber) throws Exception {
    return registry.getKey(((Airline) registry.getValue(context))
      .addRegularFlight(aTime, aFlightNumber));
  }

  public JSONObject addRegularFlightToAirlineJSON(int context, Time aTime,
    int aFlightNumber) throws JSONException, Exception {
    return ((Airline) registry.getValue(context)).addRegularFlight(aTime,
      aFlightNumber).getAttributes();
  }

  public int addRegularFlightToAirlineOnly(int context, int aRegularFlight)
    throws Exception {
    return registry.getKey(((Airline) registry.getValue(context))
      .addRegularFlight((RegularFlight) registry.getValue(aRegularFlight)));
  }

  public JSONObject addRegularFlightToAirlineOnlyJSON(int context,
    int aRegularFlight) throws JSONException, Exception {
    return ((Airline) registry.getValue(context)).addRegularFlight(
      (RegularFlight) registry.getValue(aRegularFlight)).getAttributes();
  }

  public int addPersonToAirline(int context, String aName, int aIdNumber)
    throws Exception {
    return registry.getKey(((Airline) registry.getValue(context)).addPerson(
      aName, aIdNumber));
  }

  public JSONObject addPersonToAirlineJSON(int context, String aName,
    int aIdNumber) throws JSONException, Exception {
    return ((Airline) registry.getValue(context)).addPerson(aName, aIdNumber)
      .getAttributes();
  }

  public int addPersonToAirlineOnly(int context, int aPerson) throws Exception {
    return registry.getKey(((Airline) registry.getValue(context))
      .addPerson((Person) registry.getValue(aPerson)));
  }

  public JSONObject addPersonToAirlineOnlyJSON(int context, int aPerson)
    throws JSONException, Exception {
    return ((Airline) registry.getValue(context)).addPerson(
      (Person) registry.getValue(aPerson)).getAttributes();
  }

  public void deleteAirline(int context) {
    ((Airline) registry.getValue(context)).delete();
    registry.removeObj(context);
  }

  public void deleteRegularFlightFromAirline(int context, int aRegularFlight) {
    ((Airline) registry.getValue(context))
      .deleteRegularFlight((RegularFlight) registry.getValue(aRegularFlight));
  }

  public void deletePersonFromAirline(int context, int aPerson) {
    ((Airline) registry.getValue(context)).deletePerson((Person) registry
      .getValue(aPerson));
  }

  public JSONObject getAttributesOfAirline(int context) throws JSONException {
    return ((Airline) registry.getValue(context)).getAttributes();
  }

  public int constructPassangerRole(int aPerson, String aName) throws Exception {
    return registry.add(new PassangerRole((Person) registry.getValue(aPerson),
      aName));
  }

  public JSONObject constructPassangerRoleJSON(int aPerson, String aName)
    throws JSONException, Exception {
    PassangerRole contextObj =
      new PassangerRole((Person) registry.getValue(aPerson), aName);
    registry.add(contextObj);
    return contextObj.getAttributes();
  }

  public String getNameFromPassangerRole(int context) {
    return ((PassangerRole) registry.getValue(context)).getName();
  }

  /************
   * Method returns an iterator to the list of id's of the elements involved in this list.
   ***************/
  public Iterator getBookingsFromPassangerRole(int context) {
    ArrayList listOfIDs = new ArrayList();
    for (Booking obj : ((PassangerRole) registry.getValue(context))
      .getBookings()) {
      listOfIDs.add(registry.getKey(obj));
    }
    return listOfIDs.iterator();
  }

  public int addBookingToPassangerRole(int context, String aSeatNumber,
    int aSpecificFlight) throws Exception {
    return registry.getKey(((PassangerRole) registry.getValue(context))
      .addBooking(aSeatNumber, (SpecificFlight) registry
        .getValue(aSpecificFlight)));
  }

  public JSONObject addBookingToPassangerRoleJSON(int context,
    String aSeatNumber, int aSpecificFlight) throws JSONException, Exception {
    return ((PassangerRole) registry.getValue(context)).addBooking(aSeatNumber,
      (SpecificFlight) registry.getValue(aSpecificFlight)).getAttributes();
  }

  public int addBookingToPassangerRoleOnly(int context, int aBooking)
    throws Exception {
    return registry.getKey(((PassangerRole) registry.getValue(context))
      .addBooking((Booking) registry.getValue(aBooking)));
  }

  public JSONObject addBookingToPassangerRoleOnlyJSON(int context, int aBooking)
    throws JSONException, Exception {
    return ((PassangerRole) registry.getValue(context)).addBooking(
      (Booking) registry.getValue(aBooking)).getAttributes();
  }

  public void deletePassangerRole(int context) {
    ((PassangerRole) registry.getValue(context)).delete();
    registry.removeObj(context);
  }

  public void deleteBookingFromPassangerRole(int context, int aBooking) {
    ((PassangerRole) registry.getValue(context))
      .deleteBooking((Booking) registry.getValue(aBooking));
  }

  public JSONObject getAttributesOfPassangerRole(int context)
    throws JSONException {
    return ((PassangerRole) registry.getValue(context)).getAttributes();
  }

  public int constructRegularFlight(Time aTime, int aFlightNumber, int aAirline) {
    return registry.add(new RegularFlight(aTime, aFlightNumber,
      (Airline) registry.getValue(aAirline)));
  }

  public JSONObject constructRegularFlightJSON(Time aTime, int aFlightNumber,
    int aAirline) throws JSONException {
    RegularFlight contextObj =
      new RegularFlight(aTime, aFlightNumber, (Airline) registry
        .getValue(aAirline));
    registry.add(contextObj);
    return contextObj.getAttributes();
  }

  public boolean setTimeInRegularFlight(int context, Time aTime) {
    return ((RegularFlight) registry.getValue(context)).setTime(aTime);
  }

  public boolean setFlightNumberInRegularFlight(int context, int aFlightNumber) {
    return ((RegularFlight) registry.getValue(context))
      .setFlightNumber(aFlightNumber);
  }

  public Time getTimeFromRegularFlight(int context) {
    return ((RegularFlight) registry.getValue(context)).getTime();
  }

  public int getFlightNumberFromRegularFlight(int context) {
    return ((RegularFlight) registry.getValue(context)).getFlightNumber();
  }

  public int getAirlineFromRegularFlight(int context) {
    return registry.getKey(((RegularFlight) registry.getValue(context))
      .getAirline());
  }

  public JSONObject getAirlineFromRegularFlightJSON(int context)
    throws JSONException {
    return ((RegularFlight) registry.getValue(context)).getAirline()
      .getAttributes();
  }

  /************
   * Method returns an iterator to the list of id's of the elements involved in this list.
   ***************/
  public Iterator getSpecificFlightsFromRegularFlight(int context) {
    ArrayList listOfIDs = new ArrayList();
    for (SpecificFlight obj : ((RegularFlight) registry.getValue(context))
      .getSpecificFlights()) {
      listOfIDs.add(registry.getKey(obj));
    }
    return listOfIDs.iterator();
  }

  public int addSpecificFlightToRegularFlight(int context, Date aDate)
    throws Exception {
    return registry.getKey(((RegularFlight) registry.getValue(context))
      .addSpecificFlight(aDate));
  }

  public JSONObject addSpecificFlightToRegularFlightJSON(int context, Date aDate)
    throws JSONException, Exception {
    return ((RegularFlight) registry.getValue(context))
      .addSpecificFlight(aDate).getAttributes();
  }

  public int addSpecificFlightToRegularFlightOnly(int context,
    int aSpecificFlight) throws Exception {
    return registry.getKey(((RegularFlight) registry.getValue(context))
      .addSpecificFlight((SpecificFlight) registry.getValue(aSpecificFlight)));
  }

  public JSONObject addSpecificFlightToRegularFlightOnlyJSON(int context,
    int aSpecificFlight) throws JSONException, Exception {
    return ((RegularFlight) registry.getValue(context)).addSpecificFlight(
      (SpecificFlight) registry.getValue(aSpecificFlight)).getAttributes();
  }

  public void setAirlineInRegularFlight(int context, int aAirline)
    throws Exception {
    ((RegularFlight) registry.getValue(context)).setAirline((Airline) registry
      .getValue(aAirline));
  }

  public void deleteRegularFlight(int context) {
    ((RegularFlight) registry.getValue(context)).delete();
    registry.removeObj(context);
  }

  public void deleteSpecificFlightFromRegularFlight(int context,
    int aSpecificFlight) {
    ((RegularFlight) registry.getValue(context))
      .deleteSpecificFlight((SpecificFlight) registry.getValue(aSpecificFlight));
  }

  public JSONObject getAttributesOfRegularFlight(int context)
    throws JSONException {
    return ((RegularFlight) registry.getValue(context)).getAttributes();
  }

  public int constructPersonRole(int aPerson) throws Exception {
    return registry.add(new PersonRole((Person) registry.getValue(aPerson)));
  }

  public JSONObject constructPersonRoleJSON(int aPerson) throws JSONException,
    Exception {
    PersonRole contextObj = new PersonRole((Person) registry.getValue(aPerson));
    registry.add(contextObj);
    return contextObj.getAttributes();
  }

  public int getPersonFromPersonRole(int context) {
    return registry.getKey(((PersonRole) registry.getValue(context))
      .getPerson());
  }

  public JSONObject getPersonFromPersonRoleJSON(int context)
    throws JSONException {
    return ((PersonRole) registry.getValue(context)).getPerson()
      .getAttributes();
  }

  public void setPersonInPersonRole(int context, int aPerson) throws Exception {
    ((PersonRole) registry.getValue(context)).setPerson((Person) registry
      .getValue(aPerson));
  }

  public void deletePersonRole(int context) {
    ((PersonRole) registry.getValue(context)).delete();
    registry.removeObj(context);
  }

  public JSONObject getAttributesOfPersonRole(int context) throws JSONException {
    return ((PersonRole) registry.getValue(context)).getAttributes();
  }

  public int constructBooking(String aSeatNumber, int aPassangerRole,
    int aSpecificFlight) {
    return registry.add(new Booking(aSeatNumber, (PassangerRole) registry
      .getValue(aPassangerRole), (SpecificFlight) registry
      .getValue(aSpecificFlight)));
  }

  public JSONObject constructBookingJSON(String aSeatNumber,
    int aPassangerRole, int aSpecificFlight) throws JSONException {
    Booking contextObj =
      new Booking(aSeatNumber, (PassangerRole) registry
        .getValue(aPassangerRole), (SpecificFlight) registry
        .getValue(aSpecificFlight));
    registry.add(contextObj);
    return contextObj.getAttributes();
  }

  public boolean setSeatNumberInBooking(int context, String aSeatNumber) {
    return ((Booking) registry.getValue(context)).setSeatNumber(aSeatNumber);
  }

  public String getSeatNumberFromBooking(int context) {
    return ((Booking) registry.getValue(context)).getSeatNumber();
  }

  public int getPassangerRoleFromBooking(int context) {
    return registry.getKey(((Booking) registry.getValue(context))
      .getPassangerRole());
  }

  public JSONObject getPassangerRoleFromBookingJSON(int context)
    throws JSONException {
    return ((Booking) registry.getValue(context)).getPassangerRole()
      .getAttributes();
  }

  public int getSpecificFlightFromBooking(int context) {
    return registry.getKey(((Booking) registry.getValue(context))
      .getSpecificFlight());
  }

  public JSONObject getSpecificFlightFromBookingJSON(int context)
    throws JSONException {
    return ((Booking) registry.getValue(context)).getSpecificFlight()
      .getAttributes();
  }

  public void setPassangerRoleInBooking(int context, int aPassangerRole)
    throws Exception {
    ((Booking) registry.getValue(context))
      .setPassangerRole((PassangerRole) registry.getValue(aPassangerRole));
  }

  public void setSpecificFlightInBooking(int context, int aSpecificFlight)
    throws Exception {
    ((Booking) registry.getValue(context))
      .setSpecificFlight((SpecificFlight) registry.getValue(aSpecificFlight));
  }

  public void deleteBooking(int context) {
    ((Booking) registry.getValue(context)).delete();
    registry.removeObj(context);
  }

  public JSONObject getAttributesOfBooking(int context) throws JSONException {
    return ((Booking) registry.getValue(context)).getAttributes();
  }

  public int constructPerson(String aName, int aIdNumber, int aAirline) {
    return registry.add(new Person(aName, aIdNumber, (Airline) registry
      .getValue(aAirline)));
  }

  public JSONObject constructPersonJSON(String aName, int aIdNumber,
    int aAirline) throws JSONException {
    Person contextObj =
      new Person(aName, aIdNumber, (Airline) registry.getValue(aAirline));
    registry.add(contextObj);
    return contextObj.getAttributes();
  }

  public boolean setNameInPerson(int context, String aName) {
    return ((Person) registry.getValue(context)).setName(aName);
  }

  public boolean setIdNumberInPerson(int context, int aIdNumber) {
    return ((Person) registry.getValue(context)).setIdNumber(aIdNumber);
  }

  public String getNameFromPerson(int context) {
    return ((Person) registry.getValue(context)).getName();
  }

  public int getIdNumberFromPerson(int context) {
    return ((Person) registry.getValue(context)).getIdNumber();
  }

  /************
   * Method returns an iterator to the list of id's of the elements involved in this list.
   ***************/
  public Iterator getPersonRolesFromPerson(int context) {
    ArrayList listOfIDs = new ArrayList();
    for (PersonRole obj : ((Person) registry.getValue(context))
      .getPersonRoles()) {
      listOfIDs.add(registry.getKey(obj));
    }
    return listOfIDs.iterator();
  }

  public int getAirlineFromPerson(int context) {
    return registry.getKey(((Person) registry.getValue(context)).getAirline());
  }

  public JSONObject getAirlineFromPersonJSON(int context) throws JSONException {
    return ((Person) registry.getValue(context)).getAirline().getAttributes();
  }

  public int addPersonRoleToPerson(int context) throws Exception {
    return registry.getKey(((Person) registry.getValue(context))
      .addPersonRole());
  }

  public JSONObject addPersonRoleToPersonJSON(int context)
    throws JSONException, Exception {
    return ((Person) registry.getValue(context)).addPersonRole()
      .getAttributes();
  }

  public int addPersonRoleToPersonOnly(int context, int aPersonRole)
    throws Exception {
    return registry.getKey(((Person) registry.getValue(context))
      .addPersonRole((PersonRole) registry.getValue(aPersonRole)));
  }

  public JSONObject addPersonRoleToPersonOnlyJSON(int context, int aPersonRole)
    throws JSONException, Exception {
    return ((Person) registry.getValue(context)).addPersonRole(
      (PersonRole) registry.getValue(aPersonRole)).getAttributes();
  }

  public void setAirlineInPerson(int context, int aAirline) throws Exception {
    ((Person) registry.getValue(context)).setAirline((Airline) registry
      .getValue(aAirline));
  }

  public void deletePerson(int context) {
    ((Person) registry.getValue(context)).delete();
    registry.removeObj(context);
  }

  public void deletePersonRoleFromPerson(int context, int aPersonRole) {
    ((Person) registry.getValue(context))
      .deletePersonRole((PersonRole) registry.getValue(aPersonRole));
  }

  public JSONObject getAttributesOfPerson(int context) throws JSONException {
    return ((Person) registry.getValue(context)).getAttributes();
  }

  public int constructEmployeeRole(int aPerson, String aJobFunction,
    int aSupervisor) throws Exception {
    return registry.add(new EmployeeRole((Person) registry.getValue(aPerson),
      aJobFunction, (EmployeeRole) registry.getValue(aSupervisor)));
  }

  public JSONObject constructEmployeeRoleJSON(int aPerson, String aJobFunction,
    int aSupervisor) throws JSONException, Exception {
    EmployeeRole contextObj =
      new EmployeeRole((Person) registry.getValue(aPerson), aJobFunction,
        (EmployeeRole) registry.getValue(aSupervisor));
    registry.add(contextObj);
    return contextObj.getAttributes();
  }

  public boolean setJobFunctionInEmployeeRole(int context, String aJobFunction) {
    return ((EmployeeRole) registry.getValue(context))
      .setJobFunction(aJobFunction);
  }

  public String getJobFunctionFromEmployeeRole(int context) {
    return ((EmployeeRole) registry.getValue(context)).getJobFunction();
  }

  public int getSupervisorFromEmployeeRole(int context) {
    return registry.getKey(((EmployeeRole) registry.getValue(context))
      .getSupervisor());
  }

  public JSONObject getSupervisorFromEmployeeRoleJSON(int context)
    throws JSONException {
    return ((EmployeeRole) registry.getValue(context)).getSupervisor()
      .getAttributes();
  }

  /************
   * Method returns an iterator to the list of id's of the elements involved in this list.
   ***************/
  public Iterator getEmployeeRolesFromEmployeeRole(int context) {
    ArrayList listOfIDs = new ArrayList();
    for (EmployeeRole obj : ((EmployeeRole) registry.getValue(context))
      .getEmployeeRoles()) {
      listOfIDs.add(registry.getKey(obj));
    }
    return listOfIDs.iterator();
  }

  /************
   * Method returns an iterator to the list of id's of the elements involved in this list.
   ***************/
  public Iterator getSpecificFlightsFromEmployeeRole(int context) {
    ArrayList listOfIDs = new ArrayList();
    for (SpecificFlight obj : ((EmployeeRole) registry.getValue(context))
      .getSpecificFlights()) {
      listOfIDs.add(registry.getKey(obj));
    }
    return listOfIDs.iterator();
  }

  public int addEmployeeRoleToEmployeeRole(int context, int aPerson,
    String aJobFunction) throws Exception {
    return registry.getKey(((EmployeeRole) registry.getValue(context))
      .addEmployeeRole((Person) registry.getValue(aPerson), aJobFunction));
  }

  public JSONObject addEmployeeRoleToEmployeeRoleJSON(int context, int aPerson,
    String aJobFunction) throws JSONException, Exception {
    return ((EmployeeRole) registry.getValue(context)).addEmployeeRole(
      (Person) registry.getValue(aPerson), aJobFunction).getAttributes();
  }

  public int addEmployeeRoleToEmployeeRoleOnly(int context, int aEmployeeRole)
    throws Exception {
    return registry.getKey(((EmployeeRole) registry.getValue(context))
      .addEmployeeRole((EmployeeRole) registry.getValue(aEmployeeRole)));
  }

  public JSONObject addEmployeeRoleToEmployeeRoleOnlyJSON(int context,
    int aEmployeeRole) throws JSONException, Exception {
    return ((EmployeeRole) registry.getValue(context)).addEmployeeRole(
      (EmployeeRole) registry.getValue(aEmployeeRole)).getAttributes();
  }

  public int addSpecificFlightToEmployeeRole(int context, Date aDate,
    int aRegularFlight) throws Exception {
    return registry.getKey(((EmployeeRole) registry.getValue(context))
      .addSpecificFlight(aDate, (RegularFlight) registry
        .getValue(aRegularFlight)));
  }

  public JSONObject addSpecificFlightToEmployeeRoleJSON(int context,
    Date aDate, int aRegularFlight) throws JSONException, Exception {
    return ((EmployeeRole) registry.getValue(context)).addSpecificFlight(aDate,
      (RegularFlight) registry.getValue(aRegularFlight)).getAttributes();
  }

  public int addSpecificFlightToEmployeeRoleOnly(int context,
    int aSpecificFlight) throws Exception {
    return registry.getKey(((EmployeeRole) registry.getValue(context))
      .addSpecificFlight((SpecificFlight) registry.getValue(aSpecificFlight)));
  }

  public JSONObject addSpecificFlightToEmployeeRoleOnlyJSON(int context,
    int aSpecificFlight) throws JSONException, Exception {
    return ((EmployeeRole) registry.getValue(context)).addSpecificFlight(
      (SpecificFlight) registry.getValue(aSpecificFlight)).getAttributes();
  }

  public void setSupervisorInEmployeeRole(int context, int aSupervisor)
    throws Exception {
    ((EmployeeRole) registry.getValue(context))
      .setSupervisor((EmployeeRole) registry.getValue(aSupervisor));
  }

  public void deleteEmployeeRole(int context) {
    ((EmployeeRole) registry.getValue(context)).delete();
    registry.removeObj(context);
  }

  public void deleteEmployeeRoleFromEmployeeRole(int context, int aEmployeeRole) {
    ((EmployeeRole) registry.getValue(context))
      .deleteEmployeeRole((EmployeeRole) registry.getValue(aEmployeeRole));
  }

  public void deleteSpecificFlightFromEmployeeRole(int context,
    int aSpecificFlight) {
    ((EmployeeRole) registry.getValue(context))
      .deleteSpecificFlight((SpecificFlight) registry.getValue(aSpecificFlight));
  }

  public JSONObject getAttributesOfEmployeeRole(int context)
    throws JSONException {
    return ((EmployeeRole) registry.getValue(context)).getAttributes();
  }

  public int constructSpecificFlight(Date aDate, int aRegularFlight) {
    return registry.add(new SpecificFlight(aDate, (RegularFlight) registry
      .getValue(aRegularFlight)));
  }

  public JSONObject constructSpecificFlightJSON(Date aDate, int aRegularFlight)
    throws JSONException {
    SpecificFlight contextObj =
      new SpecificFlight(aDate, (RegularFlight) registry
        .getValue(aRegularFlight));
    registry.add(contextObj);
    return contextObj.getAttributes();
  }

  public boolean setDateInSpecificFlight(int context, Date aDate) {
    return ((SpecificFlight) registry.getValue(context)).setDate(aDate);
  }

  public Date getDateFromSpecificFlight(int context) {
    return ((SpecificFlight) registry.getValue(context)).getDate();
  }

  public int getRegularFlightFromSpecificFlight(int context) {
    return registry.getKey(((SpecificFlight) registry.getValue(context))
      .getRegularFlight());
  }

  public JSONObject getRegularFlightFromSpecificFlightJSON(int context)
    throws JSONException {
    return ((SpecificFlight) registry.getValue(context)).getRegularFlight()
      .getAttributes();
  }

  /************
   * Method returns an iterator to the list of id's of the elements involved in this list.
   ***************/
  public Iterator getEmployeeRolesFromSpecificFlight(int context) {
    ArrayList listOfIDs = new ArrayList();
    for (EmployeeRole obj : ((SpecificFlight) registry.getValue(context))
      .getEmployeeRoles()) {
      listOfIDs.add(registry.getKey(obj));
    }
    return listOfIDs.iterator();
  }

  /************
   * Method returns an iterator to the list of id's of the elements involved in this list.
   ***************/
  public Iterator getBookingsFromSpecificFlight(int context) {
    ArrayList listOfIDs = new ArrayList();
    for (Booking obj : ((SpecificFlight) registry.getValue(context))
      .getBookings()) {
      listOfIDs.add(registry.getKey(obj));
    }
    return listOfIDs.iterator();
  }

  public int addEmployeeRoleToSpecificFlight(int context, int aPerson,
    String aJobFunction, int aSupervisor) throws Exception {
    return registry.getKey(((SpecificFlight) registry.getValue(context))
      .addEmployeeRole((Person) registry.getValue(aPerson), aJobFunction,
        (EmployeeRole) registry.getValue(aSupervisor)));
  }

  public JSONObject addEmployeeRoleToSpecificFlightJSON(int context,
    int aPerson, String aJobFunction, int aSupervisor) throws JSONException,
    Exception {
    return ((SpecificFlight) registry.getValue(context)).addEmployeeRole(
      (Person) registry.getValue(aPerson), aJobFunction,
      (EmployeeRole) registry.getValue(aSupervisor)).getAttributes();
  }

  public int addEmployeeRoleToSpecificFlightOnly(int context, int aEmployeeRole)
    throws Exception {
    return registry.getKey(((SpecificFlight) registry.getValue(context))
      .addEmployeeRole((EmployeeRole) registry.getValue(aEmployeeRole)));
  }

  public JSONObject addEmployeeRoleToSpecificFlightOnlyJSON(int context,
    int aEmployeeRole) throws JSONException, Exception {
    return ((SpecificFlight) registry.getValue(context)).addEmployeeRole(
      (EmployeeRole) registry.getValue(aEmployeeRole)).getAttributes();
  }

  public int addBookingToSpecificFlight(int context, String aSeatNumber,
    int aPassangerRole) throws Exception {
    return registry.getKey(((SpecificFlight) registry.getValue(context))
      .addBooking(aSeatNumber, (PassangerRole) registry
        .getValue(aPassangerRole)));
  }

  public JSONObject addBookingToSpecificFlightJSON(int context,
    String aSeatNumber, int aPassangerRole) throws JSONException, Exception {
    return ((SpecificFlight) registry.getValue(context)).addBooking(
      aSeatNumber, (PassangerRole) registry.getValue(aPassangerRole))
      .getAttributes();
  }

  public int addBookingToSpecificFlightOnly(int context, int aBooking)
    throws Exception {
    return registry.getKey(((SpecificFlight) registry.getValue(context))
      .addBooking((Booking) registry.getValue(aBooking)));
  }

  public JSONObject addBookingToSpecificFlightOnlyJSON(int context, int aBooking)
    throws JSONException, Exception {
    return ((SpecificFlight) registry.getValue(context)).addBooking(
      (Booking) registry.getValue(aBooking)).getAttributes();
  }

  public void setRegularFlightInSpecificFlight(int context, int aRegularFlight)
    throws Exception {
    ((SpecificFlight) registry.getValue(context))
      .setRegularFlight((RegularFlight) registry.getValue(aRegularFlight));
  }

  public void deleteSpecificFlight(int context) {
    ((SpecificFlight) registry.getValue(context)).delete();
    registry.removeObj(context);
  }

  public void deleteEmployeeRoleFromSpecificFlight(int context,
    int aEmployeeRole) {
    ((SpecificFlight) registry.getValue(context))
      .deleteEmployeeRole((EmployeeRole) registry.getValue(aEmployeeRole));
  }

  public void deleteBookingFromSpecificFlight(int context, int aBooking) {
    ((SpecificFlight) registry.getValue(context))
      .deleteBooking((Booking) registry.getValue(aBooking));
  }

  public JSONObject getAttributesOfSpecificFlight(int context)
    throws JSONException {
    return ((SpecificFlight) registry.getValue(context)).getAttributes();
  }
}