/*This code was generated using the UMPLE modeling language!*/ package BankingSystem; import java.sql.Time; import java.sql.Date; import java.util.ArrayList; import java.util.Iterator; import BankingSystem.json.*; import BankingSystem.core.*; public class BankingSystemFacade { // Singleton instance. private static BankingSystemFacade theInstance; //System registry. BankingSystemRegistry registry = BankingSystemRegistry.getInstance(); /** * Dummy constructor */ private BankingSystemFacade() { } /** * Returns the only instance of the Facade. * * @return */ public static BankingSystemFacade getInstance() { if (theInstance == null) theInstance = new BankingSystemFacade(); return theInstance; } public int constructDebitCard(String aNumber, String aPIN, int aFinancialInstitution, int aCurrency, ArrayList bankAccounts) { return registry.add(new DebitCard(aNumber, aPIN, (FinancialInstitution) registry.getValue(aFinancialInstitution), (Currency) registry.getValue(aCurrency), bankAccounts)); } public JSONObject constructDebitCardJSON(String aNumber, String aPIN, int aFinancialInstitution, int aCurrency, ArrayList bankAccounts) throws JSONException { DebitCard contextObj = new DebitCard(aNumber, aPIN, (FinancialInstitution) registry .getValue(aFinancialInstitution), (Currency) registry .getValue(aCurrency), bankAccounts); 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 getBankAccountsFromDebitCard(int context) { ArrayList listOfIDs = new ArrayList(); for (BankAccount obj : ((DebitCard) registry.getValue(context)) .getBankAccounts()) { listOfIDs.add(registry.getKey(obj)); } return listOfIDs.iterator(); } public int addBankAccountToDebitCard(int context, String aAccountNumber, String aBalance, Float aOverdraftOrCreditLimit, int aBranch) throws Exception { return registry.getKey(((DebitCard) registry.getValue(context)) .addBankAccount(aAccountNumber, aBalance, aOverdraftOrCreditLimit, (Branch) registry.getValue(aBranch))); } public JSONObject addBankAccountToDebitCardJSON(int context, String aAccountNumber, String aBalance, Float aOverdraftOrCreditLimit, int aBranch) throws JSONException, Exception { return ((DebitCard) registry.getValue(context)).addBankAccount( aAccountNumber, aBalance, aOverdraftOrCreditLimit, (Branch) registry.getValue(aBranch)).getAttributes(); } public int addBankAccountToDebitCardOnly(int context, int aBankAccount) throws Exception { return registry.getKey(((DebitCard) registry.getValue(context)) .addBankAccount((BankAccount) registry.getValue(aBankAccount))); } public JSONObject addBankAccountToDebitCardOnlyJSON(int context, int aBankAccount) throws JSONException, Exception { return ((DebitCard) registry.getValue(context)).addBankAccount( (BankAccount) registry.getValue(aBankAccount)).getAttributes(); } public void deleteDebitCard(int context) { ((DebitCard) registry.getValue(context)).delete(); registry.removeObj(context); } public void deleteBankAccountFromDebitCard(int context, int aBankAccount) { ((DebitCard) registry.getValue(context)) .deleteBankAccount((BankAccount) registry.getValue(aBankAccount)); } public JSONObject getAttributesOfDebitCard(int context) throws JSONException { return ((DebitCard) registry.getValue(context)).getAttributes(); } public int constructFinancialInstitution(String aName) { return registry.add(new FinancialInstitution(aName)); } public JSONObject constructFinancialInstitutionJSON(String aName) throws JSONException { FinancialInstitution contextObj = new FinancialInstitution(aName); registry.add(contextObj); return contextObj.getAttributes(); } public boolean setNameInFinancialInstitution(int context, String aName) { return ((FinancialInstitution) registry.getValue(context)).setName(aName); } public String getNameFromFinancialInstitution(int context) { return ((FinancialInstitution) registry.getValue(context)).getName(); } /************ * Method returns an iterator to the list of id's of the elements involved in this list. ***************/ public Iterator getReusableFinancialInstrumentsFromFinancialInstitution( int context) { ArrayList listOfIDs = new ArrayList(); for (ReusableFinancialInstrument obj : ((FinancialInstitution) registry .getValue(context)).getReusableFinancialInstruments()) { listOfIDs.add(registry.getKey(obj)); } return listOfIDs.iterator(); } public int addReusableFinancialInstrumentToFinancialInstitution(int context, String aNumber, String aPIN, int aFinancialInstitution, int aCurrency) throws Exception { return registry.getKey(((FinancialInstitution) registry.getValue(context)) .addReusableFinancialInstrument(aNumber, aPIN, (FinancialInstitution) registry.getValue(aFinancialInstitution), (Currency) registry.getValue(aCurrency))); } public JSONObject addReusableFinancialInstrumentToFinancialInstitutionJSON( int context, String aNumber, String aPIN, int aFinancialInstitution, int aCurrency) throws JSONException, Exception { return ((FinancialInstitution) registry.getValue(context)) .addReusableFinancialInstrument(aNumber, aPIN, (FinancialInstitution) registry.getValue(aFinancialInstitution), (Currency) registry.getValue(aCurrency)).getAttributes(); } public int addReusableFinancialInstrumentToFinancialInstitutionOnly( int context, int aReusableFinancialInstrument) throws Exception { return registry.getKey(((FinancialInstitution) registry.getValue(context)) .addReusableFinancialInstrument((ReusableFinancialInstrument) registry .getValue(aReusableFinancialInstrument))); } public JSONObject addReusableFinancialInstrumentToFinancialInstitutionOnlyJSON( int context, int aReusableFinancialInstrument) throws JSONException, Exception { return ((FinancialInstitution) registry.getValue(context)) .addReusableFinancialInstrument( (ReusableFinancialInstrument) registry .getValue(aReusableFinancialInstrument)).getAttributes(); } public void deleteFinancialInstitution(int context) { ((FinancialInstitution) registry.getValue(context)).delete(); registry.removeObj(context); } public void deleteReusableFinancialInstrumentFromFinancialInstitution( int context, int aReusableFinancialInstrument) { ((FinancialInstitution) registry.getValue(context)) .deleteReusableFinancialInstrument((ReusableFinancialInstrument) registry .getValue(aReusableFinancialInstrument)); } public JSONObject getAttributesOfFinancialInstitution(int context) throws JSONException { return ((FinancialInstitution) registry.getValue(context)).getAttributes(); } public int constructLoan(String aAccountNumber, String aBalance, Float aOverdraftOrCreditLimit, int aBranch) { return registry.add(new Loan(aAccountNumber, aBalance, aOverdraftOrCreditLimit, (Branch) registry.getValue(aBranch))); } public JSONObject constructLoanJSON(String aAccountNumber, String aBalance, Float aOverdraftOrCreditLimit, int aBranch) throws JSONException { Loan contextObj = new Loan(aAccountNumber, aBalance, aOverdraftOrCreditLimit, (Branch) registry.getValue(aBranch)); registry.add(contextObj); return contextObj.getAttributes(); } public void deleteLoan(int context) { ((Loan) registry.getValue(context)).delete(); registry.removeObj(context); } public JSONObject getAttributesOfLoan(int context) throws JSONException { return ((Loan) registry.getValue(context)).getAttributes(); } public int constructBranch(String aName, String aAddress, int aBank) { return registry.add(new Branch(aName, aAddress, (Bank) registry .getValue(aBank))); } public JSONObject constructBranchJSON(String aName, String aAddress, int aBank) throws JSONException { Branch contextObj = new Branch(aName, aAddress, (Bank) registry.getValue(aBank)); registry.add(contextObj); return contextObj.getAttributes(); } public boolean setNameInBranch(int context, String aName) { return ((Branch) registry.getValue(context)).setName(aName); } public boolean setAddressInBranch(int context, String aAddress) { return ((Branch) registry.getValue(context)).setAddress(aAddress); } public String getNameFromBranch(int context) { return ((Branch) registry.getValue(context)).getName(); } public String getAddressFromBranch(int context) { return ((Branch) registry.getValue(context)).getAddress(); } public int getBankFromBranch(int context) { return registry.getKey(((Branch) registry.getValue(context)).getBank()); } public JSONObject getBankFromBranchJSON(int context) throws JSONException { return ((Branch) registry.getValue(context)).getBank().getAttributes(); } /************ * Method returns an iterator to the list of id's of the elements involved in this list. ***************/ public Iterator getBankAccountsFromBranch(int context) { ArrayList listOfIDs = new ArrayList(); for (BankAccount obj : ((Branch) registry.getValue(context)) .getBankAccounts()) { listOfIDs.add(registry.getKey(obj)); } return listOfIDs.iterator(); } public int addBankAccountToBranch(int context, String aAccountNumber, String aBalance, Float aOverdraftOrCreditLimit, int aBranch) throws Exception { return registry.getKey(((Branch) registry.getValue(context)) .addBankAccount(aAccountNumber, aBalance, aOverdraftOrCreditLimit, (Branch) registry.getValue(aBranch))); } public JSONObject addBankAccountToBranchJSON(int context, String aAccountNumber, String aBalance, Float aOverdraftOrCreditLimit, int aBranch) throws JSONException, Exception { return ((Branch) registry.getValue(context)).addBankAccount(aAccountNumber, aBalance, aOverdraftOrCreditLimit, (Branch) registry.getValue(aBranch)) .getAttributes(); } public int addBankAccountToBranchOnly(int context, int aBankAccount) throws Exception { return registry.getKey(((Branch) registry.getValue(context)) .addBankAccount((BankAccount) registry.getValue(aBankAccount))); } public JSONObject addBankAccountToBranchOnlyJSON(int context, int aBankAccount) throws JSONException, Exception { return ((Branch) registry.getValue(context)).addBankAccount( (BankAccount) registry.getValue(aBankAccount)).getAttributes(); } public void setBankInBranch(int context, int aBank) throws Exception { ((Branch) registry.getValue(context)).setBank((Bank) registry .getValue(aBank)); } public void deleteBranch(int context) { ((Branch) registry.getValue(context)).delete(); registry.removeObj(context); } public void deleteBankAccountFromBranch(int context, int aBankAccount) { ((Branch) registry.getValue(context)) .deleteBankAccount((BankAccount) registry.getValue(aBankAccount)); } public JSONObject getAttributesOfBranch(int context) throws JSONException { return ((Branch) registry.getValue(context)).getAttributes(); } public int constructReusableFinancialInstrument(String aNumber, String aPIN, int aFinancialInstitution, int aCurrency) { return registry.add(new ReusableFinancialInstrument(aNumber, aPIN, (FinancialInstitution) registry.getValue(aFinancialInstitution), (Currency) registry.getValue(aCurrency))); } public JSONObject constructReusableFinancialInstrumentJSON(String aNumber, String aPIN, int aFinancialInstitution, int aCurrency) throws JSONException { ReusableFinancialInstrument contextObj = new ReusableFinancialInstrument(aNumber, aPIN, (FinancialInstitution) registry.getValue(aFinancialInstitution), (Currency) registry.getValue(aCurrency)); registry.add(contextObj); return contextObj.getAttributes(); } public boolean setNumberInReusableFinancialInstrument(int context, String aNumber) { return ((ReusableFinancialInstrument) registry.getValue(context)) .setNumber(aNumber); } public boolean setPINInReusableFinancialInstrument(int context, String aPIN) { return ((ReusableFinancialInstrument) registry.getValue(context)) .setPIN(aPIN); } public String getNumberFromReusableFinancialInstrument(int context) { return ((ReusableFinancialInstrument) registry.getValue(context)) .getNumber(); } public String getPINFromReusableFinancialInstrument(int context) { return ((ReusableFinancialInstrument) registry.getValue(context)).getPIN(); } public int getFinancialInstitutionFromReusableFinancialInstrument(int context) { return registry.getKey(((ReusableFinancialInstrument) registry .getValue(context)).getFinancialInstitution()); } public JSONObject getFinancialInstitutionFromReusableFinancialInstrumentJSON( int context) throws JSONException { return ((ReusableFinancialInstrument) registry.getValue(context)) .getFinancialInstitution().getAttributes(); } public int getCurrencyFromReusableFinancialInstrument(int context) { return registry.getKey(((ReusableFinancialInstrument) registry .getValue(context)).getCurrency()); } public JSONObject getCurrencyFromReusableFinancialInstrumentJSON(int context) throws JSONException { return ((ReusableFinancialInstrument) registry.getValue(context)) .getCurrency().getAttributes(); } public void setFinancialInstitutionInReusableFinancialInstrument(int context, int aFinancialInstitution) throws Exception { ((ReusableFinancialInstrument) registry.getValue(context)) .setFinancialInstitution((FinancialInstitution) registry .getValue(aFinancialInstitution)); } public void setCurrencyInReusableFinancialInstrument(int context, int aCurrency) throws Exception { ((ReusableFinancialInstrument) registry.getValue(context)) .setCurrency((Currency) registry.getValue(aCurrency)); } public void deleteReusableFinancialInstrument(int context) { ((ReusableFinancialInstrument) registry.getValue(context)).delete(); registry.removeObj(context); } public JSONObject getAttributesOfReusableFinancialInstrument(int context) throws JSONException { return ((ReusableFinancialInstrument) registry.getValue(context)) .getAttributes(); } public int constructCreditCardCompany(String aName) { return registry.add(new CreditCardCompany(aName)); } public JSONObject constructCreditCardCompanyJSON(String aName) throws JSONException { CreditCardCompany contextObj = new CreditCardCompany(aName); registry.add(contextObj); return contextObj.getAttributes(); } public void deleteCreditCardCompany(int context) { ((CreditCardCompany) registry.getValue(context)).delete(); registry.removeObj(context); } public JSONObject getAttributesOfCreditCardCompany(int context) throws JSONException { return ((CreditCardCompany) registry.getValue(context)).getAttributes(); } public int constructBank(String aName) { return registry.add(new Bank(aName)); } public JSONObject constructBankJSON(String aName) throws JSONException { Bank contextObj = new Bank(aName); 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 getBranchsFromBank(int context) { ArrayList listOfIDs = new ArrayList(); for (Branch obj : ((Bank) registry.getValue(context)).getBranchs()) { listOfIDs.add(registry.getKey(obj)); } return listOfIDs.iterator(); } public int addBranchToBank(int context, String aName, String aAddress, int aBank) throws Exception { return registry.getKey(((Bank) registry.getValue(context)).addBranch(aName, aAddress, (Bank) registry.getValue(aBank))); } public JSONObject addBranchToBankJSON(int context, String aName, String aAddress, int aBank) throws JSONException, Exception { return ((Bank) registry.getValue(context)).addBranch(aName, aAddress, (Bank) registry.getValue(aBank)).getAttributes(); } public int addBranchToBankOnly(int context, int aBranch) throws Exception { return registry.getKey(((Bank) registry.getValue(context)) .addBranch((Branch) registry.getValue(aBranch))); } public JSONObject addBranchToBankOnlyJSON(int context, int aBranch) throws JSONException, Exception { return ((Bank) registry.getValue(context)).addBranch( (Branch) registry.getValue(aBranch)).getAttributes(); } public void deleteBank(int context) { ((Bank) registry.getValue(context)).delete(); registry.removeObj(context); } public void deleteBranchFromBank(int context, int aBranch) { ((Bank) registry.getValue(context)).deleteBranch((Branch) registry .getValue(aBranch)); } public JSONObject getAttributesOfBank(int context) throws JSONException { return ((Bank) registry.getValue(context)).getAttributes(); } public int constructBankAccount(String aAccountNumber, String aBalance, Float aOverdraftOrCreditLimit, int aBranch) { return registry.add(new BankAccount(aAccountNumber, aBalance, aOverdraftOrCreditLimit, (Branch) registry.getValue(aBranch))); } public JSONObject constructBankAccountJSON(String aAccountNumber, String aBalance, Float aOverdraftOrCreditLimit, int aBranch) throws JSONException { BankAccount contextObj = new BankAccount(aAccountNumber, aBalance, aOverdraftOrCreditLimit, (Branch) registry.getValue(aBranch)); registry.add(contextObj); return contextObj.getAttributes(); } public boolean setAccountNumberInBankAccount(int context, String aAccountNumber) { return ((BankAccount) registry.getValue(context)) .setAccountNumber(aAccountNumber); } public boolean setBalanceInBankAccount(int context, String aBalance) { return ((BankAccount) registry.getValue(context)).setBalance(aBalance); } public boolean setOverdraftOrCreditLimitInBankAccount(int context, Float aOverdraftOrCreditLimit) { return ((BankAccount) registry.getValue(context)) .setOverdraftOrCreditLimit(aOverdraftOrCreditLimit); } public String getAccountNumberFromBankAccount(int context) { return ((BankAccount) registry.getValue(context)).getAccountNumber(); } public String getBalanceFromBankAccount(int context) { return ((BankAccount) registry.getValue(context)).getBalance(); } public Float getOverdraftOrCreditLimitFromBankAccount(int context) { return ((BankAccount) registry.getValue(context)) .getOverdraftOrCreditLimit(); } /************ * Method returns an iterator to the list of id's of the elements involved in this list. ***************/ public Iterator getDebitCardsFromBankAccount(int context) { ArrayList listOfIDs = new ArrayList(); for (DebitCard obj : ((BankAccount) registry.getValue(context)) .getDebitCards()) { 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 getChequesFromBankAccount(int context) { ArrayList listOfIDs = new ArrayList(); for (Cheque obj : ((BankAccount) registry.getValue(context)).getCheques()) { listOfIDs.add(registry.getKey(obj)); } return listOfIDs.iterator(); } public int getBranchFromBankAccount(int context) { return registry.getKey(((BankAccount) registry.getValue(context)) .getBranch()); } public JSONObject getBranchFromBankAccountJSON(int context) throws JSONException { return ((BankAccount) registry.getValue(context)).getBranch() .getAttributes(); } public int addDebitCardToBankAccount(int context, String aNumber, String aPIN, int aFinancialInstitution, int aCurrency, ArrayList bankAccounts) throws Exception { return registry.getKey(((BankAccount) registry.getValue(context)) .addDebitCard(aNumber, aPIN, (FinancialInstitution) registry .getValue(aFinancialInstitution), (Currency) registry .getValue(aCurrency), bankAccounts)); } public JSONObject addDebitCardToBankAccountJSON(int context, String aNumber, String aPIN, int aFinancialInstitution, int aCurrency, ArrayList bankAccounts) throws JSONException, Exception { return ((BankAccount) registry.getValue(context)).addDebitCard(aNumber, aPIN, (FinancialInstitution) registry.getValue(aFinancialInstitution), (Currency) registry.getValue(aCurrency), bankAccounts).getAttributes(); } public int addDebitCardToBankAccountOnly(int context, int aDebitCard) throws Exception { return registry.getKey(((BankAccount) registry.getValue(context)) .addDebitCard((DebitCard) registry.getValue(aDebitCard))); } public JSONObject addDebitCardToBankAccountOnlyJSON(int context, int aDebitCard) throws JSONException, Exception { return ((BankAccount) registry.getValue(context)).addDebitCard( (DebitCard) registry.getValue(aDebitCard)).getAttributes(); } public int addChequeToBankAccount(int context, String aAmount, Date aDate, String aSequenceNumber, int aBankAccount) throws Exception { return registry.getKey(((BankAccount) registry.getValue(context)) .addCheque(aAmount, aDate, aSequenceNumber, (BankAccount) registry .getValue(aBankAccount))); } public JSONObject addChequeToBankAccountJSON(int context, String aAmount, Date aDate, String aSequenceNumber, int aBankAccount) throws JSONException, Exception { return ((BankAccount) registry.getValue(context)).addCheque(aAmount, aDate, aSequenceNumber, (BankAccount) registry.getValue(aBankAccount)) .getAttributes(); } public int addChequeToBankAccountOnly(int context, int aCheque) throws Exception { return registry.getKey(((BankAccount) registry.getValue(context)) .addCheque((Cheque) registry.getValue(aCheque))); } public JSONObject addChequeToBankAccountOnlyJSON(int context, int aCheque) throws JSONException, Exception { return ((BankAccount) registry.getValue(context)).addCheque( (Cheque) registry.getValue(aCheque)).getAttributes(); } public void setBranchInBankAccount(int context, int aBranch) throws Exception { ((BankAccount) registry.getValue(context)).setBranch((Branch) registry .getValue(aBranch)); } public void deleteBankAccount(int context) { ((BankAccount) registry.getValue(context)).delete(); registry.removeObj(context); } public void deleteDebitCardFromBankAccount(int context, int aDebitCard) { ((BankAccount) registry.getValue(context)) .deleteDebitCard((DebitCard) registry.getValue(aDebitCard)); } public void deleteChequeFromBankAccount(int context, int aCheque) { ((BankAccount) registry.getValue(context)).deleteCheque((Cheque) registry .getValue(aCheque)); } public JSONObject getAttributesOfBankAccount(int context) throws JSONException { return ((BankAccount) registry.getValue(context)).getAttributes(); } public int constructCheque(String aAmount, Date aDate, String aSequenceNumber, int aBankAccount) { return registry.add(new Cheque(aAmount, aDate, aSequenceNumber, (BankAccount) registry.getValue(aBankAccount))); } public JSONObject constructChequeJSON(String aAmount, Date aDate, String aSequenceNumber, int aBankAccount) throws JSONException { Cheque contextObj = new Cheque(aAmount, aDate, aSequenceNumber, (BankAccount) registry .getValue(aBankAccount)); registry.add(contextObj); return contextObj.getAttributes(); } public boolean setAmountInCheque(int context, String aAmount) { return ((Cheque) registry.getValue(context)).setAmount(aAmount); } public boolean setDateInCheque(int context, Date aDate) { return ((Cheque) registry.getValue(context)).setDate(aDate); } public boolean setSequenceNumberInCheque(int context, String aSequenceNumber) { return ((Cheque) registry.getValue(context)) .setSequenceNumber(aSequenceNumber); } public String getAmountFromCheque(int context) { return ((Cheque) registry.getValue(context)).getAmount(); } public Date getDateFromCheque(int context) { return ((Cheque) registry.getValue(context)).getDate(); } public String getSequenceNumberFromCheque(int context) { return ((Cheque) registry.getValue(context)).getSequenceNumber(); } public int getBankAccountFromCheque(int context) { return registry.getKey(((Cheque) registry.getValue(context)) .getBankAccount()); } public JSONObject getBankAccountFromChequeJSON(int context) throws JSONException { return ((Cheque) registry.getValue(context)).getBankAccount() .getAttributes(); } public void setBankAccountInCheque(int context, int aBankAccount) throws Exception { ((Cheque) registry.getValue(context)).setBankAccount((BankAccount) registry .getValue(aBankAccount)); } public void deleteCheque(int context) { ((Cheque) registry.getValue(context)).delete(); registry.removeObj(context); } public JSONObject getAttributesOfCheque(int context) throws JSONException { return ((Cheque) registry.getValue(context)).getAttributes(); } public int constructFinancialInstrument() { return registry.add(new FinancialInstrument()); } public JSONObject constructFinancialInstrumentJSON() throws JSONException { FinancialInstrument contextObj = new FinancialInstrument(); registry.add(contextObj); return contextObj.getAttributes(); } public void deleteFinancialInstrument(int context) { ((FinancialInstrument) registry.getValue(context)).delete(); registry.removeObj(context); } public JSONObject getAttributesOfFinancialInstrument(int context) throws JSONException { return ((FinancialInstrument) registry.getValue(context)).getAttributes(); } public int constructCurrency(String aCode, String aExchangeRate) { return registry.add(new Currency(aCode, aExchangeRate)); } public JSONObject constructCurrencyJSON(String aCode, String aExchangeRate) throws JSONException { Currency contextObj = new Currency(aCode, aExchangeRate); registry.add(contextObj); return contextObj.getAttributes(); } public boolean setCodeInCurrency(int context, String aCode) { return ((Currency) registry.getValue(context)).setCode(aCode); } public boolean setExchangeRateInCurrency(int context, String aExchangeRate) { return ((Currency) registry.getValue(context)) .setExchangeRate(aExchangeRate); } public String getCodeFromCurrency(int context) { return ((Currency) registry.getValue(context)).getCode(); } public String getExchangeRateFromCurrency(int context) { return ((Currency) registry.getValue(context)).getExchangeRate(); } public void deleteCurrency(int context) { ((Currency) registry.getValue(context)).delete(); registry.removeObj(context); } public JSONObject getAttributesOfCurrency(int context) throws JSONException { return ((Currency) registry.getValue(context)).getAttributes(); } public int constructCreditCard(String aNumber, String aPIN, int aFinancialInstitution, int aCurrency, String aCreditLimit, String aName) { return registry.add(new CreditCard(aNumber, aPIN, (FinancialInstitution) registry.getValue(aFinancialInstitution), (Currency) registry.getValue(aCurrency), aCreditLimit, aName)); } public JSONObject constructCreditCardJSON(String aNumber, String aPIN, int aFinancialInstitution, int aCurrency, String aCreditLimit, String aName) throws JSONException { CreditCard contextObj = new CreditCard(aNumber, aPIN, (FinancialInstitution) registry .getValue(aFinancialInstitution), (Currency) registry .getValue(aCurrency), aCreditLimit, aName); registry.add(contextObj); return contextObj.getAttributes(); } public boolean setCreditLimitInCreditCard(int context, String aCreditLimit) { return ((CreditCard) registry.getValue(context)) .setCreditLimit(aCreditLimit); } public boolean setNameInCreditCard(int context, String aName) { return ((CreditCard) registry.getValue(context)).setName(aName); } public String getCreditLimitFromCreditCard(int context) { return ((CreditCard) registry.getValue(context)).getCreditLimit(); } public String getNameFromCreditCard(int context) { return ((CreditCard) registry.getValue(context)).getName(); } public void deleteCreditCard(int context) { ((CreditCard) registry.getValue(context)).delete(); registry.removeObj(context); } public JSONObject getAttributesOfCreditCard(int context) throws JSONException { return ((CreditCard) registry.getValue(context)).getAttributes(); } }