geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cjbly...@apache.org
Subject svn commit: r579825 - /geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/TradeSLSBBean.java
Date Wed, 26 Sep 2007 22:12:34 GMT
Author: cjblythe
Date: Wed Sep 26 15:12:33 2007
New Revision: 579825

URL: http://svn.apache.org/viewvc?rev=579825&view=rev
Log:
DAYTRADER-55 Added logic to TradeSLSBBean to detect/prevent duplicate sell operations on the
same holding

Modified:
    geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/TradeSLSBBean.java

Modified: geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/TradeSLSBBean.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/TradeSLSBBean.java?rev=579825&r1=579824&r2=579825&view=diff
==============================================================================
--- geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/TradeSLSBBean.java
(original)
+++ geronimo/daytrader/trunk/modules/ejb/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/TradeSLSBBean.java
Wed Sep 26 15:12:33 2007
@@ -170,6 +170,16 @@
             AccountProfileDataBean profile = entityManager.find(AccountProfileDataBean.class,
userID);
             AccountDataBean account = profile.getAccount();
             HoldingDataBean holding = entityManager.find(HoldingDataBean.class, holdingID);
+            
+            if (holding == null) {
+                Log.error("TradeSLSBBean:sell User " + userID + " attempted to sell holding
" + holdingID + " which has already been sold");
+                
+                OrderDataBean orderData = new OrderDataBean();
+                orderData.setOrderStatus("cancelled");
+                entityManager.persist(orderData);
+                
+                return orderData;
+            }            
 
             QuoteDataBean quote = holding.getQuote();
             double quantity = holding.getQuantity();



Mime
View raw message