/*This code was generated using the UMPLE modeling language!
 Date of generation: 2008/07/30 11:21:38*/
/*This class drives: */

package insurance.core;

import java.sql.Date;
import insurance.*;
import insurance.json.*;

public class PropertyInsurancePolicy extends InsurancePolicy {
  //Class datatypes

  //Class association variables
  private InsuredProperty insuredProperty;

  //Registry of our system.
  InsuranceRegistry registry = InsuranceRegistry.getInstance();

  //Constructor
  public PropertyInsurancePolicy(String aPolicyNumber, String aMonthlyPremium,
    String aStarDate, String aEndDate, String aInsuradValue, Person aHolder,
    InsuredProperty aInsuredProperty) {
    super(aPolicyNumber, aMonthlyPremium, aStarDate, aEndDate, aInsuradValue,
      aHolder);
    insuredProperty = aInsuredProperty;

  }

  public InsuredProperty getInsuredProperty() {
    return insuredProperty;
  }

  /* This class does not drive InsuredProperty and therefore sets the association unidirectionally.*/
  public void setInsuredProperty(InsuredProperty aInsuredProperty) {
    insuredProperty = aInsuredProperty;
  }

  public void delete() {
    //Delete all 1 ends.
    insuredProperty.delete();
  }

  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));
    return obj;
  }

}