Package org.apache.aries.samples.ariestrader.entities

Examples of org.apache.aries.samples.ariestrader.entities.AccountProfileDataBeanImpl


        try {
            if (Log.doTrace())
                Log.trace("TradeJpaCm:buy", userID, symbol, quantity, orderProcessingMode);

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

            QuoteDataBeanImpl quote = entityManager.find(QuoteDataBeanImpl.class, symbol);

            HoldingDataBeanImpl holding = null; // The holding will be created by this buy order
View Full Code Here


        BigDecimal total;
        try {
            if (Log.doTrace())
                Log.trace("TradeJpaCm:sell", userID, holdingID, orderProcessingMode);

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

            AccountDataBean account = profile.getAccount();
            HoldingDataBeanImpl holding = entityManager.find(HoldingDataBeanImpl.class, holdingID);

            if (holding == null) {
                Log.error("TradeJpaCm:sell User " + userID
                          + " attempted to sell holding " + holdingID
View Full Code Here

    }

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

    public AccountDataBean getAccountData(String userID) {
        if (Log.doTrace())
            Log.trace("TradeJpaCm:getAccountData", userID);

        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());

        return account;
    }
View Full Code Here

    public AccountProfileDataBean getAccountProfileData(String userID) {
        if (Log.doTrace())
            Log.trace("TradeJpaCm:getProfileData", userID);

        AccountProfileDataBeanImpl apb = entityManager.find(AccountProfileDataBeanImpl.class, userID);
        return apb;
    }
View Full Code Here

         *
         * //TODO this might not be correct temp =
         * entityManager.merge(profileData); //System.out.println(temp);
         */

        AccountProfileDataBeanImpl temp = entityManager.find(AccountProfileDataBeanImpl.class, userID);
        temp.setAddress(address);
        temp.setPassword(password);
        temp.setFullName(fullName);
        temp.setCreditCard(creditcard);
        temp.setEmail(email);
        entityManager.merge(temp);

        return temp;
    }
View Full Code Here

    }

    public AccountDataBean login(String userID, String password)
    throws Exception {

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

        if (profile == null) {
            throw new RuntimeException("No such user: " + userID);
        }
        entityManager.merge(profile);

        AccountDataBean account = profile.getAccount();

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

        account.login(password);
View Full Code Here

    public void logout(String userID) throws Exception {
        if (Log.doTrace())
            Log.trace("TradeJpaCm:logout", userID);

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

        account.logout();

        if (Log.doTrace())
            Log.trace("TradeJpaCm:logout(" + userID + ") success");
View Full Code Here

                                    String address,
                                    String email,
                                    String creditcard,
                                    BigDecimal openBalance) throws Exception {
        AccountDataBeanImpl account = null;
        AccountProfileDataBeanImpl profile = null;

        if (Log.doTrace())
            Log.trace("TradeJpaCm:register", userID, password, fullname, address, email, creditcard, openBalance);

        // Check to see if a profile with the desired userID already exists

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

        if (profile != null) {
            Log.error("Failed to register new Account - AccountProfile with userID(" + userID + ") already exists");
            return null;
        }
        else {
            profile = new AccountProfileDataBeanImpl(userID, password, fullname,
                                                 address, email, creditcard);
            account = new AccountDataBeanImpl(0, 0, null, new Timestamp(System.currentTimeMillis()), openBalance, openBalance, userID);
            profile.setAccount((AccountDataBean)account);
            account.setProfile((AccountProfileDataBean)profile);
            entityManager.persist(profile);
            entityManager.persist(account);
            // Uncomment this line to verify that datasources has been enlisted.  After rebuild attempt to register a user with
            // a user id "fail".  After the exception is thrown the database should not contain the user "fail" even though
View Full Code Here

            if (Log.doTrace())
                Log.trace("TradeJpaAm:buy", userID, symbol, quantity, orderProcessingMode);

            entityManager.getTransaction().begin();

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

            QuoteDataBeanImpl quote = entityManager.find(QuoteDataBeanImpl.class, symbol);

            HoldingDataBeanImpl holding = null; // The holding will be created by this buy order
View Full Code Here

TOP

Related Classes of org.apache.aries.samples.ariestrader.entities.AccountProfileDataBeanImpl

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.