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

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


                ErrorList errorList = new ErrorList();
                return errorList;
        }

        public ErrorList delete(Member member) throws AppException {
                ErrorList errorList = new ErrorList();
                return errorList;
        }
View Full Code Here


                ErrorList errorList = new ErrorList();
                return errorList;
        }

        public ErrorList delete(String memberID) throws AppException {
                ErrorList errorList = new ErrorList();
                return errorList;
        }
View Full Code Here

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

                                        Category category = new Category(categoryCode, categoryName);
                                        String data = category.toCSVFormat(format);
                                        FileUtil.writeContents(bw, data);
                                }
                        } else {
                                throw new AppException("Failed to create filename " + fileName, "[CategoryDA::writeDataSet]", null);
                        }
                } catch (IOException ex) {
                        throw new AppException(ex.getMessage(), "[CategoryDA::writeDataSet]", 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 AppException("Record not found.", "[CategoryDA::readData]", null);
                                } else {

                                        if (lines.length < 1) {
                                                throw new AppException("Record not found.", "[CategoryDA::readData]", null);
                                        }

                                        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) {
                                                        throw new AppException("Unable to read record no " + (String.valueOf(i + 1)), "[CategoryDA::readData]", null);
                                                } else {
                                                        if (fields.length != 2) {
                                                                Logger.getLogger(CategoryDA.class.getName()).log(Level.SEVERE, "[CategoryDA::readData]Record no " + (String.valueOf(i + 1)) + " is corrupted");
                                                        } else {
                                                                String catCode = fields[0];
                                                                String catName = fields[1];
                                                                if (catCode == null) {
                                                                        catCode = "";
                                                                }

                                                                if (catName == null) {
                                                                        catName = "";
                                                                }

                                                                if (categoryCode.equalsIgnoreCase(catCode)) {
                                                                        dataObject = new Category();
                                                                        dataObject.setCategoryCode(catCode);
                                                                        dataObject.setCategoryName(catName);
                                                                        i = lines.length;
                                                                }
                                                        }
                                                }
                                        }
                                }
                        } else {
                                throw new AppException("File not found.", "[CategoryDA::readData]", null);
                        }
                } catch (IOException ex) {
                        throw new AppException(ex.getMessage(), "[CategoryDA::readData]", ex);
                } finally {
                        if (br != null) {
                                try {
                                        br.close();
                                } catch (IOException ex) {
View Full Code Here

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

                                        if (lines.length < 1) {
                                                throw new AppException("Record not found.", "[CategoryDA::readDataSet]", null);
                                        }

                                        dataObjectSet = new ArrayList<Tuple2<NameValue<String>, NameValue<String>>>();
                                        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) {
                                                        throw new AppException("Unable to read record no " + (String.valueOf(i + 1)), "[CategoryDA::readDataSet]", null);
                                                } else {
                                                        if (fields.length != 2) {
                                                                Logger.getLogger(CategoryDA.class.getName()).log(Level.SEVERE, "[CategoryDA::readData]Record no " + (String.valueOf(i + 1)) + " is corrupted");
                                                        } else {

                                                                //get the value from file and verify it
                                                                String catCode = fields[0];
                                                                String catName = fields[1];
                                                                if (catCode == null) {
                                                                        catCode = "";
                                                                }

                                                                if (catName == null) {
                                                                        catName = "";
                                                                }

                                                                //valid row
                                                                if (!"".equalsIgnoreCase(catCode) && !"".equalsIgnoreCase(catName)) {
                                                                        NameValue<String> categoryCode = new NameValue<String>("CategoryCode", catCode);
                                                                        NameValue<String> categoryName = new NameValue<String>("CategoryName", catName);
                                                                        dataObjectSet.add(new Tuple2<NameValue<String>, NameValue<String>>(categoryCode, categoryName));
                                                                }

                                                        }
                                                }
                                        }
                                }
                        } else {
                                throw new AppException("File not found.", "[CategoryDA::readDataSet]", null);
                        }
                } catch (IOException ex) {
                        throw new AppException(ex.getMessage(), "[CategoryDA::readDataSet]", ex);
                } finally {
                        if (br != null) {
                                try {
                                        br.close();
                                } catch (IOException ex) {
View Full Code Here

                                return errorList;
                        }
                }

                try {
                        memberDA = new MemberDA();
                        memberDA.writeData(member, true);
                        memberDA = null;
                } catch (AppException ex) {
                        Logger.getLogger(MemberFcd.class.getName()).log(Level.SEVERE, null, ex);
                        throw ex;
View Full Code Here

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

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

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

                try {
                        memberDA = new MemberDA();
                        records = memberDA.readData();
                        if (records != null) {
                                for (int i = 0; i < records.size(); i++) {
                                        Tuple3<NameValue<String>, NameValue<String>, NameValue<Integer>> record = records.get(i);
                                        Member member = new Member();
View Full Code Here

TOP

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

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.