org.apache.aries.samples.ariestrader.persist.jpa.am
Class TradeJpaAm
java.lang.Object
org.apache.aries.samples.ariestrader.persist.jpa.am.TradeJpaAm
- All Implemented Interfaces:
- Remote, TradeServices
public class TradeJpaAm
- extends Object
- implements TradeServices
TradeJpaAm uses JPA via a Application Managed (AM)
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 |
TradeJpaAm()
Zero arg constructor for TradeJpaAm |
|
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 |
setEmf(javax.persistence.EntityManagerFactory emf)
|
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 |
TradeJpaAm
public TradeJpaAm()
- Zero arg constructor for TradeJpaAm
setEmf
public void setEmf(javax.persistence.EntityManagerFactory emf)
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)
- Specified by:
buy in interface TradeServices
sell
public OrderDataBean sell(String userID,
Integer holdingID,
int orderProcessingMode)
- Specified by:
sell in interface TradeServices
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)
- Specified by:
cancelOrder in interface TradeServices
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)
- Specified by:
getClosedOrders in interface TradeServices
createQuote
public QuoteDataBean createQuote(String symbol,
String companyName,
BigDecimal price)
- Specified by:
createQuote in interface TradeServices
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)
- Specified by:
updateQuotePriceVolume in interface TradeServices
getHoldings
public Collection<HoldingDataBean> getHoldings(String userID)
- Specified by:
getHoldings in interface TradeServices
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)
- Specified by:
logout in interface TradeServices
register
public AccountDataBean register(String userID,
String password,
String fullname,
String address,
String email,
String creditcard,
BigDecimal openBalance)
- Specified by:
register in interface TradeServices
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.