Package com.bigbank.account

Examples of com.bigbank.account.StockSummary


        account.setAccountNumber("11-23");
        account.setBalance(543.21F);
        accounts.add(account);

        List stocks = accountReport.getStockSummaries();
        StockSummary stock = accountFactory.createStockSummary();
        stock.setSymbol("IBM");
        stock.setPurchaseDate("1999-11-23");
        stock.setPurchaseLotNumber(101);
        stock.setPurchasePrice(33.33F);
        stock.setQuantity(10);
        stocks.add(stock);

        stock = accountFactory.createStockSummary();
        stock.setSymbol("TUSK");
        stock.setPurchaseDate("2005-01-05");
        stock.setPurchaseLotNumber(102);
        stock.setPurchasePrice(11.11F);
        stock.setQuantity(4);
        stocks.add(stock);
        return accountReport;
    }
View Full Code Here


            Command read = das.getCommand("stockbylotSelect");
            read.setParameter(1, purchaseLotNumber);// autoboxing :-)
            DataObject root = read.executeQuery();
            List stocks = root.getList("StockSummary");
            if (null != stocks && !stocks.isEmpty()) {
                StockSummary stock = (StockSummary) stocks.get(0);
                int newQuatity = Math.max(stock.getQuantity() - quantity, 0);
                if (newQuatity < 1) {

                    Command delete = das.createCommand("DELETE FROM STOCKS WHERE PURCHASELOTNUMBER = ?");
                    delete.setParameter(1, purchaseLotNumber);
                    delete.execute();

                } else {

                    Command update = das.getCommand("stockbylot");

                    update.setParameter(1, newQuatity);
                    update.setParameter(2, purchaseLotNumber);
                    update.execute();

                    stock.setQuantity(newQuatity);
                }
                return stock;
            }

            return null;
View Full Code Here

        accountDBInit.readDBstdout(System.out);

        // test stock purchase.
        purchaseStock sp = AccountFactory.INSTANCE.createpurchaseStock();
        StockSummary stock = AccountFactory.INSTANCE.createStockSummary();
        stock.setSymbol("GOOG");
        stock.setQuantity(10);
        stock.setPurchasePrice(25.00F);
        sp.setId(1);
        sp.setStock(stock);

        accountDBInit.testStrockPurchaseThroughDAS(sp);
View Full Code Here

    }

    public StockSummary sellStock(int purchaseLotNumber, int quantity) throws RemoteException {
        try {
            int id = accountDataService.getCustomerIdByPurchaseLotNumber(purchaseLotNumber);
            StockSummary ss = accountDataService.sellStock(purchaseLotNumber, quantity);
            if (ss != null) {
                if (!(accountDataService instanceof CustomerIdService)) {
                    throw new RemoteException("Can't use data service as customer id service");
                }
                accountLoggerService.logSellStock(id, ss, quantity);
View Full Code Here

        // accountDBInit.testWithdrawThroughDAS(wd);

        // test stock purchase.

        purchaseStock sp = AccountFactory.INSTANCE.createpurchaseStock();
        StockSummary stock= AccountFactory.INSTANCE.createStockSummary();
        sp.setStock(stock);
        stock.setSymbol("GOOG");
        sp.setId(1);
        stock.setQuantity(10);
        accountDBInit.testStrockPurchaseThroughDAS(sp);

        accountDBInit.readDBstdout(System.out);

        System.out.flush();
View Full Code Here

        account.setAccountNumber("11-23");
        account.setBalance(543.21F);
        accounts.add(account);

        List stocks = accountReport.getStockSummaries();
        StockSummary stock = accountFactory.createStockSummary();
        stock.setSymbol("IBM");
        stock.setPurchaseDate("1999-11-23");
        stock.setPurchaseLotNumber(101);
        stock.setPurchasePrice(33.33F);
        stock.setQuantity(10);
        stocks.add(stock);

        stock = accountFactory.createStockSummary();
        stock.setSymbol("TUSK");
        stock.setPurchaseDate("2005-01-05");
        stock.setPurchaseLotNumber(102);
        stock.setPurchasePrice(11.11F);
        stock.setQuantity(4);
        stocks.add(stock);
        return accountReport;
    }
View Full Code Here

            read.setDataObjectModel(helper.getType(DataGraphRoot.class));
            read.setParameterValue("PURCHASELOTNUMBER", purchaseLotNumber);// autoboxing :-)
            DataGraphRoot root = (DataGraphRoot) read.executeQuery();
            List stocks = root.getStockSummaries();
            if (null != stocks && !stocks.isEmpty()) {
                StockSummary stock = (StockSummary) stocks.get(0);
                int newQuatity = Math.max(stock.getQuantity() - quantity, 0);
                if (newQuatity < 1) {

                    Command delete = Command.FACTORY.createCommand("DELETE FROM STOCKS WHERE PURCHASELOTNUMBER = ?");
                    delete.setParameterValue(1, purchaseLotNumber);
                    delete.setConnection(getConnection());
                    delete.execute();

                } else {

                    Command update = commandGroup.getCommand("stockbylot");

                    update.setParameterValue("QUANTITY", newQuatity);
                    update.setParameterValue("PURCHASELOTNUMBER", purchaseLotNumber);
                    update.execute();

                    stock.setQuantity(newQuatity);
                }

            }

            return null;
View Full Code Here

        try {
            if (!"cancel".equals(req.getParameter("cancel"))) {

                String symbol = req.getParameter("symbol").trim().toUpperCase();
                int quantity = Integer.parseInt(req.getParameter("quantity"));
                StockSummary stockSummry = AccountFactory.INSTANCE.createStockSummary();
                stockSummry.setSymbol(symbol);
                stockSummry.setQuantity(quantity);
                accountServices.purchaseStock(profileServices.getId(), stockSummry);
            }
        } catch (Exception e) {
            throw new ServletException("stockPurchase " + e.getMessage(), e);
        }
View Full Code Here

        try {
            if (!"cancel".equals(req.getParameter("cancel"))) {

                String symbol = req.getParameter("symbol").trim().toUpperCase();
                int quantity = Integer.parseInt(req.getParameter("quantity"));
                StockSummary stockSummry = AccountFactory.INSTANCE.createStockSummary();
                stockSummry.setSymbol(symbol);
                stockSummry.setQuantity(quantity);
                accountServices.purchaseStock(profileServices.getId(), stockSummry);
            }
        } catch (Exception e) {
            throw new ServletException("stockPurchase " + e.getMessage(), e);
        }
View Full Code Here

TOP

Related Classes of com.bigbank.account.StockSummary

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.