/*This code was generated using the UMPLE modeling language!*/ package MFP; import java.sql.Time; import java.sql.Date; import java.util.ArrayList; import java.util.Iterator; import MFP.json.*; import MFP.core.green.*; import MFP.core.red.*; import MFP.core.black.*; import MFP.core.blue.*; public class MFPFacade { // Singleton instance. private static MFPFacade theInstance; //System registry. MFPRegistry registry = MFPRegistry.getInstance(); /** * Dummy constructor */ private MFPFacade() { } /** * Returns the only instance of the Facade. * * @return */ public static MFPFacade getInstance() { if (theInstance == null) theInstance = new MFPFacade(); return theInstance; } public int constructProductRun(String aTimePeriod, String aNumUnits, int aProductType, int aAssemblyLine) { return registry.add(new ProductRun(aTimePeriod, aNumUnits, (ProductType) registry.getValue(aProductType), (AssemblyLine) registry .getValue(aAssemblyLine))); } public JSONObject constructProductRunJSON(String aTimePeriod, String aNumUnits, int aProductType, int aAssemblyLine) throws JSONException { ProductRun contextObj = new ProductRun(aTimePeriod, aNumUnits, (ProductType) registry .getValue(aProductType), (AssemblyLine) registry .getValue(aAssemblyLine)); registry.add(contextObj); return contextObj.getAttributes(); } public boolean setTimePeriodInProductRun(int context, String aTimePeriod) { return ((ProductRun) registry.getValue(context)).setTimePeriod(aTimePeriod); } public boolean setNumUnitsInProductRun(int context, String aNumUnits) { return ((ProductRun) registry.getValue(context)).setNumUnits(aNumUnits); } public String getTimePeriodFromProductRun(int context) { return ((ProductRun) registry.getValue(context)).getTimePeriod(); } public String getNumUnitsFromProductRun(int context) { return ((ProductRun) registry.getValue(context)).getNumUnits(); } public int getProductTypeFromProductRun(int context) { return registry.getKey(((ProductRun) registry.getValue(context)) .getProductType()); } public JSONObject getProductTypeFromProductRunJSON(int context) throws JSONException { return ((ProductRun) registry.getValue(context)).getProductType() .getAttributes(); } public int getAssemblyLineFromProductRun(int context) { return registry.getKey(((ProductRun) registry.getValue(context)) .getAssemblyLine()); } public JSONObject getAssemblyLineFromProductRunJSON(int context) throws JSONException { return ((ProductRun) registry.getValue(context)).getAssemblyLine() .getAttributes(); } /************ * Method returns an iterator to the list of id's of the elements involved in this list. ***************/ public Iterator getProductsFromProductRun(int context) { ArrayList listOfIDs = new ArrayList(); for (Product obj : ((ProductRun) registry.getValue(context)).getProducts()) { listOfIDs.add(registry.getKey(obj)); } return listOfIDs.iterator(); } public int addProductToProductRun(int context, String aSerialNumber, int aProduct, int aProductType, int aOrderLineItem) throws Exception { return registry.getKey(((ProductRun) registry.getValue(context)) .addProduct(aSerialNumber, (Product) registry.getValue(aProduct), (ProductType) registry.getValue(aProductType), (OrderLineItem) registry .getValue(aOrderLineItem))); } public JSONObject addProductToProductRunJSON(int context, String aSerialNumber, int aProduct, int aProductType, int aOrderLineItem) throws JSONException, Exception { return ((ProductRun) registry.getValue(context)).addProduct(aSerialNumber, (Product) registry.getValue(aProduct), (ProductType) registry.getValue(aProductType), (OrderLineItem) registry.getValue(aOrderLineItem)).getAttributes(); } public int addProductToProductRunOnly(int context, int aProduct) throws Exception { return registry.getKey(((ProductRun) registry.getValue(context)) .addProduct((Product) registry.getValue(aProduct))); } public JSONObject addProductToProductRunOnlyJSON(int context, int aProduct) throws JSONException, Exception { return ((ProductRun) registry.getValue(context)).addProduct( (Product) registry.getValue(aProduct)).getAttributes(); } public void setProductTypeInProductRun(int context, int aProductType) throws Exception { ((ProductRun) registry.getValue(context)) .setProductType((ProductType) registry.getValue(aProductType)); } public void setAssemblyLineInProductRun(int context, int aAssemblyLine) throws Exception { ((ProductRun) registry.getValue(context)) .setAssemblyLine((AssemblyLine) registry.getValue(aAssemblyLine)); } public void deleteProductRun(int context) { ((ProductRun) registry.getValue(context)).delete(); registry.removeObj(context); } public void deleteProductFromProductRun(int context, int aProduct) { ((ProductRun) registry.getValue(context)).deleteProduct((Product) registry .getValue(aProduct)); } public JSONObject getAttributesOfProductRun(int context) throws JSONException { return ((ProductRun) registry.getValue(context)).getAttributes(); } public int constructBin(String aNumber, int aProductType) { return registry.add(new Bin(aNumber, (ProductType) registry .getValue(aProductType))); } public JSONObject constructBinJSON(String aNumber, int aProductType) throws JSONException { Bin contextObj = new Bin(aNumber, (ProductType) registry.getValue(aProductType)); registry.add(contextObj); return contextObj.getAttributes(); } public boolean setNumberInBin(int context, String aNumber) { return ((Bin) registry.getValue(context)).setNumber(aNumber); } public String getNumberFromBin(int context) { return ((Bin) registry.getValue(context)).getNumber(); } public int getProductTypeFromBin(int context) { return registry.getKey(((Bin) registry.getValue(context)).getProductType()); } public JSONObject getProductTypeFromBinJSON(int context) throws JSONException { return ((Bin) registry.getValue(context)).getProductType().getAttributes(); } public void setProductTypeInBin(int context, int aProductType) throws Exception { ((Bin) registry.getValue(context)).setProductType((ProductType) registry .getValue(aProductType)); } public void deleteBin(int context) { ((Bin) registry.getValue(context)).delete(); registry.removeObj(context); } public JSONObject getAttributesOfBin(int context) throws JSONException { return ((Bin) registry.getValue(context)).getAttributes(); } public int constructRobot(String aNumber) { return registry.add(new Robot(aNumber)); } public JSONObject constructRobotJSON(String aNumber) throws JSONException { Robot contextObj = new Robot(aNumber); registry.add(contextObj); return contextObj.getAttributes(); } public boolean setNumberInRobot(int context, String aNumber) { return ((Robot) registry.getValue(context)).setNumber(aNumber); } public String getNumberFromRobot(int context) { return ((Robot) registry.getValue(context)).getNumber(); } /************ * Method returns an iterator to the list of id's of the elements involved in this list. ***************/ public Iterator getRobotAllocationsFromRobot(int context) { ArrayList listOfIDs = new ArrayList(); for (RobotAllocation obj : ((Robot) registry.getValue(context)) .getRobotAllocations()) { listOfIDs.add(registry.getKey(obj)); } return listOfIDs.iterator(); } public int addRobotAllocationToRobot(int context, String aTimePeriod, int aAssemblyStep, int aRobot) throws Exception { return registry.getKey(((Robot) registry.getValue(context)) .addRobotAllocation(aTimePeriod, (AssemblyStep) registry .getValue(aAssemblyStep), (Robot) registry.getValue(aRobot))); } public JSONObject addRobotAllocationToRobotJSON(int context, String aTimePeriod, int aAssemblyStep, int aRobot) throws JSONException, Exception { return ((Robot) registry.getValue(context)).addRobotAllocation(aTimePeriod, (AssemblyStep) registry.getValue(aAssemblyStep), (Robot) registry.getValue(aRobot)).getAttributes(); } public int addRobotAllocationToRobotOnly(int context, int aRobotAllocation) throws Exception { return registry .getKey(((Robot) registry.getValue(context)) .addRobotAllocation((RobotAllocation) registry .getValue(aRobotAllocation))); } public JSONObject addRobotAllocationToRobotOnlyJSON(int context, int aRobotAllocation) throws JSONException, Exception { return ((Robot) registry.getValue(context)).addRobotAllocation( (RobotAllocation) registry.getValue(aRobotAllocation)).getAttributes(); } public void deleteRobot(int context) { ((Robot) registry.getValue(context)).delete(); registry.removeObj(context); } public void deleteRobotAllocationFromRobot(int context, int aRobotAllocation) { ((Robot) registry.getValue(context)) .deleteRobotAllocation((RobotAllocation) registry .getValue(aRobotAllocation)); } public JSONObject getAttributesOfRobot(int context) throws JSONException { return ((Robot) registry.getValue(context)).getAttributes(); } public int constructAssemblyStep(String aDescription, int aProductType) { return registry.add(new AssemblyStep(aDescription, (ProductType) registry .getValue(aProductType))); } public JSONObject constructAssemblyStepJSON(String aDescription, int aProductType) throws JSONException { AssemblyStep contextObj = new AssemblyStep(aDescription, (ProductType) registry .getValue(aProductType)); registry.add(contextObj); return contextObj.getAttributes(); } public boolean setDescriptionInAssemblyStep(int context, String aDescription) { return ((AssemblyStep) registry.getValue(context)) .setDescription(aDescription); } public String getDescriptionFromAssemblyStep(int context) { return ((AssemblyStep) registry.getValue(context)).getDescription(); } /************ * Method returns an iterator to the list of id's of the elements involved in this list. ***************/ public Iterator getBillOfMaterialsLineItemsFromAssemblyStep(int context) { ArrayList listOfIDs = new ArrayList(); for (BillOfMaterialsLineItem obj : ((AssemblyStep) registry .getValue(context)).getBillOfMaterialsLineItems()) { 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 getRobotAllocationsFromAssemblyStep(int context) { ArrayList listOfIDs = new ArrayList(); for (RobotAllocation obj : ((AssemblyStep) registry.getValue(context)) .getRobotAllocations()) { listOfIDs.add(registry.getKey(obj)); } return listOfIDs.iterator(); } public int getProductTypeFromAssemblyStep(int context) { return registry.getKey(((AssemblyStep) registry.getValue(context)) .getProductType()); } public JSONObject getProductTypeFromAssemblyStepJSON(int context) throws JSONException { return ((AssemblyStep) registry.getValue(context)).getProductType() .getAttributes(); } public int addBillOfMaterialsLineItemToAssemblyStep(int context, String aNumberRequired, int aProductType, int aConsistsOf, int aAssemblyStep) throws Exception { return registry.getKey(((AssemblyStep) registry.getValue(context)) .addBillOfMaterialsLineItem(aNumberRequired, (ProductType) registry .getValue(aProductType), (ProductType) registry.getValue(aConsistsOf), (AssemblyStep) registry.getValue(aAssemblyStep))); } public JSONObject addBillOfMaterialsLineItemToAssemblyStepJSON(int context, String aNumberRequired, int aProductType, int aConsistsOf, int aAssemblyStep) throws JSONException, Exception { return ((AssemblyStep) registry.getValue(context)) .addBillOfMaterialsLineItem(aNumberRequired, (ProductType) registry.getValue(aProductType), (ProductType) registry.getValue(aConsistsOf), (AssemblyStep) registry.getValue(aAssemblyStep)).getAttributes(); } public int addBillOfMaterialsLineItemToAssemblyStepOnly(int context, int aBillOfMaterialsLineItem) throws Exception { return registry.getKey(((AssemblyStep) registry.getValue(context)) .addBillOfMaterialsLineItem((BillOfMaterialsLineItem) registry .getValue(aBillOfMaterialsLineItem))); } public JSONObject addBillOfMaterialsLineItemToAssemblyStepOnlyJSON( int context, int aBillOfMaterialsLineItem) throws JSONException, Exception { return ((AssemblyStep) registry.getValue(context)) .addBillOfMaterialsLineItem( (BillOfMaterialsLineItem) registry.getValue(aBillOfMaterialsLineItem)) .getAttributes(); } public int addRobotAllocationToAssemblyStep(int context, String aTimePeriod, int aAssemblyStep, int aRobot) throws Exception { return registry.getKey(((AssemblyStep) registry.getValue(context)) .addRobotAllocation(aTimePeriod, (AssemblyStep) registry .getValue(aAssemblyStep), (Robot) registry.getValue(aRobot))); } public JSONObject addRobotAllocationToAssemblyStepJSON(int context, String aTimePeriod, int aAssemblyStep, int aRobot) throws JSONException, Exception { return ((AssemblyStep) registry.getValue(context)).addRobotAllocation( aTimePeriod, (AssemblyStep) registry.getValue(aAssemblyStep), (Robot) registry.getValue(aRobot)).getAttributes(); } public int addRobotAllocationToAssemblyStepOnly(int context, int aRobotAllocation) throws Exception { return registry .getKey(((AssemblyStep) registry.getValue(context)) .addRobotAllocation((RobotAllocation) registry .getValue(aRobotAllocation))); } public JSONObject addRobotAllocationToAssemblyStepOnlyJSON(int context, int aRobotAllocation) throws JSONException, Exception { return ((AssemblyStep) registry.getValue(context)).addRobotAllocation( (RobotAllocation) registry.getValue(aRobotAllocation)).getAttributes(); } public void setProductTypeInAssemblyStep(int context, int aProductType) throws Exception { ((AssemblyStep) registry.getValue(context)) .setProductType((ProductType) registry.getValue(aProductType)); } public void deleteAssemblyStep(int context) { ((AssemblyStep) registry.getValue(context)).delete(); registry.removeObj(context); } public void deleteBillOfMaterialsLineItemFromAssemblyStep(int context, int aBillOfMaterialsLineItem) { ((AssemblyStep) registry.getValue(context)) .deleteBillOfMaterialsLineItem((BillOfMaterialsLineItem) registry .getValue(aBillOfMaterialsLineItem)); } public void deleteRobotAllocationFromAssemblyStep(int context, int aRobotAllocation) { ((AssemblyStep) registry.getValue(context)) .deleteRobotAllocation((RobotAllocation) registry .getValue(aRobotAllocation)); } public JSONObject getAttributesOfAssemblyStep(int context) throws JSONException { return ((AssemblyStep) registry.getValue(context)).getAttributes(); } public int constructSupplier(String aName) { return registry.add(new Supplier(aName)); } public JSONObject constructSupplierJSON(String aName) throws JSONException { Supplier contextObj = new Supplier(aName); registry.add(contextObj); return contextObj.getAttributes(); } public boolean setNameInSupplier(int context, String aName) { return ((Supplier) registry.getValue(context)).setName(aName); } public String getNameFromSupplier(int context) { return ((Supplier) registry.getValue(context)).getName(); } /************ * Method returns an iterator to the list of id's of the elements involved in this list. ***************/ public Iterator getProductTypesFromSupplier(int context) { ArrayList listOfIDs = new ArrayList(); for (ProductType obj : ((Supplier) registry.getValue(context)) .getProductTypes()) { 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 getProductsFromSupplier(int context) { ArrayList listOfIDs = new ArrayList(); for (Product obj : ((Supplier) registry.getValue(context)).getProducts()) { listOfIDs.add(registry.getKey(obj)); } return listOfIDs.iterator(); } public int addProductTypeToSupplier(int context, String aDescription) throws Exception { return registry.getKey(((Supplier) registry.getValue(context)) .addProductType(aDescription)); } public JSONObject addProductTypeToSupplierJSON(int context, String aDescription) throws JSONException, Exception { return ((Supplier) registry.getValue(context)).addProductType(aDescription) .getAttributes(); } public int addProductTypeToSupplierOnly(int context, int aProductType) throws Exception { return registry.getKey(((Supplier) registry.getValue(context)) .addProductType((ProductType) registry.getValue(aProductType))); } public JSONObject addProductTypeToSupplierOnlyJSON(int context, int aProductType) throws JSONException, Exception { return ((Supplier) registry.getValue(context)).addProductType( (ProductType) registry.getValue(aProductType)).getAttributes(); } public int addProductToSupplier(int context, String aSerialNumber, int aProduct, int aProductType, int aOrderLineItem) throws Exception { return registry.getKey(((Supplier) registry.getValue(context)).addProduct( aSerialNumber, (Product) registry.getValue(aProduct), (ProductType) registry.getValue(aProductType), (OrderLineItem) registry .getValue(aOrderLineItem))); } public JSONObject addProductToSupplierJSON(int context, String aSerialNumber, int aProduct, int aProductType, int aOrderLineItem) throws JSONException, Exception { return ((Supplier) registry.getValue(context)).addProduct(aSerialNumber, (Product) registry.getValue(aProduct), (ProductType) registry.getValue(aProductType), (OrderLineItem) registry.getValue(aOrderLineItem)).getAttributes(); } public int addProductToSupplierOnly(int context, int aProduct) throws Exception { return registry.getKey(((Supplier) registry.getValue(context)) .addProduct((Product) registry.getValue(aProduct))); } public JSONObject addProductToSupplierOnlyJSON(int context, int aProduct) throws JSONException, Exception { return ((Supplier) registry.getValue(context)).addProduct( (Product) registry.getValue(aProduct)).getAttributes(); } public void deleteSupplier(int context) { ((Supplier) registry.getValue(context)).delete(); registry.removeObj(context); } public void deleteProductTypeFromSupplier(int context, int aProductType) { ((Supplier) registry.getValue(context)) .deleteProductType((ProductType) registry.getValue(aProductType)); } public void deleteProductFromSupplier(int context, int aProduct) { ((Supplier) registry.getValue(context)).deleteProduct((Product) registry .getValue(aProduct)); } public JSONObject getAttributesOfSupplier(int context) throws JSONException { return ((Supplier) registry.getValue(context)).getAttributes(); } public int constructProduct(String aSerialNumber, int aProduct, int aProductType, int aOrderLineItem) { return registry.add(new Product(aSerialNumber, (Product) registry .getValue(aProduct), (ProductType) registry.getValue(aProductType), (OrderLineItem) registry.getValue(aOrderLineItem))); } public JSONObject constructProductJSON(String aSerialNumber, int aProduct, int aProductType, int aOrderLineItem) throws JSONException { Product contextObj = new Product(aSerialNumber, (Product) registry.getValue(aProduct), (ProductType) registry.getValue(aProductType), (OrderLineItem) registry .getValue(aOrderLineItem)); registry.add(contextObj); return contextObj.getAttributes(); } public boolean setSerialNumberInProduct(int context, String aSerialNumber) { return ((Product) registry.getValue(context)) .setSerialNumber(aSerialNumber); } public String getSerialNumberFromProduct(int context) { return ((Product) registry.getValue(context)).getSerialNumber(); } public int getSupplierFromProduct(int context) { return registry .getKey(((Product) registry.getValue(context)).getSupplier()); } public JSONObject getSupplierFromProductJSON(int context) throws JSONException { return ((Product) registry.getValue(context)).getSupplier().getAttributes(); } /************ * Method returns an iterator to the list of id's of the elements involved in this list. ***************/ public Iterator getProductsFromProduct(int context) { ArrayList listOfIDs = new ArrayList(); for (Product obj : ((Product) registry.getValue(context)).getProducts()) { listOfIDs.add(registry.getKey(obj)); } return listOfIDs.iterator(); } public int getProductFromProduct(int context) { return registry.getKey(((Product) registry.getValue(context)).getProduct()); } public JSONObject getProductFromProductJSON(int context) throws JSONException { return ((Product) registry.getValue(context)).getProduct().getAttributes(); } public int getProductTypeFromProduct(int context) { return registry.getKey(((Product) registry.getValue(context)) .getProductType()); } public JSONObject getProductTypeFromProductJSON(int context) throws JSONException { return ((Product) registry.getValue(context)).getProductType() .getAttributes(); } public int getProductRunFromProduct(int context) { return registry.getKey(((Product) registry.getValue(context)) .getProductRun()); } public JSONObject getProductRunFromProductJSON(int context) throws JSONException { return ((Product) registry.getValue(context)).getProductRun() .getAttributes(); } public int getOrderLineItemFromProduct(int context) { return registry.getKey(((Product) registry.getValue(context)) .getOrderLineItem()); } public JSONObject getOrderLineItemFromProductJSON(int context) throws JSONException { return ((Product) registry.getValue(context)).getOrderLineItem() .getAttributes(); } public int addProductToProduct(int context, String aSerialNumber, int aProduct, int aProductType, int aOrderLineItem) throws Exception { return registry.getKey(((Product) registry.getValue(context)).addProduct( aSerialNumber, (Product) registry.getValue(aProduct), (ProductType) registry.getValue(aProductType), (OrderLineItem) registry .getValue(aOrderLineItem))); } public JSONObject addProductToProductJSON(int context, String aSerialNumber, int aProduct, int aProductType, int aOrderLineItem) throws JSONException, Exception { return ((Product) registry.getValue(context)).addProduct(aSerialNumber, (Product) registry.getValue(aProduct), (ProductType) registry.getValue(aProductType), (OrderLineItem) registry.getValue(aOrderLineItem)).getAttributes(); } public int addProductToProductOnly(int context, int aProduct) throws Exception { return registry.getKey(((Product) registry.getValue(context)) .addProduct((Product) registry.getValue(aProduct))); } public JSONObject addProductToProductOnlyJSON(int context, int aProduct) throws JSONException, Exception { return ((Product) registry.getValue(context)).addProduct( (Product) registry.getValue(aProduct)).getAttributes(); } public void setSupplierInProduct(int context, int aSupplier) throws Exception { ((Product) registry.getValue(context)).setSupplier((Supplier) registry .getValue(aSupplier)); } public void setProductInProduct(int context, int aProduct) throws Exception { ((Product) registry.getValue(context)).setProduct((Product) registry .getValue(aProduct)); } public void setProductTypeInProduct(int context, int aProductType) throws Exception { ((Product) registry.getValue(context)) .setProductType((ProductType) registry.getValue(aProductType)); } public void setProductRunInProduct(int context, int aProductRun) throws Exception { ((Product) registry.getValue(context)).setProductRun((ProductRun) registry .getValue(aProductRun)); } public void setOrderLineItemInProduct(int context, int aOrderLineItem) throws Exception { ((Product) registry.getValue(context)) .setOrderLineItem((OrderLineItem) registry.getValue(aOrderLineItem)); } public void deleteProduct(int context) { ((Product) registry.getValue(context)).delete(); registry.removeObj(context); } public void deleteSupplierFromProduct(int context, int aSupplier) { ((Product) registry.getValue(context)).deleteSupplier((Supplier) registry .getValue(aSupplier)); } public void deleteProductFromProduct(int context, int aProduct) { ((Product) registry.getValue(context)).deleteProduct((Product) registry .getValue(aProduct)); } public void deleteProductRunFromProduct(int context, int aProductRun) { ((Product) registry.getValue(context)) .deleteProductRun((ProductRun) registry.getValue(aProductRun)); } public JSONObject getAttributesOfProduct(int context) throws JSONException { return ((Product) registry.getValue(context)).getAttributes(); } public int constructProductType(String aDescription) { return registry.add(new ProductType(aDescription)); } public JSONObject constructProductTypeJSON(String aDescription) throws JSONException { ProductType contextObj = new ProductType(aDescription); registry.add(contextObj); return contextObj.getAttributes(); } public boolean setDescriptionInProductType(int context, String aDescription) { return ((ProductType) registry.getValue(context)) .setDescription(aDescription); } public String getDescriptionFromProductType(int context) { return ((ProductType) registry.getValue(context)).getDescription(); } /************ * Method returns an iterator to the list of id's of the elements involved in this list. ***************/ public Iterator getOtherLineItemssFromProductType(int context) { ArrayList listOfIDs = new ArrayList(); for (BillOfMaterialsLineItem obj : ((ProductType) registry .getValue(context)).getOtherLineItemss()) { 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 getLineItemsMakeUpsFromProductType(int context) { ArrayList listOfIDs = new ArrayList(); for (BillOfMaterialsLineItem obj : ((ProductType) registry .getValue(context)).getLineItemsMakeUps()) { 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 getSuppliersFromProductType(int context) { ArrayList listOfIDs = new ArrayList(); for (Supplier obj : ((ProductType) registry.getValue(context)) .getSuppliers()) { 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 getAssemblyStepsFromProductType(int context) { ArrayList listOfIDs = new ArrayList(); for (AssemblyStep obj : ((ProductType) registry.getValue(context)) .getAssemblySteps()) { 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 getKeptInsFromProductType(int context) { ArrayList listOfIDs = new ArrayList(); for (Bin obj : ((ProductType) registry.getValue(context)).getKeptIns()) { 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 getProductsFromProductType(int context) { ArrayList listOfIDs = new ArrayList(); for (Product obj : ((ProductType) registry.getValue(context)).getProducts()) { 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 getProductRunsFromProductType(int context) { ArrayList listOfIDs = new ArrayList(); for (ProductRun obj : ((ProductType) registry.getValue(context)) .getProductRuns()) { listOfIDs.add(registry.getKey(obj)); } return listOfIDs.iterator(); } public int addOtherLineItemsToProductType(int context, String aNumberRequired, int aProductType, int aConsistsOf, int aAssemblyStep) throws Exception { return registry.getKey(((ProductType) registry.getValue(context)) .addOtherLineItems(aNumberRequired, (ProductType) registry .getValue(aProductType), (ProductType) registry.getValue(aConsistsOf), (AssemblyStep) registry.getValue(aAssemblyStep))); } public JSONObject addOtherLineItemsToProductTypeJSON(int context, String aNumberRequired, int aProductType, int aConsistsOf, int aAssemblyStep) throws JSONException, Exception { return ((ProductType) registry.getValue(context)).addOtherLineItems( aNumberRequired, (ProductType) registry.getValue(aProductType), (ProductType) registry.getValue(aConsistsOf), (AssemblyStep) registry.getValue(aAssemblyStep)).getAttributes(); } public int addOtherLineItemsToProductTypeOnly(int context, int aOtherLineItems) throws Exception { return registry.getKey(((ProductType) registry.getValue(context)) .addOtherLineItems((BillOfMaterialsLineItem) registry .getValue(aOtherLineItems))); } public JSONObject addOtherLineItemsToProductTypeOnlyJSON(int context, int aOtherLineItems) throws JSONException, Exception { return ((ProductType) registry.getValue(context)).addOtherLineItems( (BillOfMaterialsLineItem) registry.getValue(aOtherLineItems)) .getAttributes(); } public int addLineItemsMakeUpToProductType(int context, String aNumberRequired, int aProductType, int aConsistsOf, int aAssemblyStep) throws Exception { return registry.getKey(((ProductType) registry.getValue(context)) .addLineItemsMakeUp(aNumberRequired, (ProductType) registry .getValue(aProductType), (ProductType) registry.getValue(aConsistsOf), (AssemblyStep) registry.getValue(aAssemblyStep))); } public JSONObject addLineItemsMakeUpToProductTypeJSON(int context, String aNumberRequired, int aProductType, int aConsistsOf, int aAssemblyStep) throws JSONException, Exception { return ((ProductType) registry.getValue(context)).addLineItemsMakeUp( aNumberRequired, (ProductType) registry.getValue(aProductType), (ProductType) registry.getValue(aConsistsOf), (AssemblyStep) registry.getValue(aAssemblyStep)).getAttributes(); } public int addLineItemsMakeUpToProductTypeOnly(int context, int aLineItemsMakeUp) throws Exception { return registry.getKey(((ProductType) registry.getValue(context)) .addLineItemsMakeUp((BillOfMaterialsLineItem) registry .getValue(aLineItemsMakeUp))); } public JSONObject addLineItemsMakeUpToProductTypeOnlyJSON(int context, int aLineItemsMakeUp) throws JSONException, Exception { return ((ProductType) registry.getValue(context)).addLineItemsMakeUp( (BillOfMaterialsLineItem) registry.getValue(aLineItemsMakeUp)) .getAttributes(); } public int addSupplierToProductType(int context, String aName) throws Exception { return registry.getKey(((ProductType) registry.getValue(context)) .addSupplier(aName)); } public JSONObject addSupplierToProductTypeJSON(int context, String aName) throws JSONException, Exception { return ((ProductType) registry.getValue(context)).addSupplier(aName) .getAttributes(); } public int addSupplierToProductTypeOnly(int context, int aSupplier) throws Exception { return registry.getKey(((ProductType) registry.getValue(context)) .addSupplier((Supplier) registry.getValue(aSupplier))); } public JSONObject addSupplierToProductTypeOnlyJSON(int context, int aSupplier) throws JSONException, Exception { return ((ProductType) registry.getValue(context)).addSupplier( (Supplier) registry.getValue(aSupplier)).getAttributes(); } public int addAssemblyStepToProductType(int context, String aDescription, int aProductType) throws Exception { return registry.getKey(((ProductType) registry.getValue(context)) .addAssemblyStep(aDescription, (ProductType) registry .getValue(aProductType))); } public JSONObject addAssemblyStepToProductTypeJSON(int context, String aDescription, int aProductType) throws JSONException, Exception { return ((ProductType) registry.getValue(context)).addAssemblyStep( aDescription, (ProductType) registry.getValue(aProductType)) .getAttributes(); } public int addAssemblyStepToProductTypeOnly(int context, int aAssemblyStep) throws Exception { return registry.getKey(((ProductType) registry.getValue(context)) .addAssemblyStep((AssemblyStep) registry.getValue(aAssemblyStep))); } public JSONObject addAssemblyStepToProductTypeOnlyJSON(int context, int aAssemblyStep) throws JSONException, Exception { return ((ProductType) registry.getValue(context)).addAssemblyStep( (AssemblyStep) registry.getValue(aAssemblyStep)).getAttributes(); } public int addKeptInToProductType(int context, String aNumber, int aProductType) throws Exception { return registry.getKey(((ProductType) registry.getValue(context)) .addKeptIn(aNumber, (ProductType) registry.getValue(aProductType))); } public JSONObject addKeptInToProductTypeJSON(int context, String aNumber, int aProductType) throws JSONException, Exception { return ((ProductType) registry.getValue(context)).addKeptIn(aNumber, (ProductType) registry.getValue(aProductType)).getAttributes(); } public int addKeptInToProductTypeOnly(int context, int aKeptIn) throws Exception { return registry.getKey(((ProductType) registry.getValue(context)) .addKeptIn((Bin) registry.getValue(aKeptIn))); } public JSONObject addKeptInToProductTypeOnlyJSON(int context, int aKeptIn) throws JSONException, Exception { return ((ProductType) registry.getValue(context)).addKeptIn( (Bin) registry.getValue(aKeptIn)).getAttributes(); } public int addProductToProductType(int context, String aSerialNumber, int aProduct, int aProductType, int aOrderLineItem) throws Exception { return registry.getKey(((ProductType) registry.getValue(context)) .addProduct(aSerialNumber, (Product) registry.getValue(aProduct), (ProductType) registry.getValue(aProductType), (OrderLineItem) registry .getValue(aOrderLineItem))); } public JSONObject addProductToProductTypeJSON(int context, String aSerialNumber, int aProduct, int aProductType, int aOrderLineItem) throws JSONException, Exception { return ((ProductType) registry.getValue(context)).addProduct(aSerialNumber, (Product) registry.getValue(aProduct), (ProductType) registry.getValue(aProductType), (OrderLineItem) registry.getValue(aOrderLineItem)).getAttributes(); } public int addProductToProductTypeOnly(int context, int aProduct) throws Exception { return registry.getKey(((ProductType) registry.getValue(context)) .addProduct((Product) registry.getValue(aProduct))); } public JSONObject addProductToProductTypeOnlyJSON(int context, int aProduct) throws JSONException, Exception { return ((ProductType) registry.getValue(context)).addProduct( (Product) registry.getValue(aProduct)).getAttributes(); } public int addProductRunToProductType(int context, String aTimePeriod, String aNumUnits, int aProductType, int aAssemblyLine) throws Exception { return registry.getKey(((ProductType) registry.getValue(context)) .addProductRun(aTimePeriod, aNumUnits, (ProductType) registry .getValue(aProductType), (AssemblyLine) registry .getValue(aAssemblyLine))); } public JSONObject addProductRunToProductTypeJSON(int context, String aTimePeriod, String aNumUnits, int aProductType, int aAssemblyLine) throws JSONException, Exception { return ((ProductType) registry.getValue(context)).addProductRun( aTimePeriod, aNumUnits, (ProductType) registry.getValue(aProductType), (AssemblyLine) registry.getValue(aAssemblyLine)).getAttributes(); } public int addProductRunToProductTypeOnly(int context, int aProductRun) throws Exception { return registry.getKey(((ProductType) registry.getValue(context)) .addProductRun((ProductRun) registry.getValue(aProductRun))); } public JSONObject addProductRunToProductTypeOnlyJSON(int context, int aProductRun) throws JSONException, Exception { return ((ProductType) registry.getValue(context)).addProductRun( (ProductRun) registry.getValue(aProductRun)).getAttributes(); } public void deleteProductType(int context) { ((ProductType) registry.getValue(context)).delete(); registry.removeObj(context); } public void deleteOtherLineItemsFromProductType(int context, int aBillOfMaterialsLineItem) { ((ProductType) registry.getValue(context)) .deleteOtherLineItems((BillOfMaterialsLineItem) registry .getValue(aBillOfMaterialsLineItem)); } public void deleteLineItemsMakeUpFromProductType(int context, int aBillOfMaterialsLineItem) { ((ProductType) registry.getValue(context)) .deleteLineItemsMakeUp((BillOfMaterialsLineItem) registry .getValue(aBillOfMaterialsLineItem)); } public void deleteSupplierFromProductType(int context, int aSupplier) { ((ProductType) registry.getValue(context)) .deleteSupplier((Supplier) registry.getValue(aSupplier)); } public void deleteAssemblyStepFromProductType(int context, int aAssemblyStep) { ((ProductType) registry.getValue(context)) .deleteAssemblyStep((AssemblyStep) registry.getValue(aAssemblyStep)); } public void deleteKeptInFromProductType(int context, int aBin) { ((ProductType) registry.getValue(context)).deleteKeptIn((Bin) registry .getValue(aBin)); } public void deleteProductFromProductType(int context, int aProduct) { ((ProductType) registry.getValue(context)).deleteProduct((Product) registry .getValue(aProduct)); } public void deleteProductRunFromProductType(int context, int aProductRun) { ((ProductType) registry.getValue(context)) .deleteProductRun((ProductRun) registry.getValue(aProductRun)); } public JSONObject getAttributesOfProductType(int context) throws JSONException { return ((ProductType) registry.getValue(context)).getAttributes(); } public int constructRobotAllocation(String aTimePeriod, int aAssemblyStep, int aRobot) { return registry.add(new RobotAllocation(aTimePeriod, (AssemblyStep) registry.getValue(aAssemblyStep), (Robot) registry .getValue(aRobot))); } public JSONObject constructRobotAllocationJSON(String aTimePeriod, int aAssemblyStep, int aRobot) throws JSONException { RobotAllocation contextObj = new RobotAllocation(aTimePeriod, (AssemblyStep) registry .getValue(aAssemblyStep), (Robot) registry.getValue(aRobot)); registry.add(contextObj); return contextObj.getAttributes(); } public boolean setTimePeriodInRobotAllocation(int context, String aTimePeriod) { return ((RobotAllocation) registry.getValue(context)) .setTimePeriod(aTimePeriod); } public String getTimePeriodFromRobotAllocation(int context) { return ((RobotAllocation) registry.getValue(context)).getTimePeriod(); } public int getAssemblyStepFromRobotAllocation(int context) { return registry.getKey(((RobotAllocation) registry.getValue(context)) .getAssemblyStep()); } public JSONObject getAssemblyStepFromRobotAllocationJSON(int context) throws JSONException { return ((RobotAllocation) registry.getValue(context)).getAssemblyStep() .getAttributes(); } public int getRobotFromRobotAllocation(int context) { return registry.getKey(((RobotAllocation) registry.getValue(context)) .getRobot()); } public JSONObject getRobotFromRobotAllocationJSON(int context) throws JSONException { return ((RobotAllocation) registry.getValue(context)).getRobot() .getAttributes(); } public void setAssemblyStepInRobotAllocation(int context, int aAssemblyStep) throws Exception { ((RobotAllocation) registry.getValue(context)) .setAssemblyStep((AssemblyStep) registry.getValue(aAssemblyStep)); } public void setRobotInRobotAllocation(int context, int aRobot) throws Exception { ((RobotAllocation) registry.getValue(context)).setRobot((Robot) registry .getValue(aRobot)); } public void deleteRobotAllocation(int context) { ((RobotAllocation) registry.getValue(context)).delete(); registry.removeObj(context); } public JSONObject getAttributesOfRobotAllocation(int context) throws JSONException { return ((RobotAllocation) registry.getValue(context)).getAttributes(); } public int constructBillOfMaterialsLineItem(String aNumberRequired, int aProductType, int aConsistsOf, int aAssemblyStep) { return registry .add(new BillOfMaterialsLineItem(aNumberRequired, (ProductType) registry .getValue(aProductType), (ProductType) registry.getValue(aConsistsOf), (AssemblyStep) registry.getValue(aAssemblyStep))); } public JSONObject constructBillOfMaterialsLineItemJSON( String aNumberRequired, int aProductType, int aConsistsOf, int aAssemblyStep) throws JSONException { BillOfMaterialsLineItem contextObj = new BillOfMaterialsLineItem(aNumberRequired, (ProductType) registry .getValue(aProductType), (ProductType) registry.getValue(aConsistsOf), (AssemblyStep) registry.getValue(aAssemblyStep)); registry.add(contextObj); return contextObj.getAttributes(); } public boolean setNumberRequiredInBillOfMaterialsLineItem(int context, String aNumberRequired) { return ((BillOfMaterialsLineItem) registry.getValue(context)) .setNumberRequired(aNumberRequired); } public String getNumberRequiredFromBillOfMaterialsLineItem(int context) { return ((BillOfMaterialsLineItem) registry.getValue(context)) .getNumberRequired(); } public int getProductTypeFromBillOfMaterialsLineItem(int context) { return registry.getKey(((BillOfMaterialsLineItem) registry .getValue(context)).getProductType()); } public JSONObject getProductTypeFromBillOfMaterialsLineItemJSON(int context) throws JSONException { return ((BillOfMaterialsLineItem) registry.getValue(context)) .getProductType().getAttributes(); } public int getConsistsOfFromBillOfMaterialsLineItem(int context) { return registry.getKey(((BillOfMaterialsLineItem) registry .getValue(context)).getConsistsOf()); } public JSONObject getConsistsOfFromBillOfMaterialsLineItemJSON(int context) throws JSONException { return ((BillOfMaterialsLineItem) registry.getValue(context)) .getConsistsOf().getAttributes(); } public int getAssemblyStepFromBillOfMaterialsLineItem(int context) { return registry.getKey(((BillOfMaterialsLineItem) registry .getValue(context)).getAssemblyStep()); } public JSONObject getAssemblyStepFromBillOfMaterialsLineItemJSON(int context) throws JSONException { return ((BillOfMaterialsLineItem) registry.getValue(context)) .getAssemblyStep().getAttributes(); } public void setProductTypeInBillOfMaterialsLineItem(int context, int aProductType) throws Exception { ((BillOfMaterialsLineItem) registry.getValue(context)) .setProductType((ProductType) registry.getValue(aProductType)); } public void setConsistsOfInBillOfMaterialsLineItem(int context, int aConsistsOf) throws Exception { ((BillOfMaterialsLineItem) registry.getValue(context)) .setConsistsOf((ProductType) registry.getValue(aConsistsOf)); } public void setAssemblyStepInBillOfMaterialsLineItem(int context, int aAssemblyStep) throws Exception { ((BillOfMaterialsLineItem) registry.getValue(context)) .setAssemblyStep((AssemblyStep) registry.getValue(aAssemblyStep)); } public void deleteBillOfMaterialsLineItem(int context) { ((BillOfMaterialsLineItem) registry.getValue(context)).delete(); registry.removeObj(context); } public JSONObject getAttributesOfBillOfMaterialsLineItem(int context) throws JSONException { return ((BillOfMaterialsLineItem) registry.getValue(context)) .getAttributes(); } public int constructOrderLineItem() { return registry.add(new OrderLineItem()); } public JSONObject constructOrderLineItemJSON() throws JSONException { OrderLineItem contextObj = new OrderLineItem(); 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 getProductsFromOrderLineItem(int context) { ArrayList listOfIDs = new ArrayList(); for (Product obj : ((OrderLineItem) registry.getValue(context)) .getProducts()) { listOfIDs.add(registry.getKey(obj)); } return listOfIDs.iterator(); } public int addProductToOrderLineItem(int context, String aSerialNumber, int aProduct, int aProductType, int aOrderLineItem) throws Exception { return registry.getKey(((OrderLineItem) registry.getValue(context)) .addProduct(aSerialNumber, (Product) registry.getValue(aProduct), (ProductType) registry.getValue(aProductType), (OrderLineItem) registry .getValue(aOrderLineItem))); } public JSONObject addProductToOrderLineItemJSON(int context, String aSerialNumber, int aProduct, int aProductType, int aOrderLineItem) throws JSONException, Exception { return ((OrderLineItem) registry.getValue(context)).addProduct( aSerialNumber, (Product) registry.getValue(aProduct), (ProductType) registry.getValue(aProductType), (OrderLineItem) registry.getValue(aOrderLineItem)).getAttributes(); } public int addProductToOrderLineItemOnly(int context, int aProduct) throws Exception { return registry.getKey(((OrderLineItem) registry.getValue(context)) .addProduct((Product) registry.getValue(aProduct))); } public JSONObject addProductToOrderLineItemOnlyJSON(int context, int aProduct) throws JSONException, Exception { return ((OrderLineItem) registry.getValue(context)).addProduct( (Product) registry.getValue(aProduct)).getAttributes(); } public void deleteOrderLineItem(int context) { ((OrderLineItem) registry.getValue(context)).delete(); registry.removeObj(context); } public void deleteProductFromOrderLineItem(int context, int aProduct) { ((OrderLineItem) registry.getValue(context)) .deleteProduct((Product) registry.getValue(aProduct)); } public JSONObject getAttributesOfOrderLineItem(int context) throws JSONException { return ((OrderLineItem) registry.getValue(context)).getAttributes(); } public int constructAssemblyLine(String aNumber) { return registry.add(new AssemblyLine(aNumber)); } public JSONObject constructAssemblyLineJSON(String aNumber) throws JSONException { AssemblyLine contextObj = new AssemblyLine(aNumber); registry.add(contextObj); return contextObj.getAttributes(); } public boolean setNumberInAssemblyLine(int context, String aNumber) { return ((AssemblyLine) registry.getValue(context)).setNumber(aNumber); } public String getNumberFromAssemblyLine(int context) { return ((AssemblyLine) registry.getValue(context)).getNumber(); } /************ * Method returns an iterator to the list of id's of the elements involved in this list. ***************/ public Iterator getProductRunsFromAssemblyLine(int context) { ArrayList listOfIDs = new ArrayList(); for (ProductRun obj : ((AssemblyLine) registry.getValue(context)) .getProductRuns()) { listOfIDs.add(registry.getKey(obj)); } return listOfIDs.iterator(); } public int addProductRunToAssemblyLine(int context, String aTimePeriod, String aNumUnits, int aProductType, int aAssemblyLine) throws Exception { return registry.getKey(((AssemblyLine) registry.getValue(context)) .addProductRun(aTimePeriod, aNumUnits, (ProductType) registry .getValue(aProductType), (AssemblyLine) registry .getValue(aAssemblyLine))); } public JSONObject addProductRunToAssemblyLineJSON(int context, String aTimePeriod, String aNumUnits, int aProductType, int aAssemblyLine) throws JSONException, Exception { return ((AssemblyLine) registry.getValue(context)).addProductRun( aTimePeriod, aNumUnits, (ProductType) registry.getValue(aProductType), (AssemblyLine) registry.getValue(aAssemblyLine)).getAttributes(); } public int addProductRunToAssemblyLineOnly(int context, int aProductRun) throws Exception { return registry.getKey(((AssemblyLine) registry.getValue(context)) .addProductRun((ProductRun) registry.getValue(aProductRun))); } public JSONObject addProductRunToAssemblyLineOnlyJSON(int context, int aProductRun) throws JSONException, Exception { return ((AssemblyLine) registry.getValue(context)).addProductRun( (ProductRun) registry.getValue(aProductRun)).getAttributes(); } public void deleteAssemblyLine(int context) { ((AssemblyLine) registry.getValue(context)).delete(); registry.removeObj(context); } public void deleteProductRunFromAssemblyLine(int context, int aProductRun) { ((AssemblyLine) registry.getValue(context)) .deleteProductRun((ProductRun) registry.getValue(aProductRun)); } public JSONObject getAttributesOfAssemblyLine(int context) throws JSONException { return ((AssemblyLine) registry.getValue(context)).getAttributes(); } }