Examples of CategoryManager


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

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

                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

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

                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

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

        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

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

        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

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

        }

        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

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

        }

        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

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

        }

        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

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

                setShowFooter(true);
        }

        public void generateReport() {
                String reportFormat = "%1$3d\t%2$3s\t%3$s\n";
                CategoryManager categoryManager = null;
                CategorySet categorySet = null;
                try {
                        categoryManager = new CategoryManager();
                        categorySet = categoryManager.list();
                        if (categorySet == null) {
                                return;
                        }
                        for (int i = 0; i < categorySet.length(); i++) {
                                System.out.format(reportFormat, (i + 1), categorySet.get(i).getCategoryCode(), categorySet.get(i).getCategoryName());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.