/*This code was generated using the UMPLE modeling language!*/ package ClientOrder; import java.sql.Time; import java.sql.Date; import java.util.ArrayList; import java.util.Iterator; import ClientOrder.json.*; import ClientOrder.core.*; public class ClientOrderFacade { // Singleton instance. private static ClientOrderFacade theInstance; //System registry. ClientOrderRegistry registry = ClientOrderRegistry.getInstance(); /** * Dummy constructor */ private ClientOrderFacade() { } /** * Returns the only instance of the Facade. * * @return */ public static ClientOrderFacade getInstance() { if (theInstance == null) theInstance = new ClientOrderFacade(); return theInstance; } public int constructOrderFromClient(String aOurOrderNumber, String aDatePlaced, String aClientsPurchaseOrder, String aCreditCardToCharge, int aClient) { return registry.add(new OrderFromClient(aOurOrderNumber, aDatePlaced, aClientsPurchaseOrder, aCreditCardToCharge, (Client) registry .getValue(aClient))); } public JSONObject constructOrderFromClientJSON(String aOurOrderNumber, String aDatePlaced, String aClientsPurchaseOrder, String aCreditCardToCharge, int aClient) throws JSONException { OrderFromClient contextObj = new OrderFromClient(aOurOrderNumber, aDatePlaced, aClientsPurchaseOrder, aCreditCardToCharge, (Client) registry.getValue(aClient)); registry.add(contextObj); return contextObj.getAttributes(); } public boolean setOurOrderNumberInOrderFromClient(int context, String aOurOrderNumber) { return ((OrderFromClient) registry.getValue(context)) .setOurOrderNumber(aOurOrderNumber); } public boolean setDatePlacedInOrderFromClient(int context, String aDatePlaced) { return ((OrderFromClient) registry.getValue(context)) .setDatePlaced(aDatePlaced); } public boolean setClientsPurchaseOrderInOrderFromClient(int context, String aClientsPurchaseOrder) { return ((OrderFromClient) registry.getValue(context)) .setClientsPurchaseOrder(aClientsPurchaseOrder); } public boolean setCreditCardToChargeInOrderFromClient(int context, String aCreditCardToCharge) { return ((OrderFromClient) registry.getValue(context)) .setCreditCardToCharge(aCreditCardToCharge); } public String getOurOrderNumberFromOrderFromClient(int context) { return ((OrderFromClient) registry.getValue(context)).getOurOrderNumber(); } public String getDatePlacedFromOrderFromClient(int context) { return ((OrderFromClient) registry.getValue(context)).getDatePlaced(); } public String getClientsPurchaseOrderFromOrderFromClient(int context) { return ((OrderFromClient) registry.getValue(context)) .getClientsPurchaseOrder(); } public String getCreditCardToChargeFromOrderFromClient(int context) { return ((OrderFromClient) registry.getValue(context)) .getCreditCardToCharge(); } public int getClientFromOrderFromClient(int context) { return registry.getKey(((OrderFromClient) registry.getValue(context)) .getClient()); } public JSONObject getClientFromOrderFromClientJSON(int context) throws JSONException { return ((OrderFromClient) registry.getValue(context)).getClient() .getAttributes(); } /************ * Method returns an iterator to the list of id's of the elements involved in this list. ***************/ public Iterator getClientOrderLineItemsFromOrderFromClient(int context) { ArrayList listOfIDs = new ArrayList(); for (ClientOrderLineItem obj : ((OrderFromClient) registry .getValue(context)).getClientOrderLineItems()) { listOfIDs.add(registry.getKey(obj)); } return listOfIDs.iterator(); } public int getSalesPersonFromOrderFromClient(int context) { return registry.getKey(((OrderFromClient) registry.getValue(context)) .getSalesPerson()); } public JSONObject getSalesPersonFromOrderFromClientJSON(int context) throws JSONException { return ((OrderFromClient) registry.getValue(context)).getSalesPerson() .getAttributes(); } public int addClientOrderLineItemToOrderFromClient(int context, String aNumberOrdered, String aPricePerUnitCharged, int aOrderFromClient, int aProduct) throws Exception { return registry.getKey(((OrderFromClient) registry.getValue(context)) .addClientOrderLineItem(aNumberOrdered, aPricePerUnitCharged, (OrderFromClient) registry.getValue(aOrderFromClient), (Product) registry.getValue(aProduct))); } public JSONObject addClientOrderLineItemToOrderFromClientJSON(int context, String aNumberOrdered, String aPricePerUnitCharged, int aOrderFromClient, int aProduct) throws JSONException, Exception { return ((OrderFromClient) registry.getValue(context)) .addClientOrderLineItem(aNumberOrdered, aPricePerUnitCharged, (OrderFromClient) registry.getValue(aOrderFromClient), (Product) registry.getValue(aProduct)).getAttributes(); } public int addClientOrderLineItemToOrderFromClientOnly(int context, int aClientOrderLineItem) throws Exception { return registry.getKey(((OrderFromClient) registry.getValue(context)) .addClientOrderLineItem((ClientOrderLineItem) registry .getValue(aClientOrderLineItem))); } public JSONObject addClientOrderLineItemToOrderFromClientOnlyJSON( int context, int aClientOrderLineItem) throws JSONException, Exception { return ((OrderFromClient) registry.getValue(context)) .addClientOrderLineItem( (ClientOrderLineItem) registry.getValue(aClientOrderLineItem)) .getAttributes(); } public void setClientInOrderFromClient(int context, int aClient) throws Exception { ((OrderFromClient) registry.getValue(context)).setClient((Client) registry .getValue(aClient)); } public void setSalesPersonInOrderFromClient(int context, int aSalesPerson) throws Exception { ((OrderFromClient) registry.getValue(context)) .setSalesPerson((SalesPerson) registry.getValue(aSalesPerson)); } public void deleteOrderFromClient(int context) { ((OrderFromClient) registry.getValue(context)).delete(); registry.removeObj(context); } public void deleteClientOrderLineItemFromOrderFromClient(int context, int aClientOrderLineItem) { ((OrderFromClient) registry.getValue(context)) .deleteClientOrderLineItem((ClientOrderLineItem) registry .getValue(aClientOrderLineItem)); } public void deleteSalesPersonFromOrderFromClient(int context, int aSalesPerson) { ((OrderFromClient) registry.getValue(context)) .deleteSalesPerson((SalesPerson) registry.getValue(aSalesPerson)); } public JSONObject getAttributesOfOrderFromClient(int context) throws JSONException { return ((OrderFromClient) registry.getValue(context)).getAttributes(); } public int constructProduct(String aOurCode, String aDescription, String aPicture, String aOurListPricePerunit, String aNumberInInventory, String aNumberToKeepInv, int aProductCategory) { return registry.add(new Product(aOurCode, aDescription, aPicture, aOurListPricePerunit, aNumberInInventory, aNumberToKeepInv, (ProductCategory) registry.getValue(aProductCategory))); } public JSONObject constructProductJSON(String aOurCode, String aDescription, String aPicture, String aOurListPricePerunit, String aNumberInInventory, String aNumberToKeepInv, int aProductCategory) throws JSONException { Product contextObj = new Product(aOurCode, aDescription, aPicture, aOurListPricePerunit, aNumberInInventory, aNumberToKeepInv, (ProductCategory) registry .getValue(aProductCategory)); registry.add(contextObj); return contextObj.getAttributes(); } public boolean setOurCodeInProduct(int context, String aOurCode) { return ((Product) registry.getValue(context)).setOurCode(aOurCode); } public boolean setDescriptionInProduct(int context, String aDescription) { return ((Product) registry.getValue(context)).setDescription(aDescription); } public boolean setPictureInProduct(int context, String aPicture) { return ((Product) registry.getValue(context)).setPicture(aPicture); } public boolean setOurListPricePerunitInProduct(int context, String aOurListPricePerunit) { return ((Product) registry.getValue(context)) .setOurListPricePerunit(aOurListPricePerunit); } public boolean setNumberInInventoryInProduct(int context, String aNumberInInventory) { return ((Product) registry.getValue(context)) .setNumberInInventory(aNumberInInventory); } public boolean setNumberToKeepInvInProduct(int context, String aNumberToKeepInv) { return ((Product) registry.getValue(context)) .setNumberToKeepInv(aNumberToKeepInv); } public String getOurCodeFromProduct(int context) { return ((Product) registry.getValue(context)).getOurCode(); } public String getDescriptionFromProduct(int context) { return ((Product) registry.getValue(context)).getDescription(); } public String getPictureFromProduct(int context) { return ((Product) registry.getValue(context)).getPicture(); } public String getOurListPricePerunitFromProduct(int context) { return ((Product) registry.getValue(context)).getOurListPricePerunit(); } public String getNumberInInventoryFromProduct(int context) { return ((Product) registry.getValue(context)).getNumberInInventory(); } public String getNumberToKeepInvFromProduct(int context) { return ((Product) registry.getValue(context)).getNumberToKeepInv(); } /************ * Method returns an iterator to the list of id's of the elements involved in this list. ***************/ public Iterator getClientOrderLineItemsFromProduct(int context) { ArrayList listOfIDs = new ArrayList(); for (ClientOrderLineItem obj : ((Product) registry.getValue(context)) .getClientOrderLineItems()) { listOfIDs.add(registry.getKey(obj)); } return listOfIDs.iterator(); } public int getProductCategoryFromProduct(int context) { return registry.getKey(((Product) registry.getValue(context)) .getProductCategory()); } public JSONObject getProductCategoryFromProductJSON(int context) throws JSONException { return ((Product) registry.getValue(context)).getProductCategory() .getAttributes(); } public int addClientOrderLineItemToProduct(int context, String aNumberOrdered, String aPricePerUnitCharged, int aOrderFromClient, int aProduct) throws Exception { return registry.getKey(((Product) registry.getValue(context)) .addClientOrderLineItem(aNumberOrdered, aPricePerUnitCharged, (OrderFromClient) registry.getValue(aOrderFromClient), (Product) registry.getValue(aProduct))); } public JSONObject addClientOrderLineItemToProductJSON(int context, String aNumberOrdered, String aPricePerUnitCharged, int aOrderFromClient, int aProduct) throws JSONException, Exception { return ((Product) registry.getValue(context)).addClientOrderLineItem( aNumberOrdered, aPricePerUnitCharged, (OrderFromClient) registry.getValue(aOrderFromClient), (Product) registry.getValue(aProduct)).getAttributes(); } public int addClientOrderLineItemToProductOnly(int context, int aClientOrderLineItem) throws Exception { return registry.getKey(((Product) registry.getValue(context)) .addClientOrderLineItem((ClientOrderLineItem) registry .getValue(aClientOrderLineItem))); } public JSONObject addClientOrderLineItemToProductOnlyJSON(int context, int aClientOrderLineItem) throws JSONException, Exception { return ((Product) registry.getValue(context)).addClientOrderLineItem( (ClientOrderLineItem) registry.getValue(aClientOrderLineItem)) .getAttributes(); } public void setProductCategoryInProduct(int context, int aProductCategory) throws Exception { ((Product) registry.getValue(context)) .setProductCategory((ProductCategory) registry.getValue(aProductCategory)); } public void deleteProduct(int context) { ((Product) registry.getValue(context)).delete(); registry.removeObj(context); } public void deleteClientOrderLineItemFromProduct(int context, int aClientOrderLineItem) { ((Product) registry.getValue(context)) .deleteClientOrderLineItem((ClientOrderLineItem) registry .getValue(aClientOrderLineItem)); } public JSONObject getAttributesOfProduct(int context) throws JSONException { return ((Product) registry.getValue(context)).getAttributes(); } public int constructSalesPerson(String aName) { return registry.add(new SalesPerson(aName)); } public JSONObject constructSalesPersonJSON(String aName) throws JSONException { SalesPerson contextObj = new SalesPerson(aName); registry.add(contextObj); return contextObj.getAttributes(); } public boolean setNameInSalesPerson(int context, String aName) { return ((SalesPerson) registry.getValue(context)).setName(aName); } public String getNameFromSalesPerson(int context) { return ((SalesPerson) registry.getValue(context)).getName(); } /************ * Method returns an iterator to the list of id's of the elements involved in this list. ***************/ public Iterator getOrderFromClientsFromSalesPerson(int context) { ArrayList listOfIDs = new ArrayList(); for (OrderFromClient obj : ((SalesPerson) registry.getValue(context)) .getOrderFromClients()) { listOfIDs.add(registry.getKey(obj)); } return listOfIDs.iterator(); } public int addOrderFromClientToSalesPerson(int context, String aOurOrderNumber, String aDatePlaced, String aClientsPurchaseOrder, String aCreditCardToCharge, int aClient) throws Exception { return registry.getKey(((SalesPerson) registry.getValue(context)) .addOrderFromClient(aOurOrderNumber, aDatePlaced, aClientsPurchaseOrder, aCreditCardToCharge, (Client) registry.getValue(aClient))); } public JSONObject addOrderFromClientToSalesPersonJSON(int context, String aOurOrderNumber, String aDatePlaced, String aClientsPurchaseOrder, String aCreditCardToCharge, int aClient) throws JSONException, Exception { return ((SalesPerson) registry.getValue(context)).addOrderFromClient( aOurOrderNumber, aDatePlaced, aClientsPurchaseOrder, aCreditCardToCharge, (Client) registry.getValue(aClient)).getAttributes(); } public int addOrderFromClientToSalesPersonOnly(int context, int aOrderFromClient) throws Exception { return registry .getKey(((SalesPerson) registry.getValue(context)) .addOrderFromClient((OrderFromClient) registry .getValue(aOrderFromClient))); } public JSONObject addOrderFromClientToSalesPersonOnlyJSON(int context, int aOrderFromClient) throws JSONException, Exception { return ((SalesPerson) registry.getValue(context)).addOrderFromClient( (OrderFromClient) registry.getValue(aOrderFromClient)).getAttributes(); } public void deleteSalesPerson(int context) { ((SalesPerson) registry.getValue(context)).delete(); registry.removeObj(context); } public void deleteOrderFromClientFromSalesPerson(int context, int aOrderFromClient) { ((SalesPerson) registry.getValue(context)) .deleteOrderFromClient((OrderFromClient) registry .getValue(aOrderFromClient)); } public JSONObject getAttributesOfSalesPerson(int context) throws JSONException { return ((SalesPerson) registry.getValue(context)).getAttributes(); } public int constructClientOrderLineItem(String aNumberOrdered, String aPricePerUnitCharged, int aOrderFromClient, int aProduct) { return registry.add(new ClientOrderLineItem(aNumberOrdered, aPricePerUnitCharged, (OrderFromClient) registry .getValue(aOrderFromClient), (Product) registry.getValue(aProduct))); } public JSONObject constructClientOrderLineItemJSON(String aNumberOrdered, String aPricePerUnitCharged, int aOrderFromClient, int aProduct) throws JSONException { ClientOrderLineItem contextObj = new ClientOrderLineItem(aNumberOrdered, aPricePerUnitCharged, (OrderFromClient) registry.getValue(aOrderFromClient), (Product) registry.getValue(aProduct)); registry.add(contextObj); return contextObj.getAttributes(); } public boolean setNumberOrderedInClientOrderLineItem(int context, String aNumberOrdered) { return ((ClientOrderLineItem) registry.getValue(context)) .setNumberOrdered(aNumberOrdered); } public boolean setPricePerUnitChargedInClientOrderLineItem(int context, String aPricePerUnitCharged) { return ((ClientOrderLineItem) registry.getValue(context)) .setPricePerUnitCharged(aPricePerUnitCharged); } public String getNumberOrderedFromClientOrderLineItem(int context) { return ((ClientOrderLineItem) registry.getValue(context)) .getNumberOrdered(); } public String getPricePerUnitChargedFromClientOrderLineItem(int context) { return ((ClientOrderLineItem) registry.getValue(context)) .getPricePerUnitCharged(); } public int getOrderFromClientFromClientOrderLineItem(int context) { return registry.getKey(((ClientOrderLineItem) registry.getValue(context)) .getOrderFromClient()); } public JSONObject getOrderFromClientFromClientOrderLineItemJSON(int context) throws JSONException { return ((ClientOrderLineItem) registry.getValue(context)) .getOrderFromClient().getAttributes(); } /************ * Method returns an iterator to the list of id's of the elements involved in this list. ***************/ public Iterator getShipmentLineItemsFromClientOrderLineItem(int context) { ArrayList listOfIDs = new ArrayList(); for (ShipmentLineItem obj : ((ClientOrderLineItem) registry .getValue(context)).getShipmentLineItems()) { listOfIDs.add(registry.getKey(obj)); } return listOfIDs.iterator(); } public int getProductFromClientOrderLineItem(int context) { return registry.getKey(((ClientOrderLineItem) registry.getValue(context)) .getProduct()); } public JSONObject getProductFromClientOrderLineItemJSON(int context) throws JSONException { return ((ClientOrderLineItem) registry.getValue(context)).getProduct() .getAttributes(); } public int addShipmentLineItemToClientOrderLineItem(int context, String aNumShipped, int aClientOrderLineItem, int aShipmentToClient) throws Exception { return registry.getKey(((ClientOrderLineItem) registry.getValue(context)) .addShipmentLineItem(aNumShipped, (ClientOrderLineItem) registry .getValue(aClientOrderLineItem), (ShipmentToClient) registry .getValue(aShipmentToClient))); } public JSONObject addShipmentLineItemToClientOrderLineItemJSON(int context, String aNumShipped, int aClientOrderLineItem, int aShipmentToClient) throws JSONException, Exception { return ((ClientOrderLineItem) registry.getValue(context)) .addShipmentLineItem(aNumShipped, (ClientOrderLineItem) registry.getValue(aClientOrderLineItem), (ShipmentToClient) registry.getValue(aShipmentToClient)) .getAttributes(); } public int addShipmentLineItemToClientOrderLineItemOnly(int context, int aShipmentLineItem) throws Exception { return registry.getKey(((ClientOrderLineItem) registry.getValue(context)) .addShipmentLineItem((ShipmentLineItem) registry .getValue(aShipmentLineItem))); } public JSONObject addShipmentLineItemToClientOrderLineItemOnlyJSON( int context, int aShipmentLineItem) throws JSONException, Exception { return ((ClientOrderLineItem) registry.getValue(context)) .addShipmentLineItem( (ShipmentLineItem) registry.getValue(aShipmentLineItem)) .getAttributes(); } public void setOrderFromClientInClientOrderLineItem(int context, int aOrderFromClient) throws Exception { ((ClientOrderLineItem) registry.getValue(context)) .setOrderFromClient((OrderFromClient) registry.getValue(aOrderFromClient)); } public void setProductInClientOrderLineItem(int context, int aProduct) throws Exception { ((ClientOrderLineItem) registry.getValue(context)) .setProduct((Product) registry.getValue(aProduct)); } public void deleteClientOrderLineItem(int context) { ((ClientOrderLineItem) registry.getValue(context)).delete(); registry.removeObj(context); } public void deleteShipmentLineItemFromClientOrderLineItem(int context, int aShipmentLineItem) { ((ClientOrderLineItem) registry.getValue(context)) .deleteShipmentLineItem((ShipmentLineItem) registry .getValue(aShipmentLineItem)); } public JSONObject getAttributesOfClientOrderLineItem(int context) throws JSONException { return ((ClientOrderLineItem) registry.getValue(context)).getAttributes(); } public int constructShipmentLineItem(String aNumShipped, int aClientOrderLineItem, int aShipmentToClient) { return registry.add(new ShipmentLineItem(aNumShipped, (ClientOrderLineItem) registry.getValue(aClientOrderLineItem), (ShipmentToClient) registry.getValue(aShipmentToClient))); } public JSONObject constructShipmentLineItemJSON(String aNumShipped, int aClientOrderLineItem, int aShipmentToClient) throws JSONException { ShipmentLineItem contextObj = new ShipmentLineItem(aNumShipped, (ClientOrderLineItem) registry .getValue(aClientOrderLineItem), (ShipmentToClient) registry .getValue(aShipmentToClient)); registry.add(contextObj); return contextObj.getAttributes(); } public boolean setNumShippedInShipmentLineItem(int context, String aNumShipped) { return ((ShipmentLineItem) registry.getValue(context)) .setNumShipped(aNumShipped); } public String getNumShippedFromShipmentLineItem(int context) { return ((ShipmentLineItem) registry.getValue(context)).getNumShipped(); } public int getClientOrderLineItemFromShipmentLineItem(int context) { return registry.getKey(((ShipmentLineItem) registry.getValue(context)) .getClientOrderLineItem()); } public JSONObject getClientOrderLineItemFromShipmentLineItemJSON(int context) throws JSONException { return ((ShipmentLineItem) registry.getValue(context)) .getClientOrderLineItem().getAttributes(); } public int getShipmentToClientFromShipmentLineItem(int context) { return registry.getKey(((ShipmentLineItem) registry.getValue(context)) .getShipmentToClient()); } public JSONObject getShipmentToClientFromShipmentLineItemJSON(int context) throws JSONException { return ((ShipmentLineItem) registry.getValue(context)) .getShipmentToClient().getAttributes(); } public void setClientOrderLineItemInShipmentLineItem(int context, int aClientOrderLineItem) throws Exception { ((ShipmentLineItem) registry.getValue(context)) .setClientOrderLineItem((ClientOrderLineItem) registry .getValue(aClientOrderLineItem)); } public void setShipmentToClientInShipmentLineItem(int context, int aShipmentToClient) throws Exception { ((ShipmentLineItem) registry.getValue(context)) .setShipmentToClient((ShipmentToClient) registry .getValue(aShipmentToClient)); } public void deleteShipmentLineItem(int context) { ((ShipmentLineItem) registry.getValue(context)).delete(); registry.removeObj(context); } public JSONObject getAttributesOfShipmentLineItem(int context) throws JSONException { return ((ShipmentLineItem) registry.getValue(context)).getAttributes(); } public int constructShipmentToClient(String aDateShipped, String aInvoiceNumber, String aTotalPriceOfShipment, String aAmountPaid, int aClient) { return registry.add(new ShipmentToClient(aDateShipped, aInvoiceNumber, aTotalPriceOfShipment, aAmountPaid, (Client) registry.getValue(aClient))); } public JSONObject constructShipmentToClientJSON(String aDateShipped, String aInvoiceNumber, String aTotalPriceOfShipment, String aAmountPaid, int aClient) throws JSONException { ShipmentToClient contextObj = new ShipmentToClient(aDateShipped, aInvoiceNumber, aTotalPriceOfShipment, aAmountPaid, (Client) registry.getValue(aClient)); registry.add(contextObj); return contextObj.getAttributes(); } public boolean setDateShippedInShipmentToClient(int context, String aDateShipped) { return ((ShipmentToClient) registry.getValue(context)) .setDateShipped(aDateShipped); } public boolean setInvoiceNumberInShipmentToClient(int context, String aInvoiceNumber) { return ((ShipmentToClient) registry.getValue(context)) .setInvoiceNumber(aInvoiceNumber); } public boolean setTotalPriceOfShipmentInShipmentToClient(int context, String aTotalPriceOfShipment) { return ((ShipmentToClient) registry.getValue(context)) .setTotalPriceOfShipment(aTotalPriceOfShipment); } public boolean setAmountPaidInShipmentToClient(int context, String aAmountPaid) { return ((ShipmentToClient) registry.getValue(context)) .setAmountPaid(aAmountPaid); } public String getDateShippedFromShipmentToClient(int context) { return ((ShipmentToClient) registry.getValue(context)).getDateShipped(); } public String getInvoiceNumberFromShipmentToClient(int context) { return ((ShipmentToClient) registry.getValue(context)).getInvoiceNumber(); } public String getTotalPriceOfShipmentFromShipmentToClient(int context) { return ((ShipmentToClient) registry.getValue(context)) .getTotalPriceOfShipment(); } public String getAmountPaidFromShipmentToClient(int context) { return ((ShipmentToClient) registry.getValue(context)).getAmountPaid(); } public int getClientFromShipmentToClient(int context) { return registry.getKey(((ShipmentToClient) registry.getValue(context)) .getClient()); } public JSONObject getClientFromShipmentToClientJSON(int context) throws JSONException { return ((ShipmentToClient) registry.getValue(context)).getClient() .getAttributes(); } /************ * Method returns an iterator to the list of id's of the elements involved in this list. ***************/ public Iterator getShipmentLineItemsFromShipmentToClient(int context) { ArrayList listOfIDs = new ArrayList(); for (ShipmentLineItem obj : ((ShipmentToClient) registry.getValue(context)) .getShipmentLineItems()) { listOfIDs.add(registry.getKey(obj)); } return listOfIDs.iterator(); } public int addShipmentLineItemToShipmentToClient(int context, String aNumShipped, int aClientOrderLineItem, int aShipmentToClient) throws Exception { return registry.getKey(((ShipmentToClient) registry.getValue(context)) .addShipmentLineItem(aNumShipped, (ClientOrderLineItem) registry .getValue(aClientOrderLineItem), (ShipmentToClient) registry .getValue(aShipmentToClient))); } public JSONObject addShipmentLineItemToShipmentToClientJSON(int context, String aNumShipped, int aClientOrderLineItem, int aShipmentToClient) throws JSONException, Exception { return ((ShipmentToClient) registry.getValue(context)).addShipmentLineItem( aNumShipped, (ClientOrderLineItem) registry.getValue(aClientOrderLineItem), (ShipmentToClient) registry.getValue(aShipmentToClient)).getAttributes(); } public int addShipmentLineItemToShipmentToClientOnly(int context, int aShipmentLineItem) throws Exception { return registry.getKey(((ShipmentToClient) registry.getValue(context)) .addShipmentLineItem((ShipmentLineItem) registry .getValue(aShipmentLineItem))); } public JSONObject addShipmentLineItemToShipmentToClientOnlyJSON(int context, int aShipmentLineItem) throws JSONException, Exception { return ((ShipmentToClient) registry.getValue(context)).addShipmentLineItem( (ShipmentLineItem) registry.getValue(aShipmentLineItem)).getAttributes(); } public void setClientInShipmentToClient(int context, int aClient) throws Exception { ((ShipmentToClient) registry.getValue(context)).setClient((Client) registry .getValue(aClient)); } public void deleteShipmentToClient(int context) { ((ShipmentToClient) registry.getValue(context)).delete(); registry.removeObj(context); } public void deleteShipmentLineItemFromShipmentToClient(int context, int aShipmentLineItem) { ((ShipmentToClient) registry.getValue(context)) .deleteShipmentLineItem((ShipmentLineItem) registry .getValue(aShipmentLineItem)); } public JSONObject getAttributesOfShipmentToClient(int context) throws JSONException { return ((ShipmentToClient) registry.getValue(context)).getAttributes(); } public int constructProductCategory(String aName) { return registry.add(new ProductCategory(aName)); } public JSONObject constructProductCategoryJSON(String aName) throws JSONException { ProductCategory contextObj = new ProductCategory(aName); registry.add(contextObj); return contextObj.getAttributes(); } public boolean setNameInProductCategory(int context, String aName) { return ((ProductCategory) registry.getValue(context)).setName(aName); } public String getNameFromProductCategory(int context) { return ((ProductCategory) registry.getValue(context)).getName(); } /************ * Method returns an iterator to the list of id's of the elements involved in this list. ***************/ public Iterator getProductsFromProductCategory(int context) { ArrayList listOfIDs = new ArrayList(); for (Product obj : ((ProductCategory) registry.getValue(context)) .getProducts()) { listOfIDs.add(registry.getKey(obj)); } return listOfIDs.iterator(); } public int addProductToProductCategory(int context, String aOurCode, String aDescription, String aPicture, String aOurListPricePerunit, String aNumberInInventory, String aNumberToKeepInv, int aProductCategory) throws Exception { return registry.getKey(((ProductCategory) registry.getValue(context)) .addProduct(aOurCode, aDescription, aPicture, aOurListPricePerunit, aNumberInInventory, aNumberToKeepInv, (ProductCategory) registry .getValue(aProductCategory))); } public JSONObject addProductToProductCategoryJSON(int context, String aOurCode, String aDescription, String aPicture, String aOurListPricePerunit, String aNumberInInventory, String aNumberToKeepInv, int aProductCategory) throws JSONException, Exception { return ((ProductCategory) registry.getValue(context)).addProduct(aOurCode, aDescription, aPicture, aOurListPricePerunit, aNumberInInventory, aNumberToKeepInv, (ProductCategory) registry.getValue(aProductCategory)) .getAttributes(); } public int addProductToProductCategoryOnly(int context, int aProduct) throws Exception { return registry.getKey(((ProductCategory) registry.getValue(context)) .addProduct((Product) registry.getValue(aProduct))); } public JSONObject addProductToProductCategoryOnlyJSON(int context, int aProduct) throws JSONException, Exception { return ((ProductCategory) registry.getValue(context)).addProduct( (Product) registry.getValue(aProduct)).getAttributes(); } public void deleteProductCategory(int context) { ((ProductCategory) registry.getValue(context)).delete(); registry.removeObj(context); } public void deleteProductFromProductCategory(int context, int aProduct) { ((ProductCategory) registry.getValue(context)) .deleteProduct((Product) registry.getValue(aProduct)); } public JSONObject getAttributesOfProductCategory(int context) throws JSONException { return ((ProductCategory) registry.getValue(context)).getAttributes(); } public int constructClient(String aNumber, String aName, String aAddress, String aPhone, String aCreditLimit) { return registry.add(new Client(aNumber, aName, aAddress, aPhone, aCreditLimit)); } public JSONObject constructClientJSON(String aNumber, String aName, String aAddress, String aPhone, String aCreditLimit) throws JSONException { Client contextObj = new Client(aNumber, aName, aAddress, aPhone, aCreditLimit); registry.add(contextObj); return contextObj.getAttributes(); } public boolean setNumberInClient(int context, String aNumber) { return ((Client) registry.getValue(context)).setNumber(aNumber); } public boolean setNameInClient(int context, String aName) { return ((Client) registry.getValue(context)).setName(aName); } public boolean setAddressInClient(int context, String aAddress) { return ((Client) registry.getValue(context)).setAddress(aAddress); } public boolean setPhoneInClient(int context, String aPhone) { return ((Client) registry.getValue(context)).setPhone(aPhone); } public boolean setCreditLimitInClient(int context, String aCreditLimit) { return ((Client) registry.getValue(context)).setCreditLimit(aCreditLimit); } public String getNumberFromClient(int context) { return ((Client) registry.getValue(context)).getNumber(); } public String getNameFromClient(int context) { return ((Client) registry.getValue(context)).getName(); } public String getAddressFromClient(int context) { return ((Client) registry.getValue(context)).getAddress(); } public String getPhoneFromClient(int context) { return ((Client) registry.getValue(context)).getPhone(); } public String getCreditLimitFromClient(int context) { return ((Client) registry.getValue(context)).getCreditLimit(); } /************ * Method returns an iterator to the list of id's of the elements involved in this list. ***************/ public Iterator getOrderFromClientsFromClient(int context) { ArrayList listOfIDs = new ArrayList(); for (OrderFromClient obj : ((Client) registry.getValue(context)) .getOrderFromClients()) { 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 getShipmentToClientsFromClient(int context) { ArrayList listOfIDs = new ArrayList(); for (ShipmentToClient obj : ((Client) registry.getValue(context)) .getShipmentToClients()) { listOfIDs.add(registry.getKey(obj)); } return listOfIDs.iterator(); } public int addOrderFromClientToClient(int context, String aOurOrderNumber, String aDatePlaced, String aClientsPurchaseOrder, String aCreditCardToCharge, int aClient) throws Exception { return registry.getKey(((Client) registry.getValue(context)) .addOrderFromClient(aOurOrderNumber, aDatePlaced, aClientsPurchaseOrder, aCreditCardToCharge, (Client) registry.getValue(aClient))); } public JSONObject addOrderFromClientToClientJSON(int context, String aOurOrderNumber, String aDatePlaced, String aClientsPurchaseOrder, String aCreditCardToCharge, int aClient) throws JSONException, Exception { return ((Client) registry.getValue(context)).addOrderFromClient( aOurOrderNumber, aDatePlaced, aClientsPurchaseOrder, aCreditCardToCharge, (Client) registry.getValue(aClient)).getAttributes(); } public int addOrderFromClientToClientOnly(int context, int aOrderFromClient) throws Exception { return registry .getKey(((Client) registry.getValue(context)) .addOrderFromClient((OrderFromClient) registry .getValue(aOrderFromClient))); } public JSONObject addOrderFromClientToClientOnlyJSON(int context, int aOrderFromClient) throws JSONException, Exception { return ((Client) registry.getValue(context)).addOrderFromClient( (OrderFromClient) registry.getValue(aOrderFromClient)).getAttributes(); } public int addShipmentToClientToClient(int context, String aDateShipped, String aInvoiceNumber, String aTotalPriceOfShipment, String aAmountPaid, int aClient) throws Exception { return registry.getKey(((Client) registry.getValue(context)) .addShipmentToClient(aDateShipped, aInvoiceNumber, aTotalPriceOfShipment, aAmountPaid, (Client) registry.getValue(aClient))); } public JSONObject addShipmentToClientToClientJSON(int context, String aDateShipped, String aInvoiceNumber, String aTotalPriceOfShipment, String aAmountPaid, int aClient) throws JSONException, Exception { return ((Client) registry.getValue(context)).addShipmentToClient( aDateShipped, aInvoiceNumber, aTotalPriceOfShipment, aAmountPaid, (Client) registry.getValue(aClient)).getAttributes(); } public int addShipmentToClientToClientOnly(int context, int aShipmentToClient) throws Exception { return registry.getKey(((Client) registry.getValue(context)) .addShipmentToClient((ShipmentToClient) registry .getValue(aShipmentToClient))); } public JSONObject addShipmentToClientToClientOnlyJSON(int context, int aShipmentToClient) throws JSONException, Exception { return ((Client) registry.getValue(context)).addShipmentToClient( (ShipmentToClient) registry.getValue(aShipmentToClient)).getAttributes(); } public void deleteClient(int context) { ((Client) registry.getValue(context)).delete(); registry.removeObj(context); } public void deleteOrderFromClientFromClient(int context, int aOrderFromClient) { ((Client) registry.getValue(context)) .deleteOrderFromClient((OrderFromClient) registry .getValue(aOrderFromClient)); } public void deleteShipmentToClientFromClient(int context, int aShipmentToClient) { ((Client) registry.getValue(context)) .deleteShipmentToClient((ShipmentToClient) registry .getValue(aShipmentToClient)); } public JSONObject getAttributesOfClient(int context) throws JSONException { return ((Client) registry.getValue(context)).getAttributes(); } }