/*This code was generated using the UMPLE modeling language! Date of generation: 2008/07/30 12:30:06*/ /*This class drives: */ package BankingSystem.core.intangableResources; import java.util.*; import BankingSystem.*; import BankingSystem.core.humanResources.*; import BankingSystem.core.tangableResources.*; import BankingSystem.json.*; public class Privilege { //Class datatypes private String description; //Class association variables private List accountTypes; //Registry of our system. BankingSystemRegistry registry = BankingSystemRegistry.getInstance(); //Constructor public Privilege(String aDescription) { description = aDescription; accountTypes = new ArrayList(); registry.add(accountTypes); } public boolean setDescription(String aDescription) { description = aDescription; return true; } public String getDescription() { return description; } public List getAccountTypes() { return accountTypes; } public AccountType addAccountType(Float aMonthlyFee, Float aInterestRate) { AccountType newAccountType; newAccountType = new AccountType(aMonthlyFee, aInterestRate); if (!accountTypes.contains(newAccountType)) { registry.add(newAccountType); accountTypes.add(newAccountType); } return newAccountType; } public AccountType addAccountType(AccountType aAccountType) { if (!accountTypes.contains(aAccountType)) accountTypes.add(aAccountType); return aAccountType; } public void delete() { } public void deleteAccountType(AccountType aAccountType) { if (accountTypes.contains(aAccountType)) { accountTypes.remove(aAccountType); //registry.removeObj(registry.getKey(aAccountType)); } else //Throw an UmpleException .. to be implemented. { } } 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("description", getDescription()); return obj; } }