001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.test.banknew.ejb;
023:
024: import java.util.Date;
025:
026: import org.jboss.test.banknew.interfaces.TransactionData;
027: import org.jboss.test.banknew.interfaces.TransactionPK;
028: import org.jboss.test.util.ejb.EntitySupport;
029:
030: /**
031: * The Entity bean represents a bank transaction
032: *
033: * @author Andreas Schaefer
034: * @version $Revision: 57211 $
035: *
036: * @ejb:bean name="bank/Transaction"
037: * display-name="Bank Transaction Entity"
038: * type="CMP"
039: * view-type="remote"
040: * jndi-name="ejb/bank/Transaction"
041: * schema="Transaction"
042: *
043: * @ejb:interface extends="javax.ejb.EJBObject"
044: *
045: * @ejb:home extends="javax.ejb.EJBHome"
046: *
047: * @ejb:pk extends="java.lang.Object"
048: *
049: * @ejb:transaction type="Required"
050: *
051: * @ejb:data-object extends="java.lang.Object"
052: *
053: * @ejb:finder signature="java.util.Collection findAll()"
054: * query="SELECT OBJECT(o) FROM Transaction AS o"
055: *
056: * @ejb:finder signature="java.util.Collection findByAccount( java.lang.String pAccountId )"
057: * query="SELECT OBJECT(o) FROM Transaction AS o WHERE o.acountId = ?1"
058: *
059: * @jboss:finder-query name="findByAccount"
060: * query="Account_Id = {0}"
061: * order="Date"
062: *
063: * @jboss:table-name table-name="New_Transaction"
064: *
065: * @jboss:create-table create="true"
066: *
067: * @jboss:remove-table remove="true"
068: */
069: public abstract class TransactionBean extends EntitySupport {
070: // Constants -----------------------------------------------------
071:
072: // Attributes ----------------------------------------------------
073:
074: // Static --------------------------------------------------------
075:
076: private static int sId = 0;
077:
078: // Constructors --------------------------------------------------
079:
080: // Public --------------------------------------------------------
081:
082: /**
083: * @ejb:persistent-field
084: * @ejb:pk-field
085: *
086: * @jboss:column-name name="Id"
087: **/
088: abstract public String getId();
089:
090: abstract public void setId(String pId);
091:
092: /**
093: * @ejb:persistent-field
094: *
095: * @jboss:column-name name="Account_Id"
096: **/
097: abstract public String getAcountId();
098:
099: abstract public void setAcountId(String pAcountId);
100:
101: /**
102: * @ejb:persistent-field
103: *
104: * @jboss:column-name name="Type"
105: **/
106: abstract public int getType();
107:
108: abstract public void setType(int pType);
109:
110: /**
111: * @ejb:persistent-field
112: *
113: * @jboss:column-name name="Amount"
114: **/
115: abstract public float getAmount();
116:
117: abstract public void setAmount(float pAmount);
118:
119: /**
120: * @ejb:persistent-field
121: *
122: * @jboss:column-name name="Date"
123: **/
124: abstract public Date getDate();
125:
126: abstract public void setDate(Date pDate);
127:
128: /**
129: * @ejb:persistent-field
130: *
131: * @jboss:column-name name="Description"
132: **/
133: abstract public String getDescription();
134:
135: abstract public void setDescription(String pDescription);
136:
137: /**
138: * @ejb:interface-method view-type="remote"
139: **/
140: abstract public TransactionData getData();
141:
142: abstract public void setData(TransactionData pDate);
143:
144: // EntityHome implementation -------------------------------------
145:
146: /**
147: * @ejb:create-method view-type="remote"
148: **/
149: public TransactionPK ejbCreate(String pAccountId, int pType,
150: float pAmount, String pDescription) {
151: setId("Tx: " + (sId++));
152: setAcountId(pAccountId);
153: setType(pType);
154: setAmount(pAmount);
155: setDescription(pDescription);
156: setDate(new Date());
157:
158: return null;
159: }
160:
161: public void ejbPostCreate(String pAccountId, int pType,
162: float pAmount, String pDescription) {
163: }
164:
165: /**
166: * @ejb:create-method view-type="remote"
167: **/
168: public TransactionPK ejbCreate(TransactionData pData) {
169: setId("Tx: " + (sId++));
170: pData.setDate(new Date());
171: setData(pData);
172:
173: return null;
174: }
175:
176: public void ejbPostCreate(TransactionData pData) {
177: }
178: }
179:
180: /*
181: * $Id: TransactionBean.java 57211 2006-09-26 12:39:46Z dimitris@jboss.org $
182: * Currently locked by:$Locker$
183: * Revision:
184: * $Log$
185: * Revision 1.2.16.2 2006/03/01 15:58:56 adrian
186: * Remove xdoclet from the jca tests + other tidyup
187: *
188: * Revision 1.2.16.1 2005/10/29 05:04:35 starksm
189: * Update the LGPL header
190: *
191: * Revision 1.2 2002/05/06 00:07:37 danch
192: * Added ejbql query specs, schema names
193: *
194: * Revision 1.1 2002/05/04 01:08:25 schaefera
195: * Added new Stats classes (JMS related) to JSR-77 implemenation and added the
196: * bank-new test application but this does not work right now properly but
197: * it is not added to the default tests so I shouldn't bother someone.
198: *
199: * Revision 1.1.2.3 2002/04/30 01:21:23 schaefera
200: * Added some fixes to the marathon test and a windows script.
201: *
202: * Revision 1.1.2.2 2002/04/29 21:05:17 schaefera
203: * Added new marathon test suite using the new bank application
204: *
205: * Revision 1.1.2.1 2002/04/17 05:07:24 schaefera
206: * Redesigned the banknew example therefore to a create separation between
207: * the Entity Bean (CMP) and the Session Beans (Business Logic).
208: * The test cases are redesigned but not finished yet.
209: *
210: * Revision 1.1.2.2 2002/04/15 04:28:15 schaefera
211: * Minor fixes regarding to the JNDI names of the beans.
212: *
213: * Revision 1.1.2.1 2002/04/15 02:32:24 schaefera
214: * Add a new test version of the bank because the old did no use transactions
215: * and the new uses XDoclet 1.1.2 to generate the DDs and other Java classes.
216: * Also a marathon test is added. Please specify the jbosstest.duration for
217: * how long and the test.timeout (which must be longer than the duration) to
218: * run the test with run_tests.xml, tag marathon-test-and-report.
219: *
220: * Revision 1.4 2001/01/20 16:32:51 osh
221: * More cleanup to avoid verifier warnings.
222: *
223: * Revision 1.3 2001/01/07 23:14:34 peter
224: * Trying to get JAAS to work within test suite.
225: *
226: * Revision 1.2 2000/09/30 01:00:54 fleury
227: * Updated bank tests to work with new jBoss version
228: *
229: * Revision 1.1.1.1 2000/06/21 15:52:37 oberg
230: * Initial import of jBoss test. This module contains CTS tests, some simple examples, and small bean suites.
231: */
|