/*This code was generated using the UMPLE modeling language!*/

package telesystem;

import java.sql.Time;
import java.sql.Date;
import java.util.ArrayList;
import java.util.Iterator;
import telesystem.json.*;
import telesystem.core.*;

public class TelesystemFacade {
  // Singleton instance.
  private static TelesystemFacade theInstance;

  //System registry.
  TelesystemRegistry registry = TelesystemRegistry.getInstance();

  /**
   * Dummy constructor
   */
  private TelesystemFacade() {
  }

  /**
   * Returns the only instance of the Facade.
   * 
   * @return
   */
  public static TelesystemFacade getInstance() {
    if (theInstance == null)
      theInstance = new TelesystemFacade();
    return theInstance;
  }

  public int constructTelephone(String aModel, int aPhoneLine) {
    return registry.add(new Telephone(aModel, (PhoneLine) registry
      .getValue(aPhoneLine)));
  }

  public JSONObject constructTelephoneJSON(String aModel, int aPhoneLine)
    throws JSONException {
    Telephone contextObj =
      new Telephone(aModel, (PhoneLine) registry.getValue(aPhoneLine));
    registry.add(contextObj);
    return contextObj.getAttributes();
  }

  public boolean setModelInTelephone(int context, String aModel) {
    return ((Telephone) registry.getValue(context)).setModel(aModel);
  }

  public String getModelFromTelephone(int context) {
    return ((Telephone) registry.getValue(context)).getModel();
  }

  public int getPhoneLineFromTelephone(int context) {
    return registry.getKey(((Telephone) registry.getValue(context))
      .getPhoneLine());
  }

  public JSONObject getPhoneLineFromTelephoneJSON(int context)
    throws JSONException {
    return ((Telephone) registry.getValue(context)).getPhoneLine()
      .getAttributes();
  }

  public void setPhoneLineInTelephone(int context, int aPhoneLine)
    throws Exception {
    ((Telephone) registry.getValue(context)).setPhoneLine((PhoneLine) registry
      .getValue(aPhoneLine));
  }

  public void deleteTelephone(int context) {
    ((Telephone) registry.getValue(context)).delete();
    registry.removeObj(context);
  }

  public JSONObject getAttributesOfTelephone(int context) throws JSONException {
    return ((Telephone) registry.getValue(context)).getAttributes();
  }

  public int constructPhoneLine(String aLocation, String aDigOrAnalog) {
    return registry.add(new PhoneLine(aLocation, aDigOrAnalog));
  }

  public JSONObject constructPhoneLineJSON(String aLocation, String aDigOrAnalog)
    throws JSONException {
    PhoneLine contextObj = new PhoneLine(aLocation, aDigOrAnalog);
    registry.add(contextObj);
    return contextObj.getAttributes();
  }

  public boolean setLocationInPhoneLine(int context, String aLocation) {
    return ((PhoneLine) registry.getValue(context)).setLocation(aLocation);
  }

  public boolean setDigOrAnalogInPhoneLine(int context, String aDigOrAnalog) {
    return ((PhoneLine) registry.getValue(context))
      .setDigOrAnalog(aDigOrAnalog);
  }

  public String getLocationFromPhoneLine(int context) {
    return ((PhoneLine) registry.getValue(context)).getLocation();
  }

  public String getDigOrAnalogFromPhoneLine(int context) {
    return ((PhoneLine) registry.getValue(context)).getDigOrAnalog();
  }

  /************
   * Method returns an iterator to the list of id's of the elements involved in this list.
   ***************/
  public Iterator getTelephoneNumbersFromPhoneLine(int context) {
    ArrayList listOfIDs = new ArrayList();
    for (TelephoneNumber obj : ((PhoneLine) registry.getValue(context))
      .getTelephoneNumbers()) {
      listOfIDs.add(registry.getKey(obj));
    }
    return listOfIDs.iterator();
  }

  public int getTelephoneFromPhoneLine(int context) {
    return registry.getKey(((PhoneLine) registry.getValue(context))
      .getTelephone());
  }

