Package org.apache.aries.samples.ariestrader.api.persistence

Examples of org.apache.aries.samples.ariestrader.api.persistence.AccountDataBean


    public Collection<OrderDataBean> getOrders(String userID) {
        if (Log.doTrace())
            Log.trace("TradeJpaAm:getOrders", userID);
        EntityManager entityManager = emf.createEntityManager();
        AccountProfileDataBeanImpl profile = entityManager.find(AccountProfileDataBeanImpl.class, userID);
        AccountDataBean account = profile.getAccount();
        entityManager.close();
        return account.getOrders();
    }
View Full Code Here


        AccountProfileDataBeanImpl profile = entityManager.find(AccountProfileDataBeanImpl.class, userID);
        /*
         * Inflate the lazy data memebers
         */
        AccountDataBean account = profile.getAccount();
        account.getProfile();

        // Added to populate transient field for account
        account.setProfileID(profile.getUserID());
        entityManager.close();
        entityManager = null;

        return account;
    }
View Full Code Here

         * Managed Transaction
         */
        entityManager.getTransaction().begin();
        entityManager.merge(profile);

        AccountDataBean account = profile.getAccount();

        if (Log.doTrace())
            Log.trace("TradeJpaAm:login", userID, password);

        account.login(password);
        entityManager.getTransaction().commit();
        if (Log.doTrace())
            Log.trace("TradeJpaAm:login(" + userID + "," + password + ") success" + account);
        entityManager.close();
        return account;
View Full Code Here

        if (Log.doTrace())
            Log.trace("TradeJpaAm:logout", userID);
        EntityManager entityManager = emf.createEntityManager();

        AccountProfileDataBeanImpl profile = entityManager.find(AccountProfileDataBeanImpl.class, userID);
        AccountDataBean account = profile.getAccount();

        /*
         * Managed Transaction
         */
        try {
            entityManager.getTransaction().begin();
            account.logout();
            entityManager.getTransaction().commit();
            entityManager.close();
        }
        catch (Exception e) {
            entityManager.getTransaction().rollback();
View Full Code Here

            if (Log.doTrace())
                Log.trace("TradeJdbc:buy - inSession(" + this.inSession + ")", userID, symbol, new Double(quantity));

            conn = getConn();

            AccountDataBean accountData = getAccountData(conn, userID);
            QuoteDataBean quoteData = getQuoteData(conn, symbol);
            HoldingDataBean holdingData = null; // the buy operation will create
            // the holding

            orderData = createOrder(conn, accountData, quoteData, holdingData, "buy", quantity);
View Full Code Here

            if (Log.doTrace())
                Log.trace("TradeJdbc:sell - inSession(" + this.inSession + ")", userID, holdingID);

            conn = getConn();

            AccountDataBean accountData = getAccountData(conn, userID);
            HoldingDataBean holdingData = getHoldingData(conn, holdingID.intValue());
            QuoteDataBean quoteData = null;
            if (holdingData != null)
                quoteData = getQuoteData(conn, holdingData.getQuoteID());
View Full Code Here

     * @see TradeServices#getAccountData(String)
     */
    public AccountDataBean getAccountData(String userID) throws Exception {

        try {
            AccountDataBean accountData = null;
            Connection conn = null;
            try {
                if (Log.doTrace())
                    Log.trace("TradeJdbc:getAccountData - inSession(" + this.inSession + ")", userID);

View Full Code Here

    private AccountDataBean getAccountData(Connection conn, String userID) throws Exception {
        PreparedStatement stmt = getStatement(conn, getAccountForUserSQL);
        stmt.setString(1, userID);
        ResultSet rs = stmt.executeQuery();
        AccountDataBean accountData = getAccountDataFromResultSet(rs);
        stmt.close();
        return accountData;
    }
View Full Code Here

    private AccountDataBean getAccountDataForUpdate(Connection conn, String userID) throws Exception {
        PreparedStatement stmt = getStatement(conn, getAccountForUserForUpdateSQL);
        stmt.setString(1, userID);
        ResultSet rs = stmt.executeQuery();
        AccountDataBean accountData = getAccountDataFromResultSet(rs);
        stmt.close();
        return accountData;
    }
View Full Code Here

    /**
     * @see TradeServices#getAccountData(String)
     */
    public AccountDataBean getAccountData(int accountID) throws Exception {
        AccountDataBean accountData = null;
        Connection conn = null;
        try {
            if (Log.doTrace())
                Log.trace("TradeJdbc:getAccountData - inSession(" + this.inSession + ")", new Integer(accountID));

View Full Code Here

TOP

Related Classes of org.apache.aries.samples.ariestrader.api.persistence.AccountDataBean

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.