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

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


         * @throws sg.edu.nus.iss.se07.common.exceptions.AppException
         */
        public ArrayList<Category> listCategories() throws AppException {
                ArrayList<Category> dataObjectSet = null;

                CategoryManager categoryManager = new CategoryManager();
                try {
                        dataObjectSet = categoryManager.listCategory();
                } catch (AppException ex) {
                        Logger.getLogger(AppController.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
                        throw ex;
                }

View Full Code Here


                categoryDB = datafolder;
                categoryReport = reportfolder;
        }

        public void testDataEntry() {
                CategoryManager dataObjectManager = new CategoryManager(categoryDB, categoryDBFormat);

                //create new category
                Category dataObject1 = new Category("CLO", "Clothing");
                try {
                        dataObjectManager.addCategory(dataObject1);
                } catch (AppException ex) {
                        Logger.getLogger(TestCategory.class.getName()).log(Level.SEVERE,ex.getMessage(), ex);
                }

                Category dataObject2 = new Category("MUG", "Mugs");
                try {
                        dataObjectManager.addCategory(dataObject2);
                } catch (AppException ex) {
                        Logger.getLogger(TestCategory.class.getName()).log(Level.SEVERE,ex.getMessage(), ex);
                }

                Category dataObject3 = new Category("STA", "Stationary");
                try {
                        dataObjectManager.addCategory(dataObject3);
                } catch (AppException ex) {
                        Logger.getLogger(TestCategory.class.getName()).log(Level.SEVERE,ex.getMessage(), ex);
                }

                Category dataObject4 = new Category("DIA", "Diary");
                try {
                        dataObjectManager.addCategory(dataObject4);
                } catch (AppException ex) {
                        Logger.getLogger(TestCategory.class.getName()).log(Level.SEVERE,ex.getMessage(), ex);
                }

                //try to creat duplicate category followed by valid category
                Category dataObject5 = new Category("CLO", "Clothing");
                try {
                        dataObjectManager.addCategory(dataObject5);
                } catch (AppException ex) {
                        Logger.getLogger(TestCategory.class.getName()).log(Level.SEVERE,ex.getMessage(), ex);
                }

                Category dataObject6 = new Category("TEST", "Testing");
                try {
                        dataObjectManager.addCategory(dataObject6);
                } catch (AppException ex) {
                        Logger.getLogger(TestCategory.class.getName()).log(Level.SEVERE,ex.getMessage(), ex);
                }

                dataObjectManager = null;
View Full Code Here

                categoryDB = datafolder;
                categoryReport = reportfolder;
        }

        public void testDataEntry() {
                CategoryManager dataObjectManager = new CategoryManager(categoryDB, categoryDBFormat);

                //create new category
                Category dataObject1 = new Category("CLO", "Clothing");
                try {
                        dataObjectManager.addCategory(dataObject1);
                } catch (AppException ex) {
                        Logger.getLogger(TestCategory.class.getName()).log(Level.SEVERE,ex.getMessage(), ex);
                }

                Category dataObject2 = new Category("MUG", "Mugs");
                try {
                        dataObjectManager.addCategory(dataObject2);
                } catch (AppException ex) {
                        Logger.getLogger(TestCategory.class.getName()).log(Level.SEVERE,ex.getMessage(), ex);
                }

                Category dataObject3 = new Category("STA", "Stationary");
                try {
                        dataObjectManager.addCategory(dataObject3);
                } catch (AppException ex) {
                        Logger.getLogger(TestCategory.class.getName()).log(Level.SEVERE,ex.getMessage(), ex);
                }

                Category dataObject4 = new Category("DIA", "Diary");
                try {
                        dataObjectManager.addCategory(dataObject4);
                } catch (AppException ex) {
                        Logger.getLogger(TestCategory.class.getName()).log(Level.SEVERE,ex.getMessage(), ex);
                }

                //try to creat duplicate category followed by valid category
                Category dataObject5 = new Category("CLO", "Clothing");
                try {
                        dataObjectManager.addCategory(dataObject5);
                } catch (AppException ex) {
                        Logger.getLogger(TestCategory.class.getName()).log(Level.SEVERE,ex.getMessage(), ex);
                }

                Category dataObject6 = new Category("TEST", "Testing");
                try {
                        dataObjectManager.addCategory(dataObject6);
                } catch (AppException ex) {
                        Logger.getLogger(TestCategory.class.getName()).log(Level.SEVERE,ex.getMessage(), ex);
                }

                dataObjectManager = null;
View Full Code Here

        public static void main(String[] args) {
                Category category1 = new Category("TEST1", "Testing 1");
                Category category2 = new Category("TEST2", "Testing 2");

                CategoryManager categoryManager = new CategoryManager();
                try {
                        categoryManager.createCategory(category1);
                } catch (DataAccessException ex) {
                        Logger.getLogger(TestCategory.class.getName()).log(Level.SEVERE, null, ex);
                }
                try {
                        categoryManager.createCategory(category2);
                } catch (DataAccessException ex) {
                        Logger.getLogger(TestCategory.class.getName()).log(Level.SEVERE, null, ex);
                }
                try {
                        System.out.println(categoryManager.listCategory());
                } catch (DataAccessException ex) {
                        Logger.getLogger(TestCategory.class.getName()).log(Level.SEVERE, null, ex);
                }

        }
View Full Code Here

        public boolean addCategory(String id, String name) throws AppException {
                boolean success = true;

                Category dataObject = new Category(id, name);
                CategoryManager dataObjectManager = new CategoryManager();

                try {
                        success = dataObjectManager.addCategory(dataObject);
                } catch (AppException ex) {
                        Logger.getLogger(AppController.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
                        throw ex;
                }
View Full Code Here

        }

        public boolean updateCategory(String id, String name) throws AppException {
                boolean success = true;

                CategoryManager dataObjectManager = new CategoryManager();

                Category oldDataObject = null;
                try {
                        oldDataObject = dataObjectManager.selectCategory(id);
                } catch (AppException ex) {
                        Logger.getLogger(AppController.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
                        throw ex;
                }

                if (oldDataObject != null) {
                        Category newDataObject = new Category(id, name);
                        try {
                                success = dataObjectManager.updateCategory(oldDataObject, newDataObject);
                        } catch (AppException ex) {
                                Logger.getLogger(AppController.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
                                throw ex;
                        }
                } else {
View Full Code Here

        }

        public boolean removeCategory(String id, String name) throws AppException {
                boolean success = true;

                CategoryManager dataObjectManager = new CategoryManager();

                try {
                        success = dataObjectManager.deleteCategory(id);
                } catch (AppException ex) {
                        Logger.getLogger(AppController.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
                        throw ex;
                }
View Full Code Here

        }

        public ArrayList<Category> listCategories() throws AppException {
                ArrayList<Category> dataObjectSet = null;

                CategoryManager categoryManager = new CategoryManager();
                try {
                        dataObjectSet = categoryManager.listCategory();
                } catch (AppException ex) {
                        Logger.getLogger(AppController.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
                        throw ex;
                }
View Full Code Here

        public String printCategoryReport() throws AppException {
                boolean success = true;
                String reportfilename = "";

                CategoryReport categoryReport = new CategoryReport();
                try {
                        success = categoryReport.generateReport();
                        if (success) {
                                reportfilename = categoryReport.getFileOutputName();
                        }
                } catch (AppException ex) {
                        success = false;
                        Logger.getLogger(AppController.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
                        throw ex;
View Full Code Here

        public String printTransactionReceipt(ArrayList<Tuple4<String, String, Integer, Date>> purchases, int finaldeem, String memberID, float totalAmt, int deempoint, float dis, float grandtotal) throws AppException {
                boolean success = true;
                String reportfilename = "";

                CheckoutReport checkoutReport = new CheckoutReport();
                try {
                        success = checkoutReport.generateReport(purchases, finaldeem, memberID, totalAmt, deempoint, dis, grandtotal);
                        if (success) {
                                reportfilename = checkoutReport.getFileOutputName();
                        }
                } catch (AppException ex) {
                        success = false;
                        Logger.getLogger(AppController.class.getName()).log(Level.SEVERE, ex.getMessage(), ex);
                        throw ex;
View Full Code Here

TOP

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

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.