Package sg.edu.nus.iss.se07.bc

Examples of sg.edu.nus.iss.se07.bc.Vendor


         *
         *
         */
        public Vendor placeOrderToVendor(Product p, int quantity) {

                Vendor dataObjectSet = null;

                VendorManagementHub dataObjectManager = new VendorManagementHub();

                try {
                        dataObjectSet = dataObjectManager.placeOrdertoVendorMgtHub(p, quantity);
View Full Code Here


         *
         *
         */
        public Vendor getPreferredVendor(Product p) {

                Vendor dataObjectSet = null;

                VendorManagementHub dataObjectManager = new VendorManagementHub();

                try {
                        dataObjectSet = dataObjectManager.getPreferredvendor(p);
View Full Code Here

                                        BufferedReader br = new BufferedReader(read);
                                        String s;
                                        try {
                                                while ((s = br.readLine()) != null) {
                                                        String[] stVendor = s.split(",");
                                                        Vendor v = new Vendor(stVendor[0], stVendor[1], getVendorProd(fileList[k].toString()));
                                                        content.add(v);
                                                        //destroy Object Vendor
                                                        v = null;

                                                }
View Full Code Here

                                    BufferedReader br = new BufferedReader(read);
                                    String s;
                                    try {
                                            while ((s = br.readLine()) != null) {
                                                    String[] stVendor = s.split(",");
                                                    Vendor v = new Vendor(stVendor[0], stVendor[1],categoryCode);
                                                    content.add(v);
                                                    //destroy Object Vendor
                                                    v = null;

                                            }
View Full Code Here

                                        BufferedReader br = new BufferedReader(read);
                                        String s;
                                        try {
                                                while ((s = br.readLine()) != null) {
                                                        String[] stVendor = s.split(",");
                                                        Vendor v = new Vendor(stVendor[0], stVendor[1], getVendorProd(fileList[k].toString()));
                                                        content.add(v);
                                                        //destroy Object Vendor
                                                        v = null;

                                                }
View Full Code Here

         *
         *
         */
        public Vendor placeOrderToVendor(Product p, int quantity) {

                Vendor dataObjectSet = null;

                VendorManagementHub dataObjectManager = new VendorManagementHub();

                try {
                        dataObjectSet = dataObjectManager.placeOrdertoVendorMgtHub(p, quantity);
View Full Code Here

         *
         *
         */
        public Vendor getPreferredVendor(Product p) {

                Vendor dataObjectSet = null;

                VendorManagementHub dataObjectManager = new VendorManagementHub();

                try {
                        dataObjectSet = dataObjectManager.getPreferredvendor(p);
View Full Code Here

                                FileUtil.writeContents(bw, data);
                        } else {
                                throw new IOException("[ProductDA::writeData]Failed to create filename " + fileName);
                        }
                } catch (IOException ex) {
                        throw new DataAccessException(ex.getMessage(), ex);
                } finally {
                        try {
                                if (bw != null) {
                                        bw.close();
                                }
View Full Code Here

                                        Product product = new Product(productID, productName, productDesc, productQty, productPrice, productBarcode, productReorderQty, productOrderQty);
                                        String data = product.toCSVFormat(format);
                                        FileUtil.writeContents(bw, data);
                                }
                        } else {
                                throw new DataAccessException("[ProductDA::writeData]Failed to create filename " + fileName);
                        }
                } catch (IOException ex) {
                        throw new DataAccessException(ex.getMessage(), ex);
                } finally {
                        try {
                                if (bw != null) {
                                        bw.close();
                                }
View Full Code Here

                                if (contents == null) {
                                        return null;
                                }
                                String[] lines = StringUtil.parse(contents, format.getEndOfLineSymbols());
                                if (lines == null) {
                                        throw new DataAccessException("[ProductDA::readData]Record not found.");
                                } else {

                                        if (lines.length < 1) {
                                                throw new DataAccessException("[ProductDA::readData]Record not found.");
                                        }

                                        for (int i = 0; i < lines.length; i++) {
                                                String record = lines[i];
                                                String[] fields = StringUtil.parse(record, String.valueOf((char) format.getDelimiterChar()));
                                                if (fields == null) {
                                                        Logger.getLogger(ProductDA.class.getName()).log(Level.SEVERE, "[ProductDA::readData]Unable to read record no " + (String.valueOf(i + 1)));
                                                        throw new DataAccessException("[ProductDA::readData]Unable to read record no " + (String.valueOf(i + 1)));
                                                } else {
                                                        if (fields.length != 8) {
                                                                Logger.getLogger(ProductDA.class.getName()).log(Level.SEVERE, "[ProductDA::readData]Record no " + (String.valueOf(i + 1)) + " is corrupted");
                                                        } else {
                                                                String id = fields[0];
                                                                String name = fields[1];
                                                                String desc = fields[2];

                                                                int qty = -1;
                                                                try {
                                                                        qty = Integer.parseInt(fields[3]);
                                                                } catch (NumberFormatException nfx) {
                                                                        throw new DataAccessException(nfx.getMessage(), nfx);
                                                                }

                                                                float price = 0f;
                                                                try {
                                                                        price = Float.parseFloat(fields[4]);
                                                                } catch (NumberFormatException nfx) {
                                                                        throw new DataAccessException(nfx.getMessage(), nfx);
                                                                }

                                                                String barcode = fields[5];

                                                                int reorderQty = -1;
                                                                try {
                                                                        reorderQty = Integer.parseInt(fields[6]);
                                                                } catch (NumberFormatException nfx) {
                                                                        throw new DataAccessException(nfx.getMessage(), nfx);
                                                                }

                                                                int orderQty = -1;
                                                                try {
                                                                        orderQty = Integer.parseInt(fields[7]);
                                                                } catch (NumberFormatException nfx) {
                                                                        throw new DataAccessException(nfx.getMessage(), nfx);
                                                                }


                                                                if (productCode.equalsIgnoreCase(id)) {
                                                                        dataObject = new Product();
                                                                        dataObject.setProductID(id);
                                                                        dataObject.setProductName(name);
                                                                        dataObject.setProductDescription(desc);
                                                                        dataObject.setQuantityAvailable(qty);
                                                                        dataObject.setProductPrice(price);
                                                                        dataObject.setBarcodeNumber(barcode);
                                                                        dataObject.setReorderQuantity(reorderQty);
                                                                        dataObject.setOrderQuantity(orderQty);
                                                                        i = lines.length;
                                                                }
                                                        }
                                                }
                                        }
                                }
                        } else {
                                throw new DataAccessException("[ProductDA::readData]File not found.");
                        }
                } catch (IOException ex) {
                        throw new DataAccessException(ex.getMessage(), ex);
                } finally {
                        if (br != null) {
                                try {
                                        br.close();
                                } catch (IOException ex) {
View Full Code Here

TOP

Related Classes of sg.edu.nus.iss.se07.bc.Vendor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.