Package sg.edu.nus.iss.se07.da

Examples of sg.edu.nus.iss.se07.da.ProductDA


         * @throws sg.edu.nus.iss.se07.common.exceptions.AppException
         */
        public ProductSet list() throws AppException {
                ProductSet objectSet = new ProductSet();
                try {
                        productDA = new ProductDA();
                        objectSet = productDA.readDataSet();
                        productDA = null;
                } catch (AppException ex) {
                        Logger.getLogger(ProductManager.class.getName()).log(Level.SEVERE, null, ex);
                        throw ex;
View Full Code Here


         * @throws sg.edu.nus.iss.se07.common.exceptions.AppException
         */
        public ProductSet list(String productID) throws AppException {
                ProductSet objectSet = new ProductSet();
                try {
                        productDA = new ProductDA();
                        objectSet = productDA.readDataSet(productID);
                        productDA = null;
                } catch (AppException ex) {
                        Logger.getLogger(ProductManager.class.getName()).log(Level.SEVERE, null, ex);
                        throw ex;
View Full Code Here

        public ProductSet select() throws AppException {
                ProductSet objectSet = new ProductSet();
                ArrayList<Tuple8<NameValue<String>, NameValue<String>, NameValue<String>, NameValue<Integer>, NameValue<Float>, NameValue<String>, NameValue<Integer>, NameValue<Integer>>> records = null;

                try {
                        productDA = new ProductDA();
                        records = productDA.readData();
                        if (records != null) {
                                for (int i = 0; i < records.size(); i++) {
                                        Tuple8<NameValue<String>, NameValue<String>, NameValue<String>, NameValue<Integer>, NameValue<Float>, NameValue<String>, NameValue<Integer>, NameValue<Integer>> record = records.get(i);
                                        Product product = new Product();
View Full Code Here

        public ProductSet select(String productID) throws AppException {
                ProductSet objectSet = new ProductSet();
                ArrayList<Tuple8<NameValue<String>, NameValue<String>, NameValue<String>, NameValue<Integer>, NameValue<Float>, NameValue<String>, NameValue<Integer>, NameValue<Integer>>> records = null;

                try {
                        productDA = new ProductDA();
                        records = productDA.readData(productID);
                        if (records != null) {
                                for (int i = 0; i < records.size(); i++) {
                                        Tuple8<NameValue<String>, NameValue<String>, NameValue<String>, NameValue<Integer>, NameValue<Float>, NameValue<String>, NameValue<Integer>, NameValue<Integer>> record = records.get(i);
                                        Product product = new Product();
View Full Code Here

        public ProductSet query(String productID) throws AppException {
                ProductSet objectSet = new ProductSet();
                ArrayList<Tuple8<NameValue<String>, NameValue<String>, NameValue<String>, NameValue<Integer>, NameValue<Float>, NameValue<String>, NameValue<Integer>, NameValue<Integer>>> records = null;

                try {
                        productDA = new ProductDA();
                        records = productDA.readData();
                        if (records != null) {
                                for (int i = 0; i < records.size(); i++) {
                                        Tuple8<NameValue<String>, NameValue<String>, NameValue<String>, NameValue<Integer>, NameValue<Float>, NameValue<String>, NameValue<Integer>, NameValue<Integer>> record = records.get(i);
                                        if (productID.equalsIgnoreCase(record.getItem1().getValue())) {
View Full Code Here

         * @throws sg.edu.nus.iss.se07.common.exceptions.AppException
         */
        public boolean addProduct(Product product) throws AppException {
                boolean success = true;
                try {
                        productDA = new ProductDA(filename, format);
                        productDA.writeData(product, true);
                } catch (AppException ex) {
                        success = false;
                        Logger.getLogger(CategoryManager.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
                        throw ex;
View Full Code Here

                ArrayList<Tuple8<NameValue<String>, NameValue<String>, NameValue<String>, NameValue<Integer>, NameValue<Float>, NameValue<String>, NameValue<Integer>, NameValue<Integer>>> currDataObjectSet = null;
                ArrayList<Tuple8<NameValue<String>, NameValue<String>, NameValue<String>, NameValue<Integer>, NameValue<Float>, NameValue<String>, NameValue<Integer>, NameValue<Integer>>> newDataObjectSet = null;

                try {
                        productDA = new ProductDA(filename, format);
                        currDataObjectSet = productDA.readDataSet();
                } catch (AppException ex) {
                        success = false;
                        Logger.getLogger(CategoryManager.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
                        throw ex;
                } finally {
                        productDA = null;
                }

                if (currDataObjectSet != null) {
                        newDataObjectSet = new ArrayList<Tuple8<NameValue<String>, NameValue<String>, NameValue<String>, NameValue<Integer>, NameValue<Float>, NameValue<String>, NameValue<Integer>, NameValue<Integer>>>();
                        for (int i = 0; i < currDataObjectSet.size(); i++) {

                                String productID = currDataObjectSet.get(i).getItem1().getValue();
                                String productName = currDataObjectSet.get(i).getItem2().getValue();
                                String productDescription = currDataObjectSet.get(i).getItem3().getValue();
                                Integer quantityAvailable = currDataObjectSet.get(i).getItem4().getValue();
                                Float productPrice = currDataObjectSet.get(i).getItem5().getValue();
                                String barcodeNumber = currDataObjectSet.get(i).getItem6().getValue();
                                Integer reorderQuantity = currDataObjectSet.get(i).getItem7().getValue();
                                Integer orderQuantity = currDataObjectSet.get(i).getItem8().getValue();

                                if (productID.equalsIgnoreCase(oldProduct.getProductID())) {
                                        productID = newProduct.getProductID();
                                        productName = newProduct.getProductName();
                                        productDescription = newProduct.getProductDescription();
                                        quantityAvailable = newProduct.getQuantityAvailable();
                                        productPrice = newProduct.getProductPrice();
                                        barcodeNumber = newProduct.getBarcodeNumber();
                                        reorderQuantity = newProduct.getReorderQuantity();
                                        orderQuantity = newProduct.getOrderQuantity();

                                }

                                NameValue<String> nmProductID = new NameValue<String>("ProductID", productID);
                                NameValue<String> nmProductName = new NameValue<String>("CategoryName", productName);
                                NameValue<String> nmProductDescription = new NameValue<String>("ProductDescription", productDescription);
                                NameValue<Integer> nmQuantityAvailable = new NameValue<Integer>("QuantityAvailable", quantityAvailable);
                                NameValue<Float> nmProductPrice = new NameValue<Float>("ProductPrice", productPrice);
                                NameValue<String> nmBarcodeNumber = new NameValue<String>("BarcodeNumber", barcodeNumber);
                                NameValue<Integer> nmReorderQuantity = new NameValue<Integer>("ReorderQuantity", reorderQuantity);
                                NameValue<Integer> nmOrderQuantity = new NameValue<Integer>("OrderQuantity", orderQuantity);

                                Tuple8<NameValue<String>, NameValue<String>, NameValue<String>, NameValue<Integer>, NameValue<Float>, NameValue<String>, NameValue<Integer>, NameValue<Integer>> dataObject = new Tuple8<NameValue<String>, NameValue<String>, NameValue<String>, NameValue<Integer>, NameValue<Float>, NameValue<String>, NameValue<Integer>, NameValue<Integer>>(nmProductID, nmProductName, nmProductDescription, nmQuantityAvailable, nmProductPrice, nmBarcodeNumber, nmReorderQuantity, nmOrderQuantity);
                                newDataObjectSet.add(dataObject);
                        }


                        try {
                                productDA = new ProductDA(filename, format);
                                productDA.writeDataSet(newDataObjectSet, false);
                        } catch (AppException ex) {
                                success = false;
                                Logger.getLogger(CategoryManager.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
                                throw ex;
View Full Code Here

                ArrayList<Tuple8<NameValue<String>, NameValue<String>, NameValue<String>, NameValue<Integer>, NameValue<Float>, NameValue<String>, NameValue<Integer>, NameValue<Integer>>> currDataObjectSet = null;
                ArrayList<Tuple8<NameValue<String>, NameValue<String>, NameValue<String>, NameValue<Integer>, NameValue<Float>, NameValue<String>, NameValue<Integer>, NameValue<Integer>>> newDataObjectSet = null;

                try {
                        productDA = new ProductDA(filename, format);
                        currDataObjectSet = productDA.readDataSet();
                } catch (AppException ex) {
                        success = false;
                        Logger.getLogger(CategoryManager.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
                        throw ex;
                } finally {
                        productDA = null;
                }

                if (currDataObjectSet != null) {
                        newDataObjectSet = new ArrayList<Tuple8<NameValue<String>, NameValue<String>, NameValue<String>, NameValue<Integer>, NameValue<Float>, NameValue<String>, NameValue<Integer>, NameValue<Integer>>>();
                        for (int i = 0; i < currDataObjectSet.size(); i++) {

                                String prodID = currDataObjectSet.get(i).getItem1().getValue();
                                String productName = currDataObjectSet.get(i).getItem2().getValue();
                                String productDescription = currDataObjectSet.get(i).getItem3().getValue();
                                Integer quantityAvailable = currDataObjectSet.get(i).getItem4().getValue();
                                Float productPrice = currDataObjectSet.get(i).getItem5().getValue();
                                String barcodeNumber = currDataObjectSet.get(i).getItem6().getValue();
                                Integer reorderQuantity = currDataObjectSet.get(i).getItem7().getValue();
                                Integer orderQuantity = currDataObjectSet.get(i).getItem8().getValue();

                                if (!productID.equalsIgnoreCase(prodID)) {
                                        NameValue<String> nmProductID = new NameValue<String>("ProductID", prodID);
                                        NameValue<String> nmProductName = new NameValue<String>("CategoryName", productName);
                                        NameValue<String> nmProductDescription = new NameValue<String>("ProductDescription", productDescription);
                                        NameValue<Integer> nmQuantityAvailable = new NameValue<Integer>("QuantityAvailable", quantityAvailable);
                                        NameValue<Float> nmProductPrice = new NameValue<Float>("ProductPrice", productPrice);
                                        NameValue<String> nmBarcodeNumber = new NameValue<String>("BarcodeNumber", barcodeNumber);
                                        NameValue<Integer> nmReorderQuantity = new NameValue<Integer>("ReorderQuantity", reorderQuantity);
                                        NameValue<Integer> nmOrderQuantity = new NameValue<Integer>("OrderQuantity", orderQuantity);

                                        Tuple8<NameValue<String>, NameValue<String>, NameValue<String>, NameValue<Integer>, NameValue<Float>, NameValue<String>, NameValue<Integer>, NameValue<Integer>> dataObject = new Tuple8<NameValue<String>, NameValue<String>, NameValue<String>, NameValue<Integer>, NameValue<Float>, NameValue<String>, NameValue<Integer>, NameValue<Integer>>(nmProductID, nmProductName, nmProductDescription, nmQuantityAvailable, nmProductPrice, nmBarcodeNumber, nmReorderQuantity, nmOrderQuantity);
                                        newDataObjectSet.add(dataObject);
                                }

                        }


                        try {
                                productDA = new ProductDA(filename, format);
                                productDA.writeDataSet(newDataObjectSet, false);
                        } catch (AppException ex) {
                                success = false;
                                Logger.getLogger(CategoryManager.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
                                throw ex;
View Full Code Here

        public ArrayList<Product> listProducts() throws AppException {
                ArrayList<Product> productSet = null;
                ArrayList<Tuple8<NameValue<String>, NameValue<String>, NameValue<String>, NameValue<Integer>, NameValue<Float>, NameValue<String>, NameValue<Integer>, NameValue<Integer>>> dataSet = null;

                try {
                        productDA = new ProductDA(filename, format);
                        dataSet = productDA.readDataSet();
                        if (dataSet != null) {
                                productSet = new ArrayList<Product>();
                                for (int i=0; i<dataSet.size(); i++) {
                                        Product dataObject = new Product();
View Full Code Here

        public Product selectProduct(String productID) throws AppException {
                Product dataObject = null;

                try {
                        productDA = new ProductDA(filename, format);
                        dataObject = productDA.readData(productID);
                } catch (AppException ex) {
                        Logger.getLogger(CategoryManager.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
                        throw ex;
                } finally {
View Full Code Here

TOP

Related Classes of sg.edu.nus.iss.se07.da.ProductDA

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.