/*This code was generated using the UMPLE modeling language!*/ package insurance; import java.sql.Time; import java.sql.Date; import java.util.ArrayList; import java.util.Iterator; import insurance.json.*; import insurance.core.*; public class InsuranceFacade { // Singleton instance. private static InsuranceFacade theInstance; //System registry. InsuranceRegistry registry = InsuranceRegistry.getInstance(); /** * Dummy constructor */ private InsuranceFacade() { } /** * Returns the only instance of the Facade. * * @return */ public static InsuranceFacade getInstance() { if (theInstance == null) theInstance = new InsuranceFacade(); return theInstance; } public int constructInsuredProperty(String aYearBuilt, int aPropertyInsurancePolicy) { return registry.add(new InsuredProperty(aYearBuilt, (PropertyInsurancePolicy) registry.getValue(aPropertyInsurancePolicy))); } public JSONObject constructInsuredPropertyJSON(String aYearBuilt, int aPropertyInsurancePolicy) throws JSONException { InsuredProperty contextObj = new InsuredProperty(aYearBuilt, (PropertyInsurancePolicy) registry .getValue(aPropertyInsurancePolicy)); registry.add(contextObj); return contextObj.getAttributes(); } public boolean setYearBuiltInInsuredProperty(int context, String aYearBuilt) { return ((InsuredProperty) registry.getValue(context)) .setYearBuilt(aYearBuilt); } public String getYearBuiltFromInsuredProperty(int context) { return ((InsuredProperty) registry.getValue(context)).getYearBuilt(); } public int getPropertyInsurancePolicyFromInsuredProperty(int context) { return registry.getKey(((InsuredProperty) registry.getValue(context)) .getPropertyInsurancePolicy()); } public JSONObject getPropertyInsurancePolicyFromInsuredPropertyJSON( int context) throws JSONException { return ((InsuredProperty) registry.getValue(context)) .getPropertyInsurancePolicy().getAttributes(); } public void setPropertyInsurancePolicyInInsuredProperty(int context, int aPropertyInsurancePolicy) throws Exception { ((InsuredProperty) registry.getValue(context)) .setPropertyInsurancePolicy((PropertyInsurancePolicy) registry .getValue(aPropertyInsurancePolicy)); } public void deleteInsuredProperty(int context) { ((InsuredProperty) registry.getValue(context)).delete(); registry.removeObj(context); } public JSONObject getAttributesOfInsuredProperty(int context) throws JSONException { return ((InsuredProperty) registry.getValue(context)).getAttributes(); } public int constructTransaction(String aDate, int aInsurancePolicy) { return registry.add(new Transaction(aDate, (InsurancePolicy) registry .getValue(aInsurancePolicy))); } public JSONObject constructTransactionJSON(String aDate, int aInsurancePolicy) throws JSONException { Transaction contextObj = new Transaction(aDate, (InsurancePolicy) registry .getValue(aInsurancePolicy)); registry.add(contextObj); return contextObj.getAttributes(); } public boolean setDateInTransaction(int context, String aDate) { return ((Transaction) registry.getValue(context)).setDate(aDate); } public String getDateFromTransaction(int context) { return ((Transaction) registry.getValue(context)).getDate(); } public int getInsurancePolicyFromTransaction(int context) { return registry.getKey(((Transaction) registry.getValue(context)) .getInsurancePolicy()); } public JSONObject getInsurancePolicyFromTransactionJSON(int context) throws JSONException { return ((Transaction) registry.getValue(context)).getInsurancePolicy() .getAttributes(); } public void setInsurancePolicyInTransaction(int context, int aInsurancePolicy) throws Exception { ((Transaction) registry.getValue(context)) .setInsurancePolicy((InsurancePolicy) registry.getValue(aInsurancePolicy)); } public void deleteTransaction(int context) { ((Transaction) registry.getValue(context)).delete(); registry.removeObj(context); } public JSONObject getAttributesOfTransaction(int context) throws JSONException { return ((Transaction) registry.getValue(context)).getAttributes(); } public int constructInsurancePolicy(String aPolicyNumber, String aMonthlyPremium, String aStarDate, String aEndDate, String aInsuradValue, int aHolder) { return registry.add(new InsurancePolicy(aPolicyNumber, aMonthlyPremium, aStarDate, aEndDate, aInsuradValue, (Person) registry.getValue(aHolder))); } public JSONObject constructInsurancePolicyJSON(String aPolicyNumber, String aMonthlyPremium, String aStarDate, String aEndDate, String aInsuradValue, int aHolder) throws JSONException { InsurancePolicy contextObj = new InsurancePolicy(aPolicyNumber, aMonthlyPremium, aStarDate, aEndDate, aInsuradValue, (Person) registry.getValue(aHolder)); registry.add(contextObj); return contextObj.getAttributes(); } public boolean setPolicyNumberInInsurancePolicy(int context, String aPolicyNumber) { return ((InsurancePolicy) registry.getValue(context)) .setPolicyNumber(aPolicyNumber); } public boolean setMonthlyPremiumInInsurancePolicy(int context, String aMonthlyPremium) { return ((InsurancePolicy) registry.getValue(context)) .setMonthlyPremium(aMonthlyPremium); } public boolean setStarDateInInsurancePolicy(int context, String aStarDate) { return ((InsurancePolicy) registry.getValue(context)) .setStarDate(aStarDate); } public boolean setEndDateInInsurancePolicy(int context, String aEndDate) { return ((InsurancePolicy) registry.getValue(context)).setEndDate(aEndDate); } public boolean setInsuradValueInInsurancePolicy(int context, String aInsuradValue) { return ((InsurancePolicy) registry.getValue(context)) .setInsuradValue(aInsuradValue); } public String getPolicyNumberFromInsurancePolicy(int context) { return ((InsurancePolicy) registry.getValue(context)).getPolicyNumber(); } public String getMonthlyPremiumFromInsurancePolicy(int context) { return ((InsurancePolicy) registry.getValue(context)).getMonthlyPremium(); } public String getStarDateFromInsurancePolicy(int context) { return ((InsurancePolicy) registry.getValue(context)).getStarDate(); } public String getEndDateFromInsurancePolicy(int context) { return ((InsurancePolicy) registry.getValue(context)).getEndDate(); } public String getInsuradValueFromInsurancePolicy(int context) { return ((InsurancePolicy) registry.getValue(context)).getInsuradValue(); } /************ * Method returns an iterator to the list of id's of the elements involved in this list. ***************/ public Iterator getTransactionsFromInsurancePolicy(int context) { ArrayList listOfIDs = new ArrayList(); for (Transaction obj : ((InsurancePolicy) registry.getValue(context)) .getTransactions()) { listOfIDs.add(registry.getKey(obj)); } return listOfIDs.iterator(); } public int getHolderFromInsurancePolicy(int context) { return registry.getKey(((InsurancePolicy) registry.getValue(context)) .getHolder()); } public JSONObject getHolderFromInsurancePolicyJSON(int context) throws JSONException { return ((InsurancePolicy) registry.getValue(context)).getHolder() .getAttributes(); } public int addTransactionToInsurancePolicy(int context, String aDate, int aInsurancePolicy) throws Exception { return registry.getKey(((InsurancePolicy) registry.getValue(context)) .addTransaction(aDate, (InsurancePolicy) registry .getValue(aInsurancePolicy))); } public JSONObject addTransactionToInsurancePolicyJSON(int context, String aDate, int aInsurancePolicy) throws JSONException, Exception { return ((InsurancePolicy) registry.getValue(context)).addTransaction(aDate, (InsurancePolicy) registry.getValue(aInsurancePolicy)).getAttributes(); } public int addTransactionToInsurancePolicyOnly(int context, int aTransaction) throws Exception { return registry.getKey(((InsurancePolicy) registry.getValue(context)) .addTransaction((Transaction) registry.getValue(aTransaction))); } public JSONObject addTransactionToInsurancePolicyOnlyJSON(int context, int aTransaction) throws JSONException, Exception { return ((InsurancePolicy) registry.getValue(context)).addTransaction( (Transaction) registry.getValue(aTransaction)).getAttributes(); } public void setHolderInInsurancePolicy(int context, int aHolder) throws Exception { ((InsurancePolicy) registry.getValue(context)).setHolder((Person) registry .getValue(aHolder)); } public void deleteInsurancePolicy(int context) { ((InsurancePolicy) registry.getValue(context)).delete(); registry.removeObj(context); } public void deleteTransactionFromInsurancePolicy(int context, int aTransaction) { ((InsurancePolicy) registry.getValue(context)) .deleteTransaction((Transaction) registry.getValue(aTransaction)); } public JSONObject getAttributesOfInsurancePolicy(int context) throws JSONException { return ((InsurancePolicy) registry.getValue(context)).getAttributes(); } public int constructClaim(String aDate, int aInsurancePolicy, String aDescription, String aAmountClaimed) { return registry.add(new Claim(aDate, (InsurancePolicy) registry .getValue(aInsurancePolicy), aDescription, aAmountClaimed)); } public JSONObject constructClaimJSON(String aDate, int aInsurancePolicy, String aDescription, String aAmountClaimed) throws JSONException { Claim contextObj = new Claim(aDate, (InsurancePolicy) registry.getValue(aInsurancePolicy), aDescription, aAmountClaimed); registry.add(contextObj); return contextObj.getAttributes(); } public boolean setDescriptionInClaim(int context, String aDescription) { return ((Claim) registry.getValue(context)).setDescription(aDescription); } public boolean setAmountClaimedInClaim(int context, String aAmountClaimed) { return ((Claim) registry.getValue(context)) .setAmountClaimed(aAmountClaimed); } public String getDescriptionFromClaim(int context) { return ((Claim) registry.getValue(context)).getDescription(); } public String getAmountClaimedFromClaim(int context) { return ((Claim) registry.getValue(context)).getAmountClaimed(); } public void deleteClaim(int context) { ((Claim) registry.getValue(context)).delete(); registry.removeObj(context); } public JSONObject getAttributesOfClaim(int context) throws JSONException { return ((Claim) registry.getValue(context)).getAttributes(); } public int constructLifeInsurancePolicy(String aPolicyNumber, String aMonthlyPremium, String aStarDate, String aEndDate, String aInsuradValue, int aHolder, int aInsuredLife) { return registry.add(new LifeInsurancePolicy(aPolicyNumber, aMonthlyPremium, aStarDate, aEndDate, aInsuradValue, (Person) registry.getValue(aHolder), (Person) registry.getValue(aInsuredLife))); } public JSONObject constructLifeInsurancePolicyJSON(String aPolicyNumber, String aMonthlyPremium, String aStarDate, String aEndDate, String aInsuradValue, int aHolder, int aInsuredLife) throws JSONException { LifeInsurancePolicy contextObj = new LifeInsurancePolicy(aPolicyNumber, aMonthlyPremium, aStarDate, aEndDate, aInsuradValue, (Person) registry.getValue(aHolder), (Person) registry.getValue(aInsuredLife)); registry.add(contextObj); return contextObj.getAttributes(); } public int getInsuredLifeFromLifeInsurancePolicy(int context) { return registry.getKey(((LifeInsurancePolicy) registry.getValue(context)) .getInsuredLife()); } public JSONObject getInsuredLifeFromLifeInsurancePolicyJSON(int context) throws JSONException { return ((LifeInsurancePolicy) registry.getValue(context)).getInsuredLife() .getAttributes(); } /************ * Method returns an iterator to the list of id's of the elements involved in this list. ***************/ public Iterator getBeneficiarysFromLifeInsurancePolicy(int context) { ArrayList listOfIDs = new ArrayList(); for (Person obj : ((LifeInsurancePolicy) registry.getValue(context)) .getBeneficiarys()) { listOfIDs.add(registry.getKey(obj)); } return listOfIDs.iterator(); } public int addBeneficiaryToLifeInsurancePolicy(int context, String aName, String aAddress, String aDateOfBirth) throws Exception { return registry.getKey(((LifeInsurancePolicy) registry.getValue(context)) .addBeneficiary(aName, aAddress, aDateOfBirth)); } public JSONObject addBeneficiaryToLifeInsurancePolicyJSON(int context, String aName, String aAddress, String aDateOfBirth) throws JSONException, Exception { return ((LifeInsurancePolicy) registry.getValue(context)).addBeneficiary( aName, aAddress, aDateOfBirth).getAttributes(); } public int addBeneficiaryToLifeInsurancePolicyOnly(int context, int aBeneficiary) throws Exception { return registry.getKey(((LifeInsurancePolicy) registry.getValue(context)) .addBeneficiary((Person) registry.getValue(aBeneficiary))); } public JSONObject addBeneficiaryToLifeInsurancePolicyOnlyJSON(int context, int aBeneficiary) throws JSONException, Exception { return ((LifeInsurancePolicy) registry.getValue(context)).addBeneficiary( (Person) registry.getValue(aBeneficiary)).getAttributes(); } public void setInsuredLifeInLifeInsurancePolicy(int context, int aInsuredLife) throws Exception { ((LifeInsurancePolicy) registry.getValue(context)) .setInsuredLife((Person) registry.getValue(aInsuredLife)); } public void deleteLifeInsurancePolicy(int context) { ((LifeInsurancePolicy) registry.getValue(context)).delete(); registry.removeObj(context); } public void deleteBeneficiaryFromLifeInsurancePolicy(int context, int aPerson) { ((LifeInsurancePolicy) registry.getValue(context)) .deleteBeneficiary((Person) registry.getValue(aPerson)); } public JSONObject getAttributesOfLifeInsurancePolicy(int context) throws JSONException { return ((LifeInsurancePolicy) registry.getValue(context)).getAttributes(); } public int constructBuilding(String aYearBuilt, int aPropertyInsurancePolicy, String aAddress, String aFloorArea) { return registry.add(new Building(aYearBuilt, (PropertyInsurancePolicy) registry.getValue(aPropertyInsurancePolicy), aAddress, aFloorArea)); } public JSONObject constructBuildingJSON(String aYearBuilt, int aPropertyInsurancePolicy, String aAddress, String aFloorArea) throws JSONException { Building contextObj = new Building(aYearBuilt, (PropertyInsurancePolicy) registry .getValue(aPropertyInsurancePolicy), aAddress, aFloorArea); registry.add(contextObj); return contextObj.getAttributes(); } public boolean setAddressInBuilding(int context, String aAddress) { return ((Building) registry.getValue(context)).setAddress(aAddress); } public boolean setFloorAreaInBuilding(int context, String aFloorArea) { return ((Building) registry.getValue(context)).setFloorArea(aFloorArea); } public String getAddressFromBuilding(int context) { return ((Building) registry.getValue(context)).getAddress(); } public String getFloorAreaFromBuilding(int context) { return ((Building) registry.getValue(context)).getFloorArea(); } public void deleteBuilding(int context) { ((Building) registry.getValue(context)).delete(); registry.removeObj(context); } public JSONObject getAttributesOfBuilding(int context) throws JSONException { return ((Building) registry.getValue(context)).getAttributes(); } public int constructRenewal(String aDate, int aInsurancePolicy) { return registry.add(new Renewal(aDate, (InsurancePolicy) registry .getValue(aInsurancePolicy))); } public JSONObject constructRenewalJSON(String aDate, int aInsurancePolicy) throws JSONException { Renewal contextObj = new Renewal(aDate, (InsurancePolicy) registry.getValue(aInsurancePolicy)); registry.add(contextObj); return contextObj.getAttributes(); } public void deleteRenewal(int context) { ((Renewal) registry.getValue(context)).delete(); registry.removeObj(context); } public JSONObject getAttributesOfRenewal(int context) throws JSONException { return ((Renewal) registry.getValue(context)).getAttributes(); } public int constructPropertyInsurancePolicy(String aPolicyNumber, String aMonthlyPremium, String aStarDate, String aEndDate, String aInsuradValue, int aHolder, int aInsuredProperty) { return registry.add(new PropertyInsurancePolicy(aPolicyNumber, aMonthlyPremium, aStarDate, aEndDate, aInsuradValue, (Person) registry .getValue(aHolder), (InsuredProperty) registry .getValue(aInsuredProperty))); } public JSONObject constructPropertyInsurancePolicyJSON(String aPolicyNumber, String aMonthlyPremium, String aStarDate, String aEndDate, String aInsuradValue, int aHolder, int aInsuredProperty) throws JSONException { PropertyInsurancePolicy contextObj = new PropertyInsurancePolicy(aPolicyNumber, aMonthlyPremium, aStarDate, aEndDate, aInsuradValue, (Person) registry.getValue(aHolder), (InsuredProperty) registry.getValue(aInsuredProperty)); registry.add(contextObj); return contextObj.getAttributes(); } public int getInsuredPropertyFromPropertyInsurancePolicy(int context) { return registry.getKey(((PropertyInsurancePolicy) registry .getValue(context)).getInsuredProperty()); } public JSONObject getInsuredPropertyFromPropertyInsurancePolicyJSON( int context) throws JSONException { return ((PropertyInsurancePolicy) registry.getValue(context)) .getInsuredProperty().getAttributes(); } public void setInsuredPropertyInPropertyInsurancePolicy(int context, int aInsuredProperty) throws Exception { ((PropertyInsurancePolicy) registry.getValue(context)) .setInsuredProperty((InsuredProperty) registry.getValue(aInsuredProperty)); } public void deletePropertyInsurancePolicy(int context) { ((PropertyInsurancePolicy) registry.getValue(context)).delete(); registry.removeObj(context); } public JSONObject getAttributesOfPropertyInsurancePolicy(int context) throws JSONException { return ((PropertyInsurancePolicy) registry.getValue(context)) .getAttributes(); } public int constructPerson(String aName, String aAddress, String aDateOfBirth) { return registry.add(new Person(aName, aAddress, aDateOfBirth)); } public JSONObject constructPersonJSON(String aName, String aAddress, String aDateOfBirth) throws JSONException { Person contextObj = new Person(aName, aAddress, aDateOfBirth); registry.add(contextObj); return contextObj.getAttributes(); } public boolean setNameInPerson(int context, String aName) { return ((Person) registry.getValue(context)).setName(aName); } public boolean setAddressInPerson(int context, String aAddress) { return ((Person) registry.getValue(context)).setAddress(aAddress); } public boolean setDateOfBirthInPerson(int context, String aDateOfBirth) { return ((Person) registry.getValue(context)).setDateOfBirth(aDateOfBirth); } public String getNameFromPerson(int context) { return ((Person) registry.getValue(context)).getName(); } public String getAddressFromPerson(int context) { return ((Person) registry.getValue(context)).getAddress(); } public String getDateOfBirthFromPerson(int context) { return ((Person) registry.getValue(context)).getDateOfBirth(); } /************ * Method returns an iterator to the list of id's of the elements involved in this list. ***************/ public Iterator getInsurancePolicysFromPerson(int context) { ArrayList listOfIDs = new ArrayList(); for (InsurancePolicy obj : ((Person) registry.getValue(context)) .getInsurancePolicys()) { 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 getLifeInsurancePolicysFromPerson(int context) { ArrayList listOfIDs = new ArrayList(); for (LifeInsurancePolicy obj : ((Person) registry.getValue(context)) .getLifeInsurancePolicys()) { 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 getLifeInsuranceByAssociationsFromPerson(int context) { ArrayList listOfIDs = new ArrayList(); for (LifeInsurancePolicy obj : ((Person) registry.getValue(context)) .getLifeInsuranceByAssociations()) { listOfIDs.add(registry.getKey(obj)); } return listOfIDs.iterator(); } public int addInsurancePolicyToPerson(int context, String aPolicyNumber, String aMonthlyPremium, String aStarDate, String aEndDate, String aInsuradValue, int aHolder) throws Exception { return registry.getKey(((Person) registry.getValue(context)) .addInsurancePolicy(aPolicyNumber, aMonthlyPremium, aStarDate, aEndDate, aInsuradValue, (Person) registry.getValue(aHolder))); } public JSONObject addInsurancePolicyToPersonJSON(int context, String aPolicyNumber, String aMonthlyPremium, String aStarDate, String aEndDate, String aInsuradValue, int aHolder) throws JSONException, Exception { return ((Person) registry.getValue(context)).addInsurancePolicy( aPolicyNumber, aMonthlyPremium, aStarDate, aEndDate, aInsuradValue, (Person) registry.getValue(aHolder)).getAttributes(); } public int addInsurancePolicyToPersonOnly(int context, int aInsurancePolicy) throws Exception { return registry .getKey(((Person) registry.getValue(context)) .addInsurancePolicy((InsurancePolicy) registry .getValue(aInsurancePolicy))); } public JSONObject addInsurancePolicyToPersonOnlyJSON(int context, int aInsurancePolicy) throws JSONException, Exception { return ((Person) registry.getValue(context)).addInsurancePolicy( (InsurancePolicy) registry.getValue(aInsurancePolicy)).getAttributes(); } public int addLifeInsurancePolicyToPerson(int context, String aPolicyNumber, String aMonthlyPremium, String aStarDate, String aEndDate, String aInsuradValue, int aHolder, int aInsuredLife) throws Exception { return registry.getKey(((Person) registry.getValue(context)) .addLifeInsurancePolicy(aPolicyNumber, aMonthlyPremium, aStarDate, aEndDate, aInsuradValue, (Person) registry.getValue(aHolder), (Person) registry.getValue(aInsuredLife))); } public JSONObject addLifeInsurancePolicyToPersonJSON(int context, String aPolicyNumber, String aMonthlyPremium, String aStarDate, String aEndDate, String aInsuradValue, int aHolder, int aInsuredLife) throws JSONException, Exception { return ((Person) registry.getValue(context)).addLifeInsurancePolicy( aPolicyNumber, aMonthlyPremium, aStarDate, aEndDate, aInsuradValue, (Person) registry.getValue(aHolder), (Person) registry.getValue(aInsuredLife)).getAttributes(); } public int addLifeInsurancePolicyToPersonOnly(int context, int aLifeInsurancePolicy) throws Exception { return registry.getKey(((Person) registry.getValue(context)) .addLifeInsurancePolicy((LifeInsurancePolicy) registry .getValue(aLifeInsurancePolicy))); } public JSONObject addLifeInsurancePolicyToPersonOnlyJSON(int context, int aLifeInsurancePolicy) throws JSONException, Exception { return ((Person) registry.getValue(context)).addLifeInsurancePolicy( (LifeInsurancePolicy) registry.getValue(aLifeInsurancePolicy)) .getAttributes(); } public int addLifeInsuranceByAssociationToPerson(int context, String aPolicyNumber, String aMonthlyPremium, String aStarDate, String aEndDate, String aInsuradValue, int aHolder, int aInsuredLife) throws Exception { return registry.getKey(((Person) registry.getValue(context)) .addLifeInsuranceByAssociation(aPolicyNumber, aMonthlyPremium, aStarDate, aEndDate, aInsuradValue, (Person) registry.getValue(aHolder), (Person) registry.getValue(aInsuredLife))); } public JSONObject addLifeInsuranceByAssociationToPersonJSON(int context, String aPolicyNumber, String aMonthlyPremium, String aStarDate, String aEndDate, String aInsuradValue, int aHolder, int aInsuredLife) throws JSONException, Exception { return ((Person) registry.getValue(context)).addLifeInsuranceByAssociation( aPolicyNumber, aMonthlyPremium, aStarDate, aEndDate, aInsuradValue, (Person) registry.getValue(aHolder), (Person) registry.getValue(aInsuredLife)).getAttributes(); } public int addLifeInsuranceByAssociationToPersonOnly(int context, int aLifeInsuranceByAssociation) throws Exception { return registry.getKey(((Person) registry.getValue(context)) .addLifeInsuranceByAssociation((LifeInsurancePolicy) registry .getValue(aLifeInsuranceByAssociation))); } public JSONObject addLifeInsuranceByAssociationToPersonOnlyJSON(int context, int aLifeInsuranceByAssociation) throws JSONException, Exception { return ((Person) registry.getValue(context)).addLifeInsuranceByAssociation( (LifeInsurancePolicy) registry.getValue(aLifeInsuranceByAssociation)) .getAttributes(); } public void deletePerson(int context) { ((Person) registry.getValue(context)).delete(); registry.removeObj(context); } public void deleteInsurancePolicyFromPerson(int context, int aInsurancePolicy) { ((Person) registry.getValue(context)) .deleteInsurancePolicy((InsurancePolicy) registry .getValue(aInsurancePolicy)); } public void deleteLifeInsurancePolicyFromPerson(int context, int aLifeInsurancePolicy) { ((Person) registry.getValue(context)) .deleteLifeInsurancePolicy((LifeInsurancePolicy) registry .getValue(aLifeInsurancePolicy)); } public void deleteLifeInsuranceByAssociationFromPerson(int context, int aLifeInsurancePolicy) { ((Person) registry.getValue(context)) .deleteLifeInsuranceByAssociation((LifeInsurancePolicy) registry .getValue(aLifeInsurancePolicy)); } public JSONObject getAttributesOfPerson(int context) throws JSONException { return ((Person) registry.getValue(context)).getAttributes(); } public int constructVehicle(String aYearBuilt, int aPropertyInsurancePolicy, String aIdentificationNumber, String aManufacturer, String aModel) { return registry.add(new Vehicle(aYearBuilt, (PropertyInsurancePolicy) registry.getValue(aPropertyInsurancePolicy), aIdentificationNumber, aManufacturer, aModel)); } public JSONObject constructVehicleJSON(String aYearBuilt, int aPropertyInsurancePolicy, String aIdentificationNumber, String aManufacturer, String aModel) throws JSONException { Vehicle contextObj = new Vehicle(aYearBuilt, (PropertyInsurancePolicy) registry .getValue(aPropertyInsurancePolicy), aIdentificationNumber, aManufacturer, aModel); registry.add(contextObj); return contextObj.getAttributes(); } public boolean setIdentificationNumberInVehicle(int context, String aIdentificationNumber) { return ((Vehicle) registry.getValue(context)) .setIdentificationNumber(aIdentificationNumber); } public boolean setManufacturerInVehicle(int context, String aManufacturer) { return ((Vehicle) registry.getValue(context)) .setManufacturer(aManufacturer); } public boolean setModelInVehicle(int context, String aModel) { return ((Vehicle) registry.getValue(context)).setModel(aModel); } public String getIdentificationNumberFromVehicle(int context) { return ((Vehicle) registry.getValue(context)).getIdentificationNumber(); } public String getManufacturerFromVehicle(int context) { return ((Vehicle) registry.getValue(context)).getManufacturer(); } public String getModelFromVehicle(int context) { return ((Vehicle) registry.getValue(context)).getModel(); } public void deleteVehicle(int context) { ((Vehicle) registry.getValue(context)).delete(); registry.removeObj(context); } public JSONObject getAttributesOfVehicle(int context) throws JSONException { return ((Vehicle) registry.getValue(context)).getAttributes(); } }