/*This code was generated using the UMPLE modeling language!
 Date of generation: 2008/07/30 12:41:46*/
/*This class drives: */

package BankingSystem.core;

import BankingSystem.*;
import BankingSystem.json.*;

public class CreditCard extends ReusableFinancialInstrument {
  //Class datatypes
  private String creditLimit;

  private String name;

  //Class association variables

  //Registry of our system.
  BankingSystemRegistry registry = BankingSystemRegistry.getInstance();

  //Constructor
  public CreditCard(String aNumber, String aPIN,
    FinancialInstitution aFinancialInstitution, Currency aCurrency,
    String aCreditLimit, String aName) {
    super(aNumber, aPIN, aFinancialInstitution, aCurrency);
    creditLimit = aCreditLimit;
    name = aName;
  }

  public boolean setCreditLimit(String aCreditLimit) {
    creditLimit = aCreditLimit;
    return true;
  }

  public boolean setName(String aName) {
    name = aName;
    return true;
  }

  public String getCreditLimit() {
    return creditLimit;
  }

  public String getName() {
    return name;
  }

  public void 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));
    obj.put("creditLimit", getCreditLimit());
    obj.put("name", getName());
    return obj;
  }

}