/*This code was generated using the UMPLE modeling language!
 Date of generation: 2008/07/30 11:46:04*/
/*This class drives: */

package telesystem.core;

import telesystem.*;
import telesystem.json.*;

public class VoiceMailMessage {
  //Class datatypes
  private String digitizedSound;

  //Class association variables
  private VoiceMailBox voiceMailBox;

  //Registry of our system.
  TelesystemRegistry registry = TelesystemRegistry.getInstance();

  //Constructor
  public VoiceMailMessage(String aDigitizedSound, VoiceMailBox aVoiceMailBox) {
    digitizedSound = aDigitizedSound;
    voiceMailBox = aVoiceMailBox;
    voiceMailBox.addVoiceMailMessage(this);

  }

  public boolean setDigitizedSound(String aDigitizedSound) {
    digitizedSound = aDigitizedSound;
    return true;
  }

  public String getDigitizedSound() {
    return digitizedSound;
  }

  public VoiceMailBox getVoiceMailBox() {
    return voiceMailBox;
  }

  /* This class does not drive VoiceMailBox and therefore sets the association unidirectionally.*/
  public void setVoiceMailBox(VoiceMailBox aVoiceMailBox) {
    voiceMailBox = aVoiceMailBox;
  }

  public void delete() {
    //Delete all 1 ends.
    voiceMailBox.deleteVoiceMailMessage(this);
  }

  public boolean areManyEndsNull() {
    return true;
  }

  /***********************************
   * Returns the attribute list along with the  
   * class ID in JSON format.
   ***********************************/
  public JSONObject getAttributes() throws JSONException {
    JSONObject obj = new JSONObject();
    obj.put("CLASS_ID", registry.getKey(this));
    obj.put("digitizedSound", getDigitizedSound());
    return obj;
  }

}