  public JSONObject getTelephoneFromPhoneLineJSON(int context)
    throws JSONException {
    return ((PhoneLine) registry.getValue(context)).getTelephone()
      .getAttributes();
  }

  public int addTelephoneNumberToPhoneLine(int context, String aDigits,
    int aVoiceMailBox) throws Exception {
    return registry.getKey(((PhoneLine) registry.getValue(context))
      .addTelephoneNumber(aDigits, (VoiceMailBox) registry
        .getValue(aVoiceMailBox)));
  }

  public JSONObject addTelephoneNumberToPhoneLineJSON(int context,
    String aDigits, int aVoiceMailBox) throws JSONException, Exception {
    return ((PhoneLine) registry.getValue(context)).addTelephoneNumber(aDigits,
      (VoiceMailBox) registry.getValue(aVoiceMailBox)).getAttributes();
  }

  public int addTelephoneNumberToPhoneLineOnly(int context, int aTelephoneNumber)
    throws Exception {
    return registry
      .getKey(((PhoneLine) registry.getValue(context))
        .addTelephoneNumber((TelephoneNumber) registry
          .getValue(aTelephoneNumber)));
  }

  public JSONObject addTelephoneNumberToPhoneLineOnlyJSON(int context,
    int aTelephoneNumber) throws JSONException, Exception {
    return ((PhoneLine) registry.getValue(context)).addTelephoneNumber(
      (TelephoneNumber) registry.getValue(aTelephoneNumber)).getAttributes();
  }

  public void setTelephoneInPhoneLine(int context, int aTelephone)
    throws Exception {
    ((PhoneLine) registry.getValue(context)).setTelephone((Telephone) registry
      .getValue(aTelephone));
  }

  public void deletePhoneLine(int context) {
    ((PhoneLine) registry.getValue(context)).delete();
    registry.removeObj(context);
  }

  public void deleteTelephoneNumberFromPhoneLine(int context,
    int aTelephoneNumber) {
    ((PhoneLine) registry.getValue(context))
      .deleteTelephoneNumber((TelephoneNumber) registry
        .getValue(aTelephoneNumber));
  }

  public void deleteTelephoneFromPhoneLine(int context, int aTelephone) {
    ((PhoneLine) registry.getValue(context))
      .deleteTelephone((Telephone) registry.getValue(aTelephone));
  }

  public JSONObject getAttributesOfPhoneLine(int context) throws JSONException {
    return ((PhoneLine) registry.getValue(context)).getAttributes();
  }

  public int constructTelephoneNumber(String aDigits, int aVoiceMailBox) {
    return registry.add(new TelephoneNumber(aDigits, (VoiceMailBox) registry
      .getValue(aVoiceMailBox)));
  }

  public JSONObject constructTelephoneNumberJSON(String aDigits,
    int aVoiceMailBox) throws JSONException {
    TelephoneNumber contextObj =
      new TelephoneNumber(aDigits, (VoiceMailBox) registry
        .getValue(aVoiceMailBox));
    registry.add(contextObj);
    return contextObj.getAttributes();
  }

  public boolean setDigitsInTelephoneNumber(int context, String aDigits) {
    return ((TelephoneNumber) registry.getValue(context)).setDigits(aDigits);
  }

  public String getDigitsFromTelephoneNumber(int context) {
    return ((TelephoneNumber) registry.getValue(context)).getDigits();
  }

