org.apache.aries.samples.ariestrader.persist.jpa.cm
Class TradeJpaCm

java.lang.Object
  extended by org.apache.aries.samples.ariestrader.persist.jpa.cm.TradeJpaCm
All Implemented Interfaces:
Remote, TradeServices

public class TradeJpaCm
extends Object
implements TradeServices

TradeJpaCm uses JPA via Container Managed (CM) Entity Managers to implement the business methods of the Trade online broker application. These business methods represent the features and operations that can be performed by customers of the brokerage such as login, logout, get a stock quote, buy or sell a stock, etc. and are specified in the org.apache.aries.samples.ariestrader.TradeServices interface

See Also:
org.apache.aries.samples.ariestrader.TradeServices

Constructor Summary
TradeJpaCm()
          Zero arg constructor for TradeJpaCm
 
Method Summary
 OrderDataBean buy(String userID, String symbol, double quantity, int orderProcessingMode)
           
 void cancelOrder(Integer orderID, boolean twoPhase)
           
 OrderDataBean completeOrder(Integer orderID, boolean twoPhase)
           
 QuoteDataBean createQuote(String symbol, String companyName, BigDecimal price)
           
 void destroy()
           
 AccountDataBean getAccountData(String userID)
           
 AccountProfileDataBean getAccountProfileData(String userID)
           
 Collection<QuoteDataBean> getAllQuotes()
           
 Collection<OrderDataBean> getClosedOrders(String userID)
           
 HoldingDataBean getHolding(Integer holdingID)
           
 Collection<HoldingDataBean> getHoldings(String userID)
           
 MarketSummaryDataBean getMarketSummary()
           
 TradeConfig.ModeType getMode()
          Get mode - returns the persistence mode (TradeConfig.JPA)
 Collection<OrderDataBean> getOrders(String userID)
           
 QuoteDataBean getQuote(String symbol)
           
 void init()
           
 double investmentReturn(double investment, double NetValue)
           
 AccountDataBean login(String userID, String password)
           
 void logout(String userID)
           
 void orderCompleted(String userID, Integer orderID)
           
 QuoteDataBean pingTwoPhase(String symbol)
           
 void queueOrder(Integer orderID, boolean twoPhase)
           
 AccountDataBean register(String userID, String password, String fullname, String address, String email, String creditcard, BigDecimal openBalance)
           
 OrderDataBean sell(String userID, Integer holdingID, int orderProcessingMode)
           
 void setEntityManager(javax.persistence.EntityManager em)
           
 AccountProfileDataBean updateAccountProfile(String userID, String password, String fullName, String address, String email, String creditcard)
           
 QuoteDataBean updateQuotePriceVolume(String symbol, BigDecimal changeFactor, double sharesTraded)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TradeJpaCm

public TradeJpaCm()
Zero arg constructor for TradeJpaCm

Method Detail

setEntityManager

public void setEntityManager(javax.persistence.EntityManager em)

init

public void init()

destroy

public void destroy()

getMarketSummary

public MarketSummaryDataBean getMarketSummary()
Specified by:
getMarketSummary in interface TradeServices

buy

public OrderDataBean buy(String userID,
                         String symbol,
                         double quantity,
                         int orderProcessingMode)
                  throws Exception
Specified by:
buy in interface TradeServices
Throws:
Exception

sell

public OrderDataBean sell(String userID,
                          Integer holdingID,
                          int orderProcessingMode)
                   throws Exception
Specified by:
sell in interface TradeServices
Throws:
Exception

queueOrder

public void queueOrder(Integer orderID,
                       boolean twoPhase)
Specified by:
queueOrder in interface TradeServices

completeOrder

public OrderDataBean completeOrder(Integer orderID,
                                   boolean twoPhase)
                            throws Exception
Specified by:
completeOrder in interface TradeServices
Throws:
Exception

cancelOrder

public void cancelOrder(Integer orderID,
                        boolean twoPhase)
                 throws Exception
Specified by:
cancelOrder in interface TradeServices
Throws:
Exception

orderCompleted

public void orderCompleted(String userID,
                           Integer orderID)
Specified by:
orderCompleted in interface TradeServices

getOrders

public Collection<OrderDataBean> getOrders(String userID)
Specified by:
getOrders in interface TradeServices

getClosedOrders

public Collection<OrderDataBean> getClosedOrders(String userID)
                                          throws Exception
Specified by:
getClosedOrders in interface TradeServices
Throws:
Exception

createQuote

public QuoteDataBean createQuote(String symbol,
                                 String companyName,
                                 BigDecimal price)
                          throws Exception
Specified by:
createQuote in interface TradeServices
Throws:
Exception

getQuote

public QuoteDataBean getQuote(String symbol)
Specified by:
getQuote in interface TradeServices

getAllQuotes

public Collection<QuoteDataBean> getAllQuotes()
Specified by:
getAllQuotes in interface TradeServices

updateQuotePriceVolume

public QuoteDataBean updateQuotePriceVolume(String symbol,
                                            BigDecimal changeFactor,
                                            double sharesTraded)
                                     throws Exception
Specified by:
updateQuotePriceVolume in interface TradeServices
Throws:
Exception

getHoldings

public Collection<HoldingDataBean> getHoldings(String userID)
                                        throws Exception
Specified by:
getHoldings in interface TradeServices
Throws:
Exception

getHolding

public HoldingDataBean getHolding(Integer holdingID)
Specified by:
getHolding in interface TradeServices

getAccountData

public AccountDataBean getAccountData(String userID)
Specified by:
getAccountData in interface TradeServices

getAccountProfileData

public AccountProfileDataBean getAccountProfileData(String userID)
Specified by:
getAccountProfileData in interface TradeServices

updateAccountProfile

public AccountProfileDataBean updateAccountProfile(String userID,
                                                   String password,
                                                   String fullName,
                                                   String address,
                                                   String email,
                                                   String creditcard)
                                            throws Exception
Specified by:
updateAccountProfile in interface TradeServices
Throws:
Exception

login

public AccountDataBean login(String userID,
                             String password)
                      throws Exception
Specified by:
login in interface TradeServices
Throws:
Exception

logout

public void logout(String userID)
            throws Exception
Specified by:
logout in interface TradeServices
Throws:
Exception

register

public AccountDataBean register(String userID,
                                String password,
                                String fullname,
                                String address,
                                String email,
                                String creditcard,
                                BigDecimal openBalance)
                         throws Exception
Specified by:
register in interface TradeServices
Throws:
Exception

investmentReturn

public double investmentReturn(double investment,
                               double NetValue)
                        throws Exception
Throws:
Exception

pingTwoPhase

public QuoteDataBean pingTwoPhase(String symbol)
                           throws Exception
Throws:
Exception

getMode

public TradeConfig.ModeType getMode()
Get mode - returns the persistence mode (TradeConfig.JPA)

Specified by:
getMode in interface TradeServices
Returns:
TradeConfig.ModeType


Copyright © 2009-2012 The Apache Software Foundation. All Rights Reserved.