You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dw...@apache.org on 2009/08/31 20:48:45 UTC
svn commit: r809686 [1/6] - in /geronimo/daytrader/trunk/modules: ./ beans/
beans/src/ beans/src/main/ beans/src/main/java/ beans/src/main/java/org/
beans/src/main/java/org/apache/ beans/src/main/java/org/apache/geronimo/
beans/src/main/java/org/apache...
Author: dwoods
Date: Mon Aug 31 18:48:41 2009
New Revision: 809686
URL: http://svn.apache.org/viewvc?rev=809686&view=rev
Log:
quick checkin of module changes, but don't try to build them yet...
Added:
geronimo/daytrader/trunk/modules/beans/
geronimo/daytrader/trunk/modules/beans/pom.xml (with props)
geronimo/daytrader/trunk/modules/beans/src/
geronimo/daytrader/trunk/modules/beans/src/main/
geronimo/daytrader/trunk/modules/beans/src/main/java/
geronimo/daytrader/trunk/modules/beans/src/main/java/org/
geronimo/daytrader/trunk/modules/beans/src/main/java/org/apache/
geronimo/daytrader/trunk/modules/beans/src/main/java/org/apache/geronimo/
geronimo/daytrader/trunk/modules/beans/src/main/java/org/apache/geronimo/samples/
geronimo/daytrader/trunk/modules/beans/src/main/java/org/apache/geronimo/samples/daytrader/
geronimo/daytrader/trunk/modules/beans/src/main/java/org/apache/geronimo/samples/daytrader/AccountDataBean.java (with props)
geronimo/daytrader/trunk/modules/beans/src/main/java/org/apache/geronimo/samples/daytrader/AccountProfileDataBean.java (with props)
geronimo/daytrader/trunk/modules/beans/src/main/java/org/apache/geronimo/samples/daytrader/HoldingDataBean.java (with props)
geronimo/daytrader/trunk/modules/beans/src/main/java/org/apache/geronimo/samples/daytrader/OrderDataBean.java (with props)
geronimo/daytrader/trunk/modules/beans/src/main/java/org/apache/geronimo/samples/daytrader/QuoteDataBean.java (with props)
geronimo/daytrader/trunk/modules/beans/src/main/resources/
geronimo/daytrader/trunk/modules/beans/src/main/resources/META-INF/
geronimo/daytrader/trunk/modules/beans/src/main/resources/META-INF/LICENSE
geronimo/daytrader/trunk/modules/beans/src/main/resources/META-INF/NOTICE
geronimo/daytrader/trunk/modules/beans/src/test/
geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/FinancialUtils.java (with props)
geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/direct/TradeJDBCDirect.java
geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/direct/TradeJEEDirect.java
- copied, changed from r809008, geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/direct/TradeDirect.java
geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/direct/TradeJPADirect.java (with props)
geronimo/daytrader/trunk/modules/entities/
geronimo/daytrader/trunk/modules/entities/pom.xml (with props)
geronimo/daytrader/trunk/modules/entities/src/
geronimo/daytrader/trunk/modules/entities/src/main/
geronimo/daytrader/trunk/modules/entities/src/main/java/
geronimo/daytrader/trunk/modules/entities/src/main/java/org/
geronimo/daytrader/trunk/modules/entities/src/main/java/org/apache/
geronimo/daytrader/trunk/modules/entities/src/main/java/org/apache/geronimo/
geronimo/daytrader/trunk/modules/entities/src/main/java/org/apache/geronimo/samples/
geronimo/daytrader/trunk/modules/entities/src/main/java/org/apache/geronimo/samples/daytrader/
geronimo/daytrader/trunk/modules/entities/src/main/java/org/apache/geronimo/samples/daytrader/AccountDataBean.java (with props)
geronimo/daytrader/trunk/modules/entities/src/main/java/org/apache/geronimo/samples/daytrader/AccountProfileDataBean.java (with props)
geronimo/daytrader/trunk/modules/entities/src/main/java/org/apache/geronimo/samples/daytrader/HoldingDataBean.java (with props)
geronimo/daytrader/trunk/modules/entities/src/main/java/org/apache/geronimo/samples/daytrader/OrderDataBean.java (with props)
geronimo/daytrader/trunk/modules/entities/src/main/java/org/apache/geronimo/samples/daytrader/QuoteDataBean.java (with props)
geronimo/daytrader/trunk/modules/entities/src/main/resources/
geronimo/daytrader/trunk/modules/entities/src/main/resources/META-INF/
geronimo/daytrader/trunk/modules/entities/src/main/resources/META-INF/LICENSE
geronimo/daytrader/trunk/modules/entities/src/main/resources/META-INF/NOTICE
geronimo/daytrader/trunk/modules/entities/src/main/resources/META-INF/persistence.xml (with props)
geronimo/daytrader/trunk/modules/entities/src/test/
geronimo/daytrader/trunk/modules/util/
geronimo/daytrader/trunk/modules/util/pom.xml (with props)
geronimo/daytrader/trunk/modules/util/src/
geronimo/daytrader/trunk/modules/util/src/main/
geronimo/daytrader/trunk/modules/util/src/main/java/
geronimo/daytrader/trunk/modules/util/src/main/java/org/
geronimo/daytrader/trunk/modules/util/src/main/java/org/apache/
geronimo/daytrader/trunk/modules/util/src/main/java/org/apache/geronimo/
geronimo/daytrader/trunk/modules/util/src/main/java/org/apache/geronimo/samples/
geronimo/daytrader/trunk/modules/util/src/main/java/org/apache/geronimo/samples/daytrader/
geronimo/daytrader/trunk/modules/util/src/main/java/org/apache/geronimo/samples/daytrader/util/
geronimo/daytrader/trunk/modules/util/src/main/java/org/apache/geronimo/samples/daytrader/util/KeyBlock.java (with props)
geronimo/daytrader/trunk/modules/util/src/main/java/org/apache/geronimo/samples/daytrader/util/Log.java (with props)
geronimo/daytrader/trunk/modules/util/src/main/java/org/apache/geronimo/samples/daytrader/util/MDBStats.java (with props)
geronimo/daytrader/trunk/modules/util/src/main/java/org/apache/geronimo/samples/daytrader/util/TimerStat.java (with props)
geronimo/daytrader/trunk/modules/util/src/main/java/org/apache/geronimo/samples/daytrader/util/TradeConfig.java (with props)
geronimo/daytrader/trunk/modules/util/src/main/resources/
geronimo/daytrader/trunk/modules/util/src/main/resources/META-INF/
geronimo/daytrader/trunk/modules/util/src/main/resources/META-INF/LICENSE
geronimo/daytrader/trunk/modules/util/src/main/resources/META-INF/NOTICE
geronimo/daytrader/trunk/modules/util/src/test/
Removed:
geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/AccountDataBean.java
geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/AccountProfileDataBean.java
geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/HoldingDataBean.java
geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/OrderDataBean.java
geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/QuoteDataBean.java
geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/TradeConfig.java
geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/direct/TradeDirect.java
geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/util/
geronimo/daytrader/trunk/modules/core/src/main/resources/META-INF/daytrader.sql
geronimo/daytrader/trunk/modules/core/src/main/resources/META-INF/jboss.xml
geronimo/daytrader/trunk/modules/core/src/main/resources/META-INF/jboss.xml.old
geronimo/daytrader/trunk/modules/core/src/main/resources/META-INF/jbosscmp-jdbc.xml.old
geronimo/daytrader/trunk/modules/core/src/main/resources/META-INF/persistence.xml
Modified:
geronimo/daytrader/trunk/modules/core/pom.xml
geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/MarketSummaryDataBean.java
geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/MarketSummaryDataBeanWS.java
geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/TradeAction.java
geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/direct/KeySequenceDirect.java
geronimo/daytrader/trunk/modules/ejb3/pom.xml
geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/DTBroker3MDB.java
geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/DirectSLSBBean.java
geronimo/daytrader/trunk/modules/ejb3/src/main/java/org/apache/geronimo/samples/daytrader/ejb3/TradeSLSBBean.java
geronimo/daytrader/trunk/modules/pom.xml
geronimo/daytrader/trunk/modules/soap/pom.xml
geronimo/daytrader/trunk/modules/streamer/pom.xml
geronimo/daytrader/trunk/modules/web/pom.xml
geronimo/daytrader/trunk/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/OrdersAlertFilter.java
geronimo/daytrader/trunk/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/TestServlet.java
geronimo/daytrader/trunk/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/TradeAppServlet.java
geronimo/daytrader/trunk/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/TradeBuildDB.java
geronimo/daytrader/trunk/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/TradeConfigServlet.java
geronimo/daytrader/trunk/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/TradeScenarioServlet.java
geronimo/daytrader/trunk/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/TradeServletAction.java
geronimo/daytrader/trunk/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/TradeWebContextListener.java
geronimo/daytrader/trunk/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/prims/ejb3/PingServlet2Entity.java
geronimo/daytrader/trunk/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/prims/ejb3/PingServlet2MDBQueue.java
geronimo/daytrader/trunk/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/prims/ejb3/PingServlet2MDBTopic.java
geronimo/daytrader/trunk/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/prims/ejb3/PingServlet2Session.java
geronimo/daytrader/trunk/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/prims/ejb3/PingServlet2Session2CMROne2Many.java
geronimo/daytrader/trunk/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/prims/ejb3/PingServlet2Session2CMROne2One.java
geronimo/daytrader/trunk/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/prims/ejb3/PingServlet2Session2Entity.java
geronimo/daytrader/trunk/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/prims/ejb3/PingServlet2Session2EntityCollection.java
geronimo/daytrader/trunk/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/prims/ejb3/PingServlet2Session2JDBC.java
geronimo/daytrader/trunk/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/prims/ejb3/PingServlet2Session2JDBCCollection.java
geronimo/daytrader/trunk/modules/web/src/main/java/org/apache/geronimo/samples/daytrader/web/prims/ejb3/PingServlet2TwoPhase.java
geronimo/daytrader/trunk/modules/wsappclient/pom.xml
Added: geronimo/daytrader/trunk/modules/beans/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/beans/pom.xml?rev=809686&view=auto
==============================================================================
--- geronimo/daytrader/trunk/modules/beans/pom.xml (added)
+++ geronimo/daytrader/trunk/modules/beans/pom.xml Mon Aug 31 18:48:41 2009
@@ -0,0 +1,153 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.geronimo.daytrader</groupId>
+ <artifactId>modules</artifactId>
+ <version>2.2-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.geronimo.daytrader.modules</groupId>
+ <artifactId>daytrader-beans</artifactId>
+ <packaging>jar</packaging>
+ <name>DayTrader :: Modules - Beans</name>
+ <description>Daytrader UnEnhanced Enttities Module</description>
+
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/geronimo/daytrader/trunk/modules/beans</connection>
+ <developerConnection>scm:svn:http://svn.apache.org/repos/asf/geronimo/daytrader/trunk/modules/beans</developerConnection>
+ <url>http://svn.apache.org/viewcvs.cgi/geronimo/daytrader/trunk/modules/beans</url>
+ </scm>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.geronimo.daytrader.modules</groupId>
+ <artifactId>daytrader-util</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+<!--
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jms_1.1_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jta_1.1_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-jpa_3.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-annotation_1.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-ejb_3.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+-->
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+<!-- OpenJPA depends
+ <dependency>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ OpenJPA PCEnhancer depends
+ <dependency>
+ <groupId>net.sourceforge.serp</groupId>
+ <artifactId>serp</artifactId>
+ <version>1.13.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.4</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>3.2.1</version>
+ <scope>provided</scope>
+ </dependency>
+ end OpenJPA PCEnhancer depends -->
+ </dependencies>
+ <build>
+ <resources>
+ <resource>
+ <directory>${basedir}/src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+<!--
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>compile</phase>
+ <configuration>
+ <tasks>
+ <path id="enhance.path.ref">
+ <fileset dir="${project.build.outputDirectory}">
+ <include name="*Bean*/*.class"/>
+ </fileset>
+ </path>
+ <pathconvert property="enhance.files"
+ refid="enhance.path.ref"
+ pathsep=" "/>
+ <java classname="org.apache.openjpa.enhance.PCEnhancer">
+ <arg line="-p persistence.xml"/>
+ <arg line="${enhance.files}"/>
+ <classpath>
+ <path refid="maven.dependency.classpath"/>
+ <path refid="maven.compile.classpath"/>
+ </classpath>
+ </java>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+-->
+ </build>
+</project>
Propchange: geronimo/daytrader/trunk/modules/beans/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: geronimo/daytrader/trunk/modules/beans/src/main/java/org/apache/geronimo/samples/daytrader/AccountDataBean.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/beans/src/main/java/org/apache/geronimo/samples/daytrader/AccountDataBean.java?rev=809686&view=auto
==============================================================================
--- geronimo/daytrader/trunk/modules/beans/src/main/java/org/apache/geronimo/samples/daytrader/AccountDataBean.java (added)
+++ geronimo/daytrader/trunk/modules/beans/src/main/java/org/apache/geronimo/samples/daytrader/AccountDataBean.java Mon Aug 31 18:48:41 2009
@@ -0,0 +1,273 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.samples.daytrader;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.util.Collection;
+import java.util.Date;
+
+import org.apache.geronimo.samples.daytrader.util.Log;
+import org.apache.geronimo.samples.daytrader.util.TradeConfig;
+
+
+public class AccountDataBean implements Serializable {
+
+ private Integer accountID; /* accountID */
+
+
+ private int loginCount; /* loginCount */
+
+
+ private int logoutCount; /* logoutCount */
+
+
+ private Date lastLogin; /* lastLogin Date */
+
+
+ private Date creationDate; /* creationDate */
+
+
+ private BigDecimal balance; /* balance */
+
+
+ private BigDecimal openBalance; /* open balance */
+
+
+ private Collection<OrderDataBean> orders;
+
+
+ private Collection<HoldingDataBean> holdings;
+
+
+ private AccountProfileDataBean profile;
+
+// @Version
+// private Integer optLock;
+
+ /* Accessor methods for relationship fields are only included for the AccountProfile profileID */
+
+ private String profileID;
+
+ public AccountDataBean() {
+ }
+
+ public AccountDataBean(Integer accountID,
+ int loginCount,
+ int logoutCount,
+ Date lastLogin,
+ Date creationDate,
+ BigDecimal balance,
+ BigDecimal openBalance,
+ String profileID) {
+ setAccountID(accountID);
+ setLoginCount(loginCount);
+ setLogoutCount(logoutCount);
+ setLastLogin(lastLogin);
+ setCreationDate(creationDate);
+ setBalance(balance);
+ setOpenBalance(openBalance);
+ setProfileID(profileID);
+ }
+
+ public AccountDataBean(int loginCount,
+ int logoutCount,
+ Date lastLogin,
+ Date creationDate,
+ BigDecimal balance,
+ BigDecimal openBalance,
+ String profileID) {
+ setLoginCount(loginCount);
+ setLogoutCount(logoutCount);
+ setLastLogin(lastLogin);
+ setCreationDate(creationDate);
+ setBalance(balance);
+ setOpenBalance(openBalance);
+ setProfileID(profileID);
+ }
+
+ public static AccountDataBean getRandomInstance() {
+ return new AccountDataBean(new Integer(TradeConfig.rndInt(100000)), //accountID
+ TradeConfig.rndInt(10000), //loginCount
+ TradeConfig.rndInt(10000), //logoutCount
+ new java.util.Date(), //lastLogin
+ new java.util.Date(TradeConfig.rndInt(Integer.MAX_VALUE)), //creationDate
+ TradeConfig.rndBigDecimal(1000000.0f), //balance
+ TradeConfig.rndBigDecimal(1000000.0f), //openBalance
+ TradeConfig.rndUserID() //profileID
+ );
+ }
+
+ public String toString() {
+ return "\n\tAccount Data for account: " + getAccountID()
+ + "\n\t\t loginCount:" + getLoginCount()
+ + "\n\t\t logoutCount:" + getLogoutCount()
+ + "\n\t\t lastLogin:" + getLastLogin()
+ + "\n\t\t creationDate:" + getCreationDate()
+ + "\n\t\t balance:" + getBalance()
+ + "\n\t\t openBalance:" + getOpenBalance()
+ + "\n\t\t profileID:" + getProfileID()
+ ;
+ }
+
+ public String toHTML() {
+ return "<BR>Account Data for account: <B>" + getAccountID() + "</B>"
+ + "<LI> loginCount:" + getLoginCount() + "</LI>"
+ + "<LI> logoutCount:" + getLogoutCount() + "</LI>"
+ + "<LI> lastLogin:" + getLastLogin() + "</LI>"
+ + "<LI> creationDate:" + getCreationDate() + "</LI>"
+ + "<LI> balance:" + getBalance() + "</LI>"
+ + "<LI> openBalance:" + getOpenBalance() + "</LI>"
+ + "<LI> profileID:" + getProfileID() + "</LI>"
+ ;
+ }
+
+ public void print() {
+ Log.log(this.toString());
+ }
+
+ public Integer getAccountID() {
+ return accountID;
+ }
+
+ public void setAccountID(Integer accountID) {
+ this.accountID = accountID;
+ }
+
+ public int getLoginCount() {
+ return loginCount;
+ }
+
+ public void setLoginCount(int loginCount) {
+ this.loginCount = loginCount;
+ }
+
+ public int getLogoutCount() {
+ return logoutCount;
+ }
+
+ public void setLogoutCount(int logoutCount) {
+ this.logoutCount = logoutCount;
+ }
+
+ public Date getLastLogin() {
+ return lastLogin;
+ }
+
+ public void setLastLogin(Date lastLogin) {
+ this.lastLogin = lastLogin;
+ }
+
+ public Date getCreationDate() {
+ return creationDate;
+ }
+
+ public void setCreationDate(Date creationDate) {
+ this.creationDate = creationDate;
+ }
+
+ public BigDecimal getBalance() {
+ return balance;
+ }
+
+ public void setBalance(BigDecimal balance) {
+ this.balance = balance;
+ }
+
+ public BigDecimal getOpenBalance() {
+ return openBalance;
+ }
+
+ public void setOpenBalance(BigDecimal openBalance) {
+ this.openBalance = openBalance;
+ }
+
+ public String getProfileID() {
+ return profileID;
+ }
+
+ public void setProfileID(String profileID) {
+ this.profileID = profileID;
+ }
+
+ /* Disabled for D185273
+ public String getUserID() {
+ return getProfileID();
+ }
+ */
+
+ public Collection<OrderDataBean> getOrders() {
+ return orders;
+ }
+
+ public void setOrders(Collection<OrderDataBean> orders) {
+ this.orders = orders;
+ }
+
+ public Collection<HoldingDataBean> getHoldings() {
+ return holdings;
+ }
+
+ public void setHoldings(Collection<HoldingDataBean> holdings) {
+ this.holdings = holdings;
+ }
+
+ public AccountProfileDataBean getProfile() {
+ return profile;
+ }
+
+ public void setProfile(AccountProfileDataBean profile) {
+ this.profile = profile;
+ }
+
+ public void login(String password) {
+ AccountProfileDataBean profile = getProfile();
+ if ((profile == null) || (profile.getPassword().equals(password) == false)) {
+ String error = "AccountBean:Login failure for account: " + getAccountID() +
+ ((profile == null) ? "null AccountProfile" :
+ "\n\tIncorrect password-->" + profile.getUserID() + ":" + profile.getPassword());
+ throw new RuntimeException(error);
+
+ }
+
+ setLastLogin(new Timestamp(System.currentTimeMillis()));
+ setLoginCount(getLoginCount() + 1);
+ }
+
+ public void logout() {
+ setLogoutCount(getLogoutCount() + 1);
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 0;
+ hash += (this.accountID != null ? this.accountID.hashCode() : 0);
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ // TODO: Warning - this method won't work in the case the id fields are not set
+ if (!(object instanceof AccountDataBean)) {
+ return false;
+ }
+ AccountDataBean other = (AccountDataBean)object;
+ if (this.accountID != other.accountID && (this.accountID == null || !this.accountID.equals(other.accountID))) return false;
+ return true;
+ }
+}
\ No newline at end of file
Propchange: geronimo/daytrader/trunk/modules/beans/src/main/java/org/apache/geronimo/samples/daytrader/AccountDataBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: geronimo/daytrader/trunk/modules/beans/src/main/java/org/apache/geronimo/samples/daytrader/AccountProfileDataBean.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/beans/src/main/java/org/apache/geronimo/samples/daytrader/AccountProfileDataBean.java?rev=809686&view=auto
==============================================================================
--- geronimo/daytrader/trunk/modules/beans/src/main/java/org/apache/geronimo/samples/daytrader/AccountProfileDataBean.java (added)
+++ geronimo/daytrader/trunk/modules/beans/src/main/java/org/apache/geronimo/samples/daytrader/AccountProfileDataBean.java Mon Aug 31 18:48:41 2009
@@ -0,0 +1,174 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.samples.daytrader;
+
+import org.apache.geronimo.samples.daytrader.util.Log;
+import org.apache.geronimo.samples.daytrader.util.TradeConfig;
+
+
+public class AccountProfileDataBean implements java.io.Serializable {
+
+
+ private String userID; /* userID */
+
+
+ private String passwd; /* password */
+
+
+ private String fullName; /* fullName */
+
+
+ private String address; /* address */
+
+
+ private String email; /* email */
+
+
+ private String creditCard; /* creditCard */
+
+
+ private AccountDataBean account;
+
+// @Version
+// private Integer optLock;
+
+ public AccountProfileDataBean() {
+ }
+
+ public AccountProfileDataBean(String userID,
+ String password,
+ String fullName,
+ String address,
+ String email,
+ String creditCard) {
+ setUserID(userID);
+ setPassword(password);
+ setFullName(fullName);
+ setAddress(address);
+ setEmail(email);
+ setCreditCard(creditCard);
+ }
+
+ public static AccountProfileDataBean getRandomInstance() {
+ return new AccountProfileDataBean(
+ TradeConfig.rndUserID(), // userID
+ TradeConfig.rndUserID(), // passwd
+ TradeConfig.rndFullName(), // fullname
+ TradeConfig.rndAddress(), // address
+ TradeConfig.rndEmail(TradeConfig.rndUserID()), //email
+ TradeConfig.rndCreditCard() // creditCard
+ );
+ }
+
+ public String toString() {
+ return "\n\tAccount Profile Data for userID:" + getUserID()
+ + "\n\t\t passwd:" + getPassword()
+ + "\n\t\t fullName:" + getFullName()
+ + "\n\t\t address:" + getAddress()
+ + "\n\t\t email:" + getEmail()
+ + "\n\t\t creditCard:" + getCreditCard()
+ ;
+ }
+
+ public String toHTML() {
+ return "<BR>Account Profile Data for userID: <B>" + getUserID() + "</B>"
+ + "<LI> passwd:" + getPassword() + "</LI>"
+ + "<LI> fullName:" + getFullName() + "</LI>"
+ + "<LI> address:" + getAddress() + "</LI>"
+ + "<LI> email:" + getEmail() + "</LI>"
+ + "<LI> creditCard:" + getCreditCard() + "</LI>"
+ ;
+ }
+
+ public void print() {
+ Log.log(this.toString());
+ }
+
+ public String getUserID() {
+ return userID;
+ }
+
+ public void setUserID(String userID) {
+ this.userID = userID;
+ }
+
+ public String getPassword() {
+ return passwd;
+ }
+
+ public void setPassword(String password) {
+ this.passwd = password;
+ }
+
+ public String getFullName() {
+ return fullName;
+ }
+
+ public void setFullName(String fullName) {
+ this.fullName = fullName;
+ }
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public String getCreditCard() {
+ return creditCard;
+ }
+
+ public void setCreditCard(String creditCard) {
+ this.creditCard = creditCard;
+ }
+
+ public AccountDataBean getAccount() {
+ return account;
+ }
+
+ public void setAccount(AccountDataBean account) {
+ this.account = account;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 0;
+ hash += (this.userID != null ? this.userID.hashCode() : 0);
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ // TODO: Warning - this method won't work in the case the id fields are not set
+ if (!(object instanceof AccountProfileDataBean)) {
+ return false;
+ }
+ AccountProfileDataBean other = (AccountProfileDataBean)object;
+ if (this.userID != other.userID && (this.userID == null || !this.userID.equals(other.userID))) return false;
+ return true;
+ }
+}
Propchange: geronimo/daytrader/trunk/modules/beans/src/main/java/org/apache/geronimo/samples/daytrader/AccountProfileDataBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: geronimo/daytrader/trunk/modules/beans/src/main/java/org/apache/geronimo/samples/daytrader/HoldingDataBean.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/beans/src/main/java/org/apache/geronimo/samples/daytrader/HoldingDataBean.java?rev=809686&view=auto
==============================================================================
--- geronimo/daytrader/trunk/modules/beans/src/main/java/org/apache/geronimo/samples/daytrader/HoldingDataBean.java (added)
+++ geronimo/daytrader/trunk/modules/beans/src/main/java/org/apache/geronimo/samples/daytrader/HoldingDataBean.java Mon Aug 31 18:48:41 2009
@@ -0,0 +1,196 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.samples.daytrader;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+import org.apache.geronimo.samples.daytrader.util.Log;
+import org.apache.geronimo.samples.daytrader.util.TradeConfig;
+
+
+public class HoldingDataBean implements Serializable {
+
+ /* persistent/relationship fields */
+
+
+ private Integer holdingID; /* holdingID */
+
+
+ private double quantity; /* quantity */
+
+
+ private BigDecimal purchasePrice; /* purchasePrice */
+
+
+ private Date purchaseDate; /* purchaseDate */
+
+
+ private String quoteID; /* Holding(*) ---> Quote(1) */
+
+
+ private AccountDataBean account;
+
+
+ private QuoteDataBean quote;
+
+// @Version
+// private Integer optLock;
+
+ public HoldingDataBean() {
+ }
+
+ public HoldingDataBean(Integer holdingID,
+ double quantity,
+ BigDecimal purchasePrice,
+ Date purchaseDate,
+ String quoteID) {
+ setHoldingID(holdingID);
+ setQuantity(quantity);
+ setPurchasePrice(purchasePrice);
+ setPurchaseDate(purchaseDate);
+ setQuoteID(quoteID);
+ }
+
+ public HoldingDataBean(double quantity,
+ BigDecimal purchasePrice,
+ Date purchaseDate,
+ AccountDataBean account,
+ QuoteDataBean quote) {
+ setQuantity(quantity);
+ setPurchasePrice(purchasePrice);
+ setPurchaseDate(purchaseDate);
+ setAccount(account);
+ setQuote(quote);
+ }
+
+ public static HoldingDataBean getRandomInstance() {
+ return new HoldingDataBean(
+ new Integer(TradeConfig.rndInt(100000)), //holdingID
+ TradeConfig.rndQuantity(), //quantity
+ TradeConfig.rndBigDecimal(1000.0f), //purchasePrice
+ new java.util.Date(TradeConfig.rndInt(Integer.MAX_VALUE)), //purchaseDate
+ TradeConfig.rndSymbol() // symbol
+ );
+ }
+
+ public String toString() {
+ return "\n\tHolding Data for holding: " + getHoldingID()
+ + "\n\t\t quantity:" + getQuantity()
+ + "\n\t\t purchasePrice:" + getPurchasePrice()
+ + "\n\t\t purchaseDate:" + getPurchaseDate()
+ + "\n\t\t quoteID:" + getQuoteID()
+ ;
+ }
+
+ public String toHTML() {
+ return "<BR>Holding Data for holding: " + getHoldingID() + "</B>"
+ + "<LI> quantity:" + getQuantity() + "</LI>"
+ + "<LI> purchasePrice:" + getPurchasePrice() + "</LI>"
+ + "<LI> purchaseDate:" + getPurchaseDate() + "</LI>"
+ + "<LI> quoteID:" + getQuoteID() + "</LI>"
+ ;
+ }
+
+ public void print() {
+ Log.log(this.toString());
+ }
+
+ public Integer getHoldingID() {
+ return holdingID;
+ }
+
+ public void setHoldingID(Integer holdingID) {
+ this.holdingID = holdingID;
+ }
+
+ public double getQuantity() {
+ return quantity;
+ }
+
+ public void setQuantity(double quantity) {
+ this.quantity = quantity;
+ }
+
+ public BigDecimal getPurchasePrice() {
+ return purchasePrice;
+ }
+
+ public void setPurchasePrice(BigDecimal purchasePrice) {
+ this.purchasePrice = purchasePrice;
+ }
+
+ public Date getPurchaseDate() {
+ return purchaseDate;
+ }
+
+ public void setPurchaseDate(Date purchaseDate) {
+ this.purchaseDate = purchaseDate;
+ }
+
+ public String getQuoteID() {
+ if (quote != null) {
+ return quote.getSymbol();
+ }
+ return quoteID;
+ }
+
+ public void setQuoteID(String quoteID) {
+ this.quoteID = quoteID;
+ }
+
+ public AccountDataBean getAccount() {
+ return account;
+ }
+
+ public void setAccount(AccountDataBean account) {
+ this.account = account;
+ }
+
+ /* Disabled for D185273
+ public String getSymbol() {
+ return getQuoteID();
+ }
+ */
+
+ public QuoteDataBean getQuote() {
+ return quote;
+ }
+
+ public void setQuote(QuoteDataBean quote) {
+ this.quote = quote;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 0;
+ hash += (this.holdingID != null ? this.holdingID.hashCode() : 0);
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ // TODO: Warning - this method won't work in the case the id fields are not set
+ if (!(object instanceof HoldingDataBean)) {
+ return false;
+ }
+ HoldingDataBean other = (HoldingDataBean) object;
+ if (this.holdingID != other.holdingID && (this.holdingID == null || !this.holdingID.equals(other.holdingID))) return false;
+ return true;
+ }
+}
Propchange: geronimo/daytrader/trunk/modules/beans/src/main/java/org/apache/geronimo/samples/daytrader/HoldingDataBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: geronimo/daytrader/trunk/modules/beans/src/main/java/org/apache/geronimo/samples/daytrader/OrderDataBean.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/beans/src/main/java/org/apache/geronimo/samples/daytrader/OrderDataBean.java?rev=809686&view=auto
==============================================================================
--- geronimo/daytrader/trunk/modules/beans/src/main/java/org/apache/geronimo/samples/daytrader/OrderDataBean.java (added)
+++ geronimo/daytrader/trunk/modules/beans/src/main/java/org/apache/geronimo/samples/daytrader/OrderDataBean.java Mon Aug 31 18:48:41 2009
@@ -0,0 +1,323 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.samples.daytrader;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+import org.apache.geronimo.samples.daytrader.util.Log;
+import org.apache.geronimo.samples.daytrader.util.TradeConfig;
+
+
+public class OrderDataBean implements Serializable
+{
+
+
+ private Integer orderID; /* orderID */
+
+
+ private String orderType; /* orderType (buy, sell, etc.) */
+
+
+ private String orderStatus; /* orderStatus (open, processing, completed, closed, cancelled) */
+
+
+ private Date openDate; /* openDate (when the order was entered) */
+
+
+ private Date completionDate; /* completionDate */
+
+
+ private double quantity; /* quantity */
+
+
+ private BigDecimal price; /* price */
+
+
+ private BigDecimal orderFee; /* price */
+
+
+ private AccountDataBean account;
+
+
+ private QuoteDataBean quote;
+
+
+ private HoldingDataBean holding;
+
+ private String symbol;
+
+ public OrderDataBean() {
+ }
+
+ public OrderDataBean(Integer orderID,
+ String orderType,
+ String orderStatus,
+ Date openDate,
+ Date completionDate,
+ double quantity,
+ BigDecimal price,
+ BigDecimal orderFee,
+ String symbol
+ ) {
+ setOrderID(orderID);
+ setOrderType(orderType);
+ setOrderStatus(orderStatus);
+ setOpenDate(openDate);
+ setCompletionDate(completionDate);
+ setQuantity(quantity);
+ setPrice(price);
+ setOrderFee(orderFee);
+ setSymbol(symbol);
+ }
+
+ public OrderDataBean(String orderType,
+ String orderStatus,
+ Date openDate,
+ Date completionDate,
+ double quantity,
+ BigDecimal price,
+ BigDecimal orderFee,
+ AccountDataBean account,
+ QuoteDataBean quote, HoldingDataBean holding) {
+ setOrderType(orderType);
+ setOrderStatus(orderStatus);
+ setOpenDate(openDate);
+ setCompletionDate(completionDate);
+ setQuantity(quantity);
+ setPrice(price);
+ setOrderFee(orderFee);
+ setAccount(account);
+ setQuote(quote);
+ setHolding(holding);
+ }
+
+ public static OrderDataBean getRandomInstance() {
+ return new OrderDataBean(
+ new Integer(TradeConfig.rndInt(100000)),
+ TradeConfig.rndBoolean() ? "buy" : "sell",
+ "open",
+ new java.util.Date(TradeConfig.rndInt(Integer.MAX_VALUE)),
+ new java.util.Date(TradeConfig.rndInt(Integer.MAX_VALUE)),
+ TradeConfig.rndQuantity(),
+ TradeConfig.rndBigDecimal(1000.0f),
+ TradeConfig.rndBigDecimal(1000.0f),
+ TradeConfig.rndSymbol()
+ );
+ }
+
+ public String toString()
+ {
+ return "Order " + getOrderID()
+ + "\n\t orderType: " + getOrderType()
+ + "\n\t orderStatus: " + getOrderStatus()
+ + "\n\t openDate: " + getOpenDate()
+ + "\n\t completionDate: " + getCompletionDate()
+ + "\n\t quantity: " + getQuantity()
+ + "\n\t price: " + getPrice()
+ + "\n\t orderFee: " + getOrderFee()
+ + "\n\t symbol: " + getSymbol()
+ ;
+ }
+ public String toHTML()
+ {
+ return "<BR>Order <B>" + getOrderID() + "</B>"
+ + "<LI> orderType: " + getOrderType() + "</LI>"
+ + "<LI> orderStatus: " + getOrderStatus() + "</LI>"
+ + "<LI> openDate: " + getOpenDate() + "</LI>"
+ + "<LI> completionDate: " + getCompletionDate() + "</LI>"
+ + "<LI> quantity: " + getQuantity() + "</LI>"
+ + "<LI> price: " + getPrice() + "</LI>"
+ + "<LI> orderFee: " + getOrderFee() + "</LI>"
+ + "<LI> symbol: " + getSymbol() + "</LI>"
+ ;
+ }
+
+ public void print()
+ {
+ Log.log( this.toString() );
+ }
+
+ public Integer getOrderID() {
+ return orderID;
+ }
+
+ public void setOrderID(Integer orderID) {
+ this.orderID = orderID;
+ }
+
+ public String getOrderType() {
+ return orderType;
+ }
+
+ public void setOrderType(String orderType) {
+ this.orderType = orderType;
+ }
+
+ public String getOrderStatus() {
+ return orderStatus;
+ }
+
+ public void setOrderStatus(String orderStatus) {
+ this.orderStatus = orderStatus;
+ }
+
+ public Date getOpenDate() {
+ return openDate;
+ }
+
+ public void setOpenDate(Date openDate) {
+ this.openDate = openDate;
+ }
+
+ public Date getCompletionDate() {
+ return completionDate;
+ }
+
+ public void setCompletionDate(Date completionDate) {
+ this.completionDate = completionDate;
+ }
+
+ public double getQuantity() {
+ return quantity;
+ }
+
+ public void setQuantity(double quantity) {
+ this.quantity = quantity;
+ }
+
+
+ public BigDecimal getPrice() {
+ return price;
+ }
+
+ public void setPrice(BigDecimal price) {
+ this.price = price;
+ }
+
+ public BigDecimal getOrderFee() {
+ return orderFee;
+ }
+
+ public void setOrderFee(BigDecimal orderFee) {
+ this.orderFee = orderFee;
+ }
+
+ public String getSymbol() {
+ if (quote != null) {
+ return quote.getSymbol();
+ }
+ return symbol;
+ }
+
+ public void setSymbol(String symbol) {
+ this.symbol = symbol;
+ }
+
+ public AccountDataBean getAccount() {
+ return account;
+ }
+
+ public void setAccount(AccountDataBean account) {
+ this.account = account;
+ }
+
+ public QuoteDataBean getQuote() {
+ return quote;
+ }
+
+ public void setQuote(QuoteDataBean quote) {
+ this.quote = quote;
+ }
+
+ public HoldingDataBean getHolding() {
+ return holding;
+ }
+
+ public void setHolding(HoldingDataBean holding) {
+ this.holding = holding;
+ }
+
+ public boolean isBuy()
+ {
+ String orderType = getOrderType();
+ if ( orderType.compareToIgnoreCase("buy") == 0 )
+ return true;
+ return false;
+ }
+
+ public boolean isSell()
+ {
+ String orderType = getOrderType();
+ if ( orderType.compareToIgnoreCase("sell") == 0 )
+ return true;
+ return false;
+ }
+
+ public boolean isOpen()
+ {
+ String orderStatus = getOrderStatus();
+ if ( (orderStatus.compareToIgnoreCase("open") == 0) ||
+ (orderStatus.compareToIgnoreCase("processing") == 0) )
+ return true;
+ return false;
+ }
+
+ public boolean isCompleted()
+ {
+ String orderStatus = getOrderStatus();
+ if ( (orderStatus.compareToIgnoreCase("completed") == 0) ||
+ (orderStatus.compareToIgnoreCase("alertcompleted") == 0) ||
+ (orderStatus.compareToIgnoreCase("cancelled") == 0) )
+ return true;
+ return false;
+ }
+
+ public boolean isCancelled()
+ {
+ String orderStatus = getOrderStatus();
+ if (orderStatus.compareToIgnoreCase("cancelled") == 0)
+ return true;
+ return false;
+ }
+
+
+ public void cancel()
+ {
+ setOrderStatus("cancelled");
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 0;
+ hash += (this.orderID != null ? this.orderID.hashCode() : 0);
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ // TODO: Warning - this method won't work in the case the id fields are not set
+ if (!(object instanceof OrderDataBean)) {
+ return false;
+ }
+ OrderDataBean other = (OrderDataBean)object;
+ if (this.orderID != other.orderID && (this.orderID == null || !this.orderID.equals(other.orderID))) return false;
+ return true;
+ }
+}
+
Propchange: geronimo/daytrader/trunk/modules/beans/src/main/java/org/apache/geronimo/samples/daytrader/OrderDataBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: geronimo/daytrader/trunk/modules/beans/src/main/java/org/apache/geronimo/samples/daytrader/QuoteDataBean.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/beans/src/main/java/org/apache/geronimo/samples/daytrader/QuoteDataBean.java?rev=809686&view=auto
==============================================================================
--- geronimo/daytrader/trunk/modules/beans/src/main/java/org/apache/geronimo/samples/daytrader/QuoteDataBean.java (added)
+++ geronimo/daytrader/trunk/modules/beans/src/main/java/org/apache/geronimo/samples/daytrader/QuoteDataBean.java Mon Aug 31 18:48:41 2009
@@ -0,0 +1,197 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.samples.daytrader;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Collection;
+
+import org.apache.geronimo.samples.daytrader.util.Log;
+import org.apache.geronimo.samples.daytrader.util.TradeConfig;
+
+
+public class QuoteDataBean implements Serializable {
+
+ private String symbol; /* symbol */
+
+
+ private String companyName; /* companyName */
+
+
+ private double volume; /* volume */
+
+
+ private BigDecimal price; /* price */
+
+
+ private BigDecimal open1; /* open1 price */
+
+
+ private BigDecimal low; /* low price */
+
+
+ private BigDecimal high; /* high price */
+
+
+ private double change1; /* price change */
+
+
+
+ public QuoteDataBean() {
+ }
+
+ public QuoteDataBean(String symbol, String companyName, double volume,
+ BigDecimal price, BigDecimal open, BigDecimal low,
+ BigDecimal high, double change) {
+ setSymbol(symbol);
+ setCompanyName(companyName);
+ setVolume(volume);
+ setPrice(price);
+ setOpen(open);
+ setLow(low);
+ setHigh(high);
+ setChange(change);
+ }
+
+ public static QuoteDataBean getRandomInstance() {
+ return new QuoteDataBean(
+ TradeConfig.rndSymbol(), //symbol
+ TradeConfig.rndSymbol() + " Incorporated", //Company Name
+ TradeConfig.rndFloat(100000), //volume
+ TradeConfig.rndBigDecimal(1000.0f), //price
+ TradeConfig.rndBigDecimal(1000.0f), //open1
+ TradeConfig.rndBigDecimal(1000.0f), //low
+ TradeConfig.rndBigDecimal(1000.0f), //high
+ TradeConfig.rndFloat(100000) //volume
+ );
+ }
+
+ //Create a "zero" value quoteDataBean for the given symbol
+ public QuoteDataBean(String symbol) {
+ setSymbol(symbol);
+ }
+
+ public String toString() {
+ return "\n\tQuote Data for: " + getSymbol()
+ + "\n\t\t companyName: " + getCompanyName()
+ + "\n\t\t volume: " + getVolume()
+ + "\n\t\t price: " + getPrice()
+ + "\n\t\t open1: " + getOpen()
+ + "\n\t\t low: " + getLow()
+ + "\n\t\t high: " + getHigh()
+ + "\n\t\t change1: " + getChange()
+ ;
+ }
+
+ public String toHTML() {
+ return "<BR>Quote Data for: " + getSymbol()
+ + "<LI> companyName: " + getCompanyName() + "</LI>"
+ + "<LI> volume: " + getVolume() + "</LI>"
+ + "<LI> price: " + getPrice() + "</LI>"
+ + "<LI> open1: " + getOpen() + "</LI>"
+ + "<LI> low: " + getLow() + "</LI>"
+ + "<LI> high: " + getHigh() + "</LI>"
+ + "<LI> change1: " + getChange() + "</LI>"
+ ;
+ }
+
+ public void print() {
+ Log.log(this.toString());
+ }
+
+ public String getSymbol() {
+ return symbol;
+ }
+
+ public void setSymbol(String symbol) {
+ this.symbol = symbol;
+ }
+
+ public String getCompanyName() {
+ return companyName;
+ }
+
+ public void setCompanyName(String companyName) {
+ this.companyName = companyName;
+ }
+
+ public BigDecimal getPrice() {
+ return price;
+ }
+
+ public void setPrice(BigDecimal price) {
+ this.price = price;
+ }
+
+ public BigDecimal getOpen() {
+ return open1;
+ }
+
+ public void setOpen(BigDecimal open) {
+ this.open1 = open;
+ }
+
+ public BigDecimal getLow() {
+ return low;
+ }
+
+ public void setLow(BigDecimal low) {
+ this.low = low;
+ }
+
+ public BigDecimal getHigh() {
+ return high;
+ }
+
+ public void setHigh(BigDecimal high) {
+ this.high = high;
+ }
+
+ public double getChange() {
+ return change1;
+ }
+
+ public void setChange(double change) {
+ this.change1 = change;
+ }
+
+ public double getVolume() {
+ return volume;
+ }
+
+ public void setVolume(double volume) {
+ this.volume = volume;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 0;
+ hash += (this.symbol != null ? this.symbol.hashCode() : 0);
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ // TODO: Warning - this method won't work in the case the id fields are not set
+ if (!(object instanceof QuoteDataBean)) {
+ return false;
+ }
+ QuoteDataBean other = (QuoteDataBean)object;
+ if (this.symbol != other.symbol && (this.symbol == null || !this.symbol.equals(other.symbol))) return false;
+ return true;
+ }
+}
Propchange: geronimo/daytrader/trunk/modules/beans/src/main/java/org/apache/geronimo/samples/daytrader/QuoteDataBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: geronimo/daytrader/trunk/modules/beans/src/main/resources/META-INF/LICENSE
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/beans/src/main/resources/META-INF/LICENSE?rev=809686&view=auto
==============================================================================
--- geronimo/daytrader/trunk/modules/beans/src/main/resources/META-INF/LICENSE (added)
+++ geronimo/daytrader/trunk/modules/beans/src/main/resources/META-INF/LICENSE Mon Aug 31 18:48:41 2009
@@ -0,0 +1,203 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
Added: geronimo/daytrader/trunk/modules/beans/src/main/resources/META-INF/NOTICE
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/beans/src/main/resources/META-INF/NOTICE?rev=809686&view=auto
==============================================================================
--- geronimo/daytrader/trunk/modules/beans/src/main/resources/META-INF/NOTICE (added)
+++ geronimo/daytrader/trunk/modules/beans/src/main/resources/META-INF/NOTICE Mon Aug 31 18:48:41 2009
@@ -0,0 +1,9 @@
+Apache Geronimo
+Copyright 2003-2009 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+Portions of this software were developed at IBM and donated to the
+ASF under the Apache 2.0 license. The former work was referred to
+as Trade 6.
Modified: geronimo/daytrader/trunk/modules/core/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/core/pom.xml?rev=809686&r1=809685&r2=809686&view=diff
==============================================================================
--- geronimo/daytrader/trunk/modules/core/pom.xml (original)
+++ geronimo/daytrader/trunk/modules/core/pom.xml Mon Aug 31 18:48:41 2009
@@ -25,7 +25,7 @@
</parent>
<groupId>org.apache.geronimo.daytrader.modules</groupId>
- <artifactId>core</artifactId>
+ <artifactId>daytrader-core</artifactId>
<packaging>jar</packaging>
<name>DayTrader :: Modules - Core</name>
<description>Daytrader Core Module</description>
@@ -37,6 +37,17 @@
</scm>
<dependencies>
+ <dependency>
+ <groupId>org.apache.geronimo.daytrader.modules</groupId>
+ <artifactId>daytrader-util</artifactId>
+ <version>${pom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.geronimo.daytrader.modules</groupId>
+ <artifactId>daytrader-entities</artifactId>
+ <version>${pom.version}</version>
+ <scope>provided</scope>
+ </dependency>
<!--
<dependency>
<groupId>org.apache.geronimo.daytrader</groupId>
@@ -49,11 +60,6 @@
<artifactId>geronimo-jaxrpc_1.1_spec</artifactId>
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-annotation_1.0_spec</artifactId>
- <scope>provided</scope>
- </dependency>
-->
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
@@ -71,6 +77,11 @@
<scope>provided</scope>
</dependency>
<dependency>
+ <groupId>org.apache.geronimo.specs</groupId>
+ <artifactId>geronimo-annotation_1.0_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-ejb_3.0_spec</artifactId>
<scope>provided</scope>
@@ -90,7 +101,7 @@
<artifactId>openjpa</artifactId>
<scope>provided</scope>
</dependency>
- <!-- OpenJPA PCEnhancer depends -->
+ <!-- OpenJPA PCEnhancer depends
<dependency>
<groupId>net.sourceforge.serp</groupId>
<artifactId>serp</artifactId>
@@ -109,8 +120,9 @@
<version>3.2.1</version>
<scope>provided</scope>
</dependency>
- <!-- end OpenJPA PCEnhancer depends -->
+ end OpenJPA PCEnhancer depends -->
</dependencies>
+
<build>
<resources>
<resource>
@@ -118,7 +130,7 @@
<filtering>true</filtering>
</resource>
</resources>
-
+<!--
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -152,7 +164,6 @@
</execution>
</executions>
</plugin>
-<!--
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
@@ -165,7 +176,7 @@
</archive>
</configuration>
</plugin>
--->
</plugins>
+-->
</build>
</project>
Added: geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/FinancialUtils.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/FinancialUtils.java?rev=809686&view=auto
==============================================================================
--- geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/FinancialUtils.java (added)
+++ geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/FinancialUtils.java Mon Aug 31 18:48:41 2009
@@ -0,0 +1,112 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.samples.daytrader;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.math.BigDecimal;
+
+public class FinancialUtils {
+ //TODO -- FinancialUtils should have parts reimplemented as JSPTaglibs
+
+ public final static int ROUND = BigDecimal.ROUND_HALF_UP;
+ public final static int SCALE = 2;
+ public final static BigDecimal ZERO = (new BigDecimal(0.00)).setScale(SCALE);
+ public final static BigDecimal ONE = (new BigDecimal(1.00)).setScale(SCALE);
+ public final static BigDecimal HUNDRED = (new BigDecimal(100.00)).setScale(SCALE);
+
+ public static BigDecimal computeGain(BigDecimal currentBalance,
+ BigDecimal openBalance)
+ {
+ return currentBalance.subtract(openBalance).setScale(SCALE);
+ }
+
+ public static BigDecimal computeGainPercent(BigDecimal currentBalance,
+ BigDecimal openBalance)
+ {
+ if (openBalance.doubleValue() == 0.0) return ZERO;
+ BigDecimal gainPercent =
+ currentBalance.divide(openBalance, ROUND).subtract(ONE).multiply(HUNDRED);
+ return gainPercent;
+ }
+
+ public static BigDecimal computeHoldingsTotal(Collection holdingDataBeans) {
+ BigDecimal holdingsTotal = new BigDecimal(0.0).setScale(SCALE);
+ if (holdingDataBeans == null)
+ return holdingsTotal;
+ Iterator it = holdingDataBeans.iterator();
+ while (it.hasNext()) {
+ HoldingDataBean holdingData = (HoldingDataBean) it.next();
+ BigDecimal total =
+ holdingData.getPurchasePrice().multiply(new BigDecimal(holdingData.getQuantity()));
+ holdingsTotal = holdingsTotal.add(total);
+ }
+ return holdingsTotal.setScale(SCALE);
+ }
+
+ public static String printGainHTML(BigDecimal gain) {
+ String htmlString, arrow;
+ if (gain.doubleValue() < 0.0) {
+ htmlString = "<FONT color=\"#ff0000\">";
+ arrow = "arrowdown.gif";
+ } else {
+ htmlString = "<FONT color=\"#009900\">";
+ arrow = "arrowup.gif";
+ }
+
+ htmlString += gain.setScale(SCALE, ROUND) + "</FONT><IMG src=\"images/" + arrow + "\" width=\"10\" height=\"10\" border=\"0\"></IMG>";
+ return htmlString;
+ }
+
+ public static String printChangeHTML(double change) {
+ String htmlString, arrow;
+ if (change < 0.0) {
+ htmlString = "<FONT color=\"#ff0000\">";
+ arrow = "arrowdown.gif";
+ } else {
+ htmlString = "<FONT color=\"#009900\">";
+ arrow = "arrowup.gif";
+ }
+
+
+ htmlString += change + "</FONT><IMG src=\"images/" + arrow + "\" width=\"10\" height=\"10\" border=\"0\"></IMG>";
+ return htmlString;
+ }
+
+ public static String printGainPercentHTML(BigDecimal gain) {
+ String htmlString, arrow;
+ if (gain.doubleValue() < 0.0) {
+ htmlString = "(<B><FONT color=\"#ff0000\">";
+ arrow = "arrowdown.gif";
+ } else {
+ htmlString = "(<B><FONT color=\"#009900\">+";
+ arrow = "arrowup.gif";
+ }
+
+ htmlString += gain.setScale(SCALE, ROUND);
+ htmlString += "%</FONT></B>)<IMG src=\"images/" + arrow + "\" width=\"10\" height=\"10\" border=\"0\"></IMG>";
+ return htmlString;
+ }
+
+ public static String printQuoteLink(String symbol)
+ {
+ String htmlString;
+ return "<A href=\"app?action=quotes&symbols="+ symbol+"\">" + symbol + "</A>";
+ }
+
+
+}
\ No newline at end of file
Propchange: geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/FinancialUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/MarketSummaryDataBean.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/MarketSummaryDataBean.java?rev=809686&r1=809685&r2=809686&view=diff
==============================================================================
--- geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/MarketSummaryDataBean.java (original)
+++ geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/MarketSummaryDataBean.java Mon Aug 31 18:48:41 2009
@@ -23,8 +23,8 @@
import java.util.Date;
import java.util.Iterator;
-import org.apache.geronimo.samples.daytrader.util.FinancialUtils;
import org.apache.geronimo.samples.daytrader.util.Log;
+import org.apache.geronimo.samples.daytrader.util.TradeConfig;
public class MarketSummaryDataBean implements Serializable
{
@@ -234,4 +234,4 @@
this.summaryDate = summaryDate;
}
-}
\ No newline at end of file
+}
Modified: geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/MarketSummaryDataBeanWS.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/MarketSummaryDataBeanWS.java?rev=809686&r1=809685&r2=809686&view=diff
==============================================================================
--- geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/MarketSummaryDataBeanWS.java (original)
+++ geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/MarketSummaryDataBeanWS.java Mon Aug 31 18:48:41 2009
@@ -21,7 +21,6 @@
import java.util.Collection;
import java.util.Date;
-import org.apache.geronimo.samples.daytrader.util.FinancialUtils;
import org.apache.geronimo.samples.daytrader.util.Log;
/**
@@ -220,4 +219,4 @@
return new MarketSummaryDataBeanWS(origBean.getTSIA(), origBean.getOpenTSIA(), origBean.getVolume(), gain, lose);
}
-}
\ No newline at end of file
+}
Modified: geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/TradeAction.java
URL: http://svn.apache.org/viewvc/geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/TradeAction.java?rev=809686&r1=809685&r2=809686&view=diff
==============================================================================
--- geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/TradeAction.java (original)
+++ geronimo/daytrader/trunk/modules/core/src/main/java/org/apache/geronimo/samples/daytrader/TradeAction.java Mon Aug 31 18:48:41 2009
@@ -21,11 +21,12 @@
import javax.naming.InitialContext;
-import org.apache.geronimo.samples.daytrader.direct.TradeDirect;
+import org.apache.geronimo.samples.daytrader.direct.TradeJEEDirect;
+import org.apache.geronimo.samples.daytrader.direct.TradeWebDirect;
//import org.apache.geronimo.samples.daytrader.ejb3.TradeSLSBRemote;
//import org.apache.geronimo.samples.daytrader.ejb3.DirectSLSBRemote;
-import org.apache.geronimo.samples.daytrader.util.FinancialUtils;
import org.apache.geronimo.samples.daytrader.util.Log;
+import org.apache.geronimo.samples.daytrader.util.TradeConfig;
/**
* The TradeAction class provides the generic client side access to each of the
@@ -59,6 +60,8 @@
}
private void createTrade() {
+ RuntimeException re = null;
+
if (TradeConfig.runTimeMode == TradeConfig.EJB3) {
try {
Class c = Class.forName("org.apache.geronimo.samples.daytrader.ejb3.TradeSLSBRemote");
@@ -75,7 +78,7 @@
}
catch (Exception e) {
Log.error("TradeAction:TradeAction() Creation of Trade EJB 3 failed\n" + e);
- e.printStackTrace();
+ re = new RuntimeException(e);
}
} else if (TradeConfig.runTimeMode == TradeConfig.SESSION3) {
try {
@@ -93,24 +96,31 @@
}
catch (Exception e) {
Log.error("TradeAction:TradeAction() Creation of Trade SESSION3 failed\n" + e);
- e.printStackTrace();
+ re = new RuntimeException(e);
}
} else if (TradeConfig.runTimeMode == TradeConfig.DIRECT) {
try {
- trade = new TradeDirect();
+ trade = new TradeJEEDirect();
}
catch (Exception e) {
Log.error("TradeAction:TradeAction() Creation of Trade JDBC Direct failed\n" + e);
+ re = new RuntimeException(e);
}
} else if (TradeConfig.runTimeMode == TradeConfig.JPA) {
try {
- trade = new TradeDirect();
+ trade = new TradeWebDirect();
}
catch (Exception e) {
Log.error("TradeAction:TradeAction() Creation of Trade JPA Direct failed\n" + e);
+ re = new RuntimeException(e);
}
} else {
Log.error("TradeAction:TradeAction() Unknown Trade runtime mode.");
+ re = new RuntimeException("TradeAction:TradeAction() Unknown Trade runtime mode.");
+ }
+
+ if (re != null) {
+ throw re;
}
}