  /************
   * Method returns an iterator to the list of id's of the elements involved in this list.
   ***************/
  public Iterator getBelongsTosFromTelephoneNumber(int context) {
    ArrayList listOfIDs = new ArrayList();
    for (PhoneCall obj : ((TelephoneNumber) registry.getValue(context))
      .getBelongsTos()) {
      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 getInvolvedInsFromTelephoneNumber(int context) {
    ArrayList listOfIDs = new ArrayList();
    for (PhoneCall obj : ((TelephoneNumber) registry.getValue(context))
      .getInvolvedIns()) {
      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 getComponentNumbersFromTelephoneNumber(int context) {
    ArrayList listOfIDs = new ArrayList();
    for (TelephoneNumber obj : ((TelephoneNumber) registry.getValue(context))
      .getComponentNumbers()) {
      listOfIDs.add(registry.getKey(obj));
    }
    return listOfIDs.iterator();
  }

  public int getTelephoneNumberFromTelephoneNumber(int context) {
    return registry.getKey(((TelephoneNumber) registry.getValue(context))
      .getTelephoneNumber());
  }

  public JSONObject getTelephoneNumberFromTelephoneNumberJSON(int context)
    throws JSONException {
    return ((TelephoneNumber) registry.getValue(context)).getTelephoneNumber()
      .getAttributes();
  }

  public int getVoiceMailBoxFromTelephoneNumber(int context) {
    return registry.getKey(((TelephoneNumber) registry.getValue(context))
      .getVoiceMailBox());
  }

  public JSONObject getVoiceMailBoxFromTelephoneNumberJSON(int context)
    throws JSONException {
    return ((TelephoneNumber) registry.getValue(context)).getVoiceMailBox()
      .getAttributes();
  }

  /************
   * Method returns an iterator to the list of id's of the elements involved in this list.
   ***************/
  public Iterator getFeaturesFromTelephoneNumber(int context) {
    ArrayList listOfIDs = new ArrayList();
    for (Feature obj : ((TelephoneNumber) registry.getValue(context))
      .getFeatures()) {
      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 getPhoneLinesFromTelephoneNumber(int context) {
    ArrayList listOfIDs = new ArrayList();
    for (PhoneLine obj : ((TelephoneNumber) registry.getValue(context))
      .getPhoneLines()) {
      listOfIDs.add(registry.getKey(obj));
    }
    return listOfIDs.iterator();
  }

  public int addBelongsToToTelephoneNumber(int context, String aIsOnHold,
    String aStartTime, String aDuration, int aOriginator) throws Exception {
    return registry.getKey(((TelephoneNumber) registry.getValue(context))
      .addBelongsTo(aIsOnHold, aStartTime, aDuration,
        (TelephoneNumber) registry.getValue(aOriginator)));
  }

  public JSONObject addBelongsToToTelephoneNumberJSON(int context,
    String aIsOnHold, String aStartTime, String aDuration, int aOriginator)
    throws JSONException, Exception {
    return ((TelephoneNumber) registry.getValue(context)).addBelongsTo(
      aIsOnHold, aStartTime, aDuration,
      (TelephoneNumber) registry.getValue(aOriginator)).getAttributes();
  }

  public int addBelongsToToTelephoneNumberOnly(int context, int aBelongsTo)
    throws Exception {
    return registry.getKey(((TelephoneNumber) registry.getValue(context))
      .addBelongsTo((PhoneCall) registry.getValue(aBelongsTo)));
  }

  public JSONObject addBelongsToToTelephoneNumberOnlyJSON(int context,
    int aBelongsTo) throws JSONException, Exception {
    return ((TelephoneNumber) registry.getValue(context)).addBelongsTo(
      (PhoneCall) registry.getValue(aBelongsTo)).getAttributes();
  }

  public int addInvolvedInToTelephoneNumber(int context, String aIsOnHold,
    String aStartTime, String aDuration, int aOriginator) throws Exception {
    return registry.getKey(((TelephoneNumber) registry.getValue(context))
      .addInvolvedIn(aIsOnHold, aStartTime, aDuration,
        (TelephoneNumber) registry.getValue(aOriginator)));
  }

  public JSONObject addInvolvedInToTelephoneNumberJSON(int context,
    String aIsOnHold, String aStartTime, String aDuration, int aOriginator)
    throws JSONException, Exception {
    return ((TelephoneNumber) registry.getValue(context)).addInvolvedIn(
      aIsOnHold, aStartTime, aDuration,
      (TelephoneNumber) registry.getValue(aOriginator)).getAttributes();
  }

  public int addInvolvedInToTelephoneNumberOnly(int context, int aInvolvedIn)
    throws Exception {
    return registry.getKey(((TelephoneNumber) registry.getValue(context))
      .addInvolvedIn((PhoneCall) registry.getValue(aInvolvedIn)));
  }

  public JSONObject addInvolvedInToTelephoneNumberOnlyJSON(int context,
    int aInvolvedIn) throws JSONException, Exception {
    return ((TelephoneNumber) registry.getValue(context)).addInvolvedIn(
      (PhoneCall) registry.getValue(aInvolvedIn)).getAttributes();
  }

  public int addComponentNumberToTelephoneNumber(int context, String aDigits,
    int aVoiceMailBox) throws Exception {
    return registry.getKey(((TelephoneNumber) registry.getValue(context))
      .addComponentNumber(aDigits, (VoiceMailBox) registry
        .getValue(aVoiceMailBox)));
  }

  public JSONObject addComponentNumberToTelephoneNumberJSON(int context,
    String aDigits, int aVoiceMailBox) throws JSONException, Exception {
    return ((TelephoneNumber) registry.getValue(context)).addComponentNumber(
      aDigits, (VoiceMailBox) registry.getValue(aVoiceMailBox)).getAttributes();
  }

  public int addComponentNumberToTelephoneNumberOnly(int context,
    int aComponentNumber) throws Exception {
    return registry
      .getKey(((TelephoneNumber) registry.getValue(context))
        .addComponentNumber((TelephoneNumber) registry
          .getValue(aComponentNumber)));
  }

  public JSONObject addComponentNumberToTelephoneNumberOnlyJSON(int context,
    int aComponentNumber) throws JSONException, Exception {
    return ((TelephoneNumber) registry.getValue(context)).addComponentNumber(
      (TelephoneNumber) registry.getValue(aComponentNumber)).getAttributes();
  }

  public int addFeatureToTelephoneNumber(int context, String aDescription)
    throws Exception {
    return registry.getKey(((TelephoneNumber) registry.getValue(context))
      .addFeature(aDescription));
  }

  public JSONObject addFeatureToTelephoneNumberJSON(int context,
    String aDescription) throws JSONException, Exception {
    return ((TelephoneNumber) registry.getValue(context)).addFeature(
      aDescription).getAttributes();
  }

  public int addFeatureToTelephoneNumberOnly(int context, int aFeature)
    throws Exception {
    return registry.getKey(((TelephoneNumber) registry.getValue(context))
      .addFeature((Feature) registry.getValue(aFeature)));
  }

  public JSONObject addFeatureToTelephoneNumberOnlyJSON(int context,
    int aFeature) throws JSONException, Exception {
    return ((TelephoneNumber) registry.getValue(context)).addFeature(
      (Feature) registry.getValue(aFeature)).getAttributes();
  }

  public int addPhoneLineToTelephoneNumber(int context, String aLocation,
    String aDigOrAnalog) throws Exception {
    return registry.getKey(((TelephoneNumber) registry.getValue(context))
      .addPhoneLine(aLocation, aDigOrAnalog));
  }

  public JSONObject addPhoneLineToTelephoneNumberJSON(int context,
    String aLocation, String aDigOrAnalog) throws JSONException, Exception {
    return ((TelephoneNumber) registry.getValue(context)).addPhoneLine(
      aLocation, aDigOrAnalog).getAttributes();
  }

  public int addPhoneLineToTelephoneNumberOnly(int context, int aPhoneLine)
    throws Exception {
    return registry.getKey(((TelephoneNumber) registry.getValue(context))
      .addPhoneLine((PhoneLine) registry.getValue(aPhoneLine)));
  }

  public JSONObject addPhoneLineToTelephoneNumberOnlyJSON(int context,
    int aPhoneLine) throws JSONException, Exception {
    return ((TelephoneNumber) registry.getValue(context)).addPhoneLine(
      (PhoneLine) registry.getValue(aPhoneLine)).getAttributes();
  }

  public void setTelephoneNumberInTelephoneNumber(int context,
    int aTelephoneNumber) throws Exception {
    ((TelephoneNumber) registry.getValue(context))
      .setTelephoneNumber((TelephoneNumber) registry.getValue(aTelephoneNumber));
  }

  public void setVoiceMailBoxInTelephoneNumber(int context, int aVoiceMailBox)
    throws Exception {
    ((TelephoneNumber) registry.getValue(context))
      .setVoiceMailBox((VoiceMailBox) registry.getValue(aVoiceMailBox));
  }

  public void deleteTelephoneNumber(int context) {
    ((TelephoneNumber) registry.getValue(context)).delete();
    registry.removeObj(context);
  }

  public void deleteBelongsToFromTelephoneNumber(int context, int aPhoneCall) {
    ((TelephoneNumber) registry.getValue(context))
      .deleteBelongsTo((PhoneCall) registry.getValue(aPhoneCall));
  }

  public void deleteInvolvedInFromTelephoneNumber(int context, int aPhoneCall) {
    ((TelephoneNumber) registry.getValue(context))
      .deleteInvolvedIn((PhoneCall) registry.getValue(aPhoneCall));
  }

  public void deleteComponentNumberFromTelephoneNumber(int context,
    int aTelephoneNumber) {
    ((TelephoneNumber) registry.getValue(context))
      .deleteComponentNumber((TelephoneNumber) registry
        .getValue(aTelephoneNumber));
  }

  public void deleteTelephoneNumberFromTelephoneNumber(int context,
    int aTelephoneNumber) {
    ((TelephoneNumber) registry.getValue(context))
      .deleteTelephoneNumber((TelephoneNumber) registry
        .getValue(aTelephoneNumber));
  }

  public void deleteFeatureFromTelephoneNumber(int context, int aFeature) {
    ((TelephoneNumber) registry.getValue(context))
      .deleteFeature((Feature) registry.getValue(aFeature));
  }

  public void deletePhoneLineFromTelephoneNumber(int context, int aPhoneLine) {
    ((TelephoneNumber) registry.getValue(context))
      .deletePhoneLine((PhoneLine) registry.getValue(aPhoneLine));
  }

  public JSONObject getAttributesOfTelephoneNumber(int context)
    throws JSONException {
    return ((TelephoneNumber) registry.getValue(context)).getAttributes();
  }

  public int constructVoiceMailMessage(String aDigitizedSound, int aVoiceMailBox) {
    return registry.add(new VoiceMailMessage(aDigitizedSound,
      (VoiceMailBox) registry.getValue(aVoiceMailBox)));
  }

  public JSONObject constructVoiceMailMessageJSON(String aDigitizedSound,
    int aVoiceMailBox) throws JSONException {
    VoiceMailMessage contextObj =
      new VoiceMailMessage(aDigitizedSound, (VoiceMailBox) registry
        .getValue(aVoiceMailBox));
    registry.add(contextObj);
    return contextObj.getAttributes();
  }

  public boolean setDigitizedSoundInVoiceMailMessage(int context,
    String aDigitizedSound) {
    return ((VoiceMailMessage) registry.getValue(context))
      .setDigitizedSound(aDigitizedSound);
  }

  public String getDigitizedSoundFromVoiceMailMessage(int context) {
    return ((VoiceMailMessage) registry.getValue(context)).getDigitizedSound();
  }

  public int getVoiceMailBoxFromVoiceMailMessage(int context) {
    return registry.getKey(((VoiceMailMessage) registry.getValue(context))
      .getVoiceMailBox());
  }

  public JSONObject getVoiceMailBoxFromVoiceMailMessageJSON(int context)
    throws JSONException {
    return ((VoiceMailMessage) registry.getValue(context)).getVoiceMailBox()
      .getAttributes();
  }

  public void setVoiceMailBoxInVoiceMailMessage(int context, int aVoiceMailBox)
    throws Exception {
    ((VoiceMailMessage) registry.getValue(context))
      .setVoiceMailBox((VoiceMailBox) registry.getValue(aVoiceMailBox));
  }

  public void deleteVoiceMailMessage(int context) {
    ((VoiceMailMessage) registry.getValue(context)).delete();
    registry.removeObj(context);
  }

  public JSONObject getAttributesOfVoiceMailMessage(int context)
    throws JSONException {
    return ((VoiceMailMessage) registry.getValue(context)).getAttributes();
  }

  public int constructPhoneCall(String aIsOnHold, String aStartTime,
    String aDuration, int aOriginator) {
    return registry.add(new PhoneCall(aIsOnHold, aStartTime, aDuration,
      (TelephoneNumber) registry.getValue(aOriginator)));
  }

  public JSONObject constructPhoneCallJSON(String aIsOnHold, String aStartTime,
    String aDuration, int aOriginator) throws JSONException {
    PhoneCall contextObj =
      new PhoneCall(aIsOnHold, aStartTime, aDuration,
        (TelephoneNumber) registry.getValue(aOriginator));
    registry.add(contextObj);
    return contextObj.getAttributes();
  }

  public boolean setIsOnHoldInPhoneCall(int context, String aIsOnHold) {
    return ((PhoneCall) registry.getValue(context)).setIsOnHold(aIsOnHold);
  }

  public boolean setStartTimeInPhoneCall(int context, String aStartTime) {
    return ((PhoneCall) registry.getValue(context)).setStartTime(aStartTime);
  }

  public boolean setDurationInPhoneCall(int context, String aDuration) {
    return ((PhoneCall) registry.getValue(context)).setDuration(aDuration);
  }

  public String getIsOnHoldFromPhoneCall(int context) {
    return ((PhoneCall) registry.getValue(context)).getIsOnHold();
  }

  public String getStartTimeFromPhoneCall(int context) {
    return ((PhoneCall) registry.getValue(context)).getStartTime();
  }

  public String getDurationFromPhoneCall(int context) {
    return ((PhoneCall) registry.getValue(context)).getDuration();
  }

  public int getOriginatorFromPhoneCall(int context) {
    return registry.getKey(((PhoneCall) registry.getValue(context))
      .getOriginator());
  }

  public JSONObject getOriginatorFromPhoneCallJSON(int context)
    throws JSONException {
    return ((PhoneCall) registry.getValue(context)).getOriginator()
      .getAttributes();
  }

  /************
   * Method returns an iterator to the list of id's of the elements involved in this list.
   ***************/
  public Iterator getPartiessFromPhoneCall(int context) {
    ArrayList listOfIDs = new ArrayList();
    for (TelephoneNumber obj : ((PhoneCall) registry.getValue(context))
      .getPartiess()) {
      listOfIDs.add(registry.getKey(obj));
    }
    return listOfIDs.iterator();
  }

  public int addPartiesToPhoneCall(int context, String aDigits,
    int aVoiceMailBox) throws Exception {
    return registry.getKey(((PhoneCall) registry.getValue(context)).addParties(
      aDigits, (VoiceMailBox) registry.getValue(aVoiceMailBox)));
  }

  public JSONObject addPartiesToPhoneCallJSON(int context, String aDigits,
    int aVoiceMailBox) throws JSONException, Exception {
    return ((PhoneCall) registry.getValue(context)).addParties(aDigits,
      (VoiceMailBox) registry.getValue(aVoiceMailBox)).getAttributes();
  }

  public int addPartiesToPhoneCallOnly(int context, int aParties)
    throws Exception {
    return registry.getKey(((PhoneCall) registry.getValue(context))
      .addParties((TelephoneNumber) registry.getValue(aParties)));
  }

  public JSONObject addPartiesToPhoneCallOnlyJSON(int context, int aParties)
    throws JSONException, Exception {
    return ((PhoneCall) registry.getValue(context)).addParties(
      (TelephoneNumber) registry.getValue(aParties)).getAttributes();
  }

  public void setOriginatorInPhoneCall(int context, int aOriginator)
    throws Exception {
    ((PhoneCall) registry.getValue(context))
      .setOriginator((TelephoneNumber) registry.getValue(aOriginator));
  }

  public void deletePhoneCall(int context) {
    ((PhoneCall) registry.getValue(context)).delete();
    registry.removeObj(context);
  }

  public void deletePartiesFromPhoneCall(int context, int aTelephoneNumber) {
    ((PhoneCall) registry.getValue(context))
      .deleteParties((TelephoneNumber) registry.getValue(aTelephoneNumber));
  }

  public JSONObject getAttributesOfPhoneCall(int context) throws JSONException {
    return ((PhoneCall) registry.getValue(context)).getAttributes();
  }

  public int constructFeature(String aDescription) {
    return registry.add(new Feature(aDescription));
  }

  public JSONObject constructFeatureJSON(String aDescription)
    throws JSONException {
    Feature contextObj = new Feature(aDescription);
    registry.add(contextObj);
    return contextObj.getAttributes();
  }

  public boolean setDescriptionInFeature(int context, String aDescription) {
    return ((Feature) registry.getValue(context)).setDescription(aDescription);
  }

  public String getDescriptionFromFeature(int context) {
    return ((Feature) registry.getValue(context)).getDescription();
  }

  /************
   * Method returns an iterator to the list of id's of the elements involved in this list.
   ***************/
  public Iterator getTelephoneNumbersFromFeature(int context) {
    ArrayList listOfIDs = new ArrayList();
    for (TelephoneNumber obj : ((Feature) registry.getValue(context))
      .getTelephoneNumbers()) {
      listOfIDs.add(registry.getKey(obj));
    }
    return listOfIDs.iterator();
  }

  public int addTelephoneNumberToFeature(int context, String aDigits,
    int aVoiceMailBox) throws Exception {
    return registry.getKey(((Feature) registry.getValue(context))
      .addTelephoneNumber(aDigits, (VoiceMailBox) registry
        .getValue(aVoiceMailBox)));
  }

  public JSONObject addTelephoneNumberToFeatureJSON(int context,
    String aDigits, int aVoiceMailBox) throws JSONException, Exception {
    return ((Feature) registry.getValue(context)).addTelephoneNumber(aDigits,
      (VoiceMailBox) registry.getValue(aVoiceMailBox)).getAttributes();
  }

  public int addTelephoneNumberToFeatureOnly(int context, int aTelephoneNumber)
    throws Exception {
    return registry
      .getKey(((Feature) registry.getValue(context))
        .addTelephoneNumber((TelephoneNumber) registry
          .getValue(aTelephoneNumber)));
  }

  public JSONObject addTelephoneNumberToFeatureOnlyJSON(int context,
    int aTelephoneNumber) throws JSONException, Exception {
    return ((Feature) registry.getValue(context)).addTelephoneNumber(
      (TelephoneNumber) registry.getValue(aTelephoneNumber)).getAttributes();
  }

  public void deleteFeature(int context) {
    ((Feature) registry.getValue(context)).delete();
    registry.removeObj(context);
  }

  public void deleteTelephoneNumberFromFeature(int context, int aTelephoneNumber) {
    ((Feature) registry.getValue(context))
      .deleteTelephoneNumber((TelephoneNumber) registry
        .getValue(aTelephoneNumber));
  }

  public JSONObject getAttributesOfFeature(int context) throws JSONException {
    return ((Feature) registry.getValue(context)).getAttributes();
  }

  public int constructVoiceMailBox() {
    return registry.add(new VoiceMailBox());
  }

  public JSONObject constructVoiceMailBoxJSON() throws JSONException {
    VoiceMailBox contextObj = new VoiceMailBox();
    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 getVoiceMailMessagesFromVoiceMailBox(int context) {
    ArrayList listOfIDs = new ArrayList();
    for (VoiceMailMessage obj : ((VoiceMailBox) registry.getValue(context))
      .getVoiceMailMessages()) {
      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 getTelephoneNumbersFromVoiceMailBox(int context) {
    ArrayList listOfIDs = new ArrayList();
    for (TelephoneNumber obj : ((VoiceMailBox) registry.getValue(context))
      .getTelephoneNumbers()) {
      listOfIDs.add(registry.getKey(obj));
    }
    return listOfIDs.iterator();
  }

  public int addVoiceMailMessageToVoiceMailBox(int context,
    String aDigitizedSound, int aVoiceMailBox) throws Exception {
    return registry.getKey(((VoiceMailBox) registry.getValue(context))
      .addVoiceMailMessage(aDigitizedSound, (VoiceMailBox) registry
        .getValue(aVoiceMailBox)));
  }

  public JSONObject addVoiceMailMessageToVoiceMailBoxJSON(int context,
    String aDigitizedSound, int aVoiceMailBox) throws JSONException, Exception {
    return ((VoiceMailBox) registry.getValue(context)).addVoiceMailMessage(
      aDigitizedSound, (VoiceMailBox) registry.getValue(aVoiceMailBox))
      .getAttributes();
  }

  public int addVoiceMailMessageToVoiceMailBoxOnly(int context,
    int aVoiceMailMessage) throws Exception {
    return registry.getKey(((VoiceMailBox) registry.getValue(context))
      .addVoiceMailMessage((VoiceMailMessage) registry
        .getValue(aVoiceMailMessage)));
  }

  public JSONObject addVoiceMailMessageToVoiceMailBoxOnlyJSON(int context,
    int aVoiceMailMessage) throws JSONException, Exception {
    return ((VoiceMailBox) registry.getValue(context)).addVoiceMailMessage(
      (VoiceMailMessage) registry.getValue(aVoiceMailMessage)).getAttributes();
  }

  public int addTelephoneNumberToVoiceMailBox(int context, String aDigits,
    int aVoiceMailBox) throws Exception {
    return registry.getKey(((VoiceMailBox) registry.getValue(context))
      .addTelephoneNumber(aDigits, (VoiceMailBox) registry
        .getValue(aVoiceMailBox)));
  }

  public JSONObject addTelephoneNumberToVoiceMailBoxJSON(int context,
    String aDigits, int aVoiceMailBox) throws JSONException, Exception {
    return ((VoiceMailBox) registry.getValue(context)).addTelephoneNumber(
      aDigits, (VoiceMailBox) registry.getValue(aVoiceMailBox)).getAttributes();
  }

  public int addTelephoneNumberToVoiceMailBoxOnly(int context,
    int aTelephoneNumber) throws Exception {
    return registry
      .getKey(((VoiceMailBox) registry.getValue(context))
        .addTelephoneNumber((TelephoneNumber) registry
          .getValue(aTelephoneNumber)));
  }

  public JSONObject addTelephoneNumberToVoiceMailBoxOnlyJSON(int context,
    int aTelephoneNumber) throws JSONException, Exception {
    return ((VoiceMailBox) registry.getValue(context)).addTelephoneNumber(
      (TelephoneNumber) registry.getValue(aTelephoneNumber)).getAttributes();
  }

  public void deleteVoiceMailBox(int context) {
    ((VoiceMailBox) registry.getValue(context)).delete();
    registry.removeObj(context);
  }

  public void deleteVoiceMailMessageFromVoiceMailBox(int context,
    int aVoiceMailMessage) {
    ((VoiceMailBox) registry.getValue(context))
      .deleteVoiceMailMessage((VoiceMailMessage) registry
        .getValue(aVoiceMailMessage));
  }

  public void deleteTelephoneNumberFromVoiceMailBox(int context,
    int aTelephoneNumber) {
    ((VoiceMailBox) registry.getValue(context))
      .deleteTelephoneNumber((TelephoneNumber) registry
        .getValue(aTelephoneNumber));
  }

  public JSONObject getAttributesOfVoiceMailBox(int context)
    throws JSONException {
    return ((VoiceMailBox) registry.getValue(context)).getAttributes();
  }
}