KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > banknew > ejb > AccountBean


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.test.banknew.ejb;
23
24 import javax.ejb.CreateException JavaDoc;
25
26 import org.jboss.test.banknew.interfaces.AccountData;
27 import org.jboss.test.banknew.interfaces.AccountPK;
28 import org.jboss.test.util.ejb.EntitySupport;
29
30 /**
31  * The Entity bean represents a bank account
32  *
33  * @author Andreas Schaefer
34  * @version $Revision: 41581 $
35  *
36  * @ejb:bean name="bank/Account"
37  * display-name="Bank Account Entity"
38  * type="CMP"
39  * view-type="remote"
40  * jndi-name="ejb/bank/Account"
41  * schema="Account"
42  *
43  * @ejb:interface extends="javax.ejb.EJBObject"
44  *
45  * @ejb:home extends="javax.ejb.EJBHome"
46  *
47  * @ejb:pk extends="java.lang.Object"
48  *
49  * @ejb:transaction type="Required"
50  *
51  * @ejb:data-object setdata="true"
52  * extends="java.lang.Object"
53  *
54  * @ejb:finder signature="java.util.Collection findAll()"
55  * query="SELECT OBJECT(o) from Account AS o"
56  *
57  * @ejb:finder signature="java.util.Collection findByCustomer( java.lang.String pCustomerId )"
58  * query="SELECT OBJECT(o) from Account AS o WHERE o.customerId = ?1"
59  *
60  * @jboss:finder-query name="findByCustomer"
61  * query="Customer_Id = {0}"
62  * order="Type"
63  *
64  * @ejb:finder signature="org.jboss.test.banknew.interfaces.Account findByCustomerAndType( java.lang.String pCustomerId, int pType )"
65  * query="SELECT OBJECT(o) from Account AS o WHERE o.customerId = ?1 AND o.type = ?2"
66  *
67  * @jboss:finder-query name="findByCustomerAndType"
68  * query="Customer_Id = {0} AND Type = {1}"
69  *
70  * @jboss:table-name table-name="New_Account"
71  *
72  * @jboss:create-table create="true"
73  *
74  * @jboss:remove-table remove="true"
75  */

76 public abstract class AccountBean
77    extends EntitySupport
78 {
79    // Constants -----------------------------------------------------
80

81    // Attributes ----------------------------------------------------
82

83    // Static --------------------------------------------------------
84

85    // Constructors --------------------------------------------------
86

87    // Public --------------------------------------------------------
88

89    /**
90     * @ejb:persistent-field
91     * @ejb:pk-field
92     *
93     * @jboss:column-name name="Id"
94     **/

95    abstract public String JavaDoc getId();
96    
97    abstract public void setId( String JavaDoc pId );
98    
99    /**
100     * @ejb:persistent-field
101     *
102     * @jboss:column-name name="Customer_Id"
103     **/

104    abstract public String JavaDoc getCustomerId();
105    
106    abstract public void setCustomerId( String JavaDoc pCustomerId );
107    
108    /**
109     * @ejb:persistent-field
110     *
111     * @jboss:column-name name="Type"
112     **/

113    abstract public int getType();
114    
115    abstract public void setType( int pType );
116    
117    /**
118     * @ejb:persistent-field
119     * @ejb:interface-method view-type="remote"
120     *
121     * @jboss:column-name name="Balance"
122     **/

123    abstract public float getBalance();
124    
125    abstract public void setBalance( float pAmount );
126    
127    /**
128     * @ejb:interface-method view-type="remote"
129     **/

130    public abstract void setData( AccountData pData );
131    
132    /**
133     * @ejb:interface-method view-type="remote"
134     **/

135    public abstract AccountData getData();
136    
137 // protected abstract void makeDirty();
138

139 // protected abstract void makeClean();
140

141    // EntityBean implementation -------------------------------------
142
/**
143     * @ejb:create-method view-type="remote"
144     **/

145    public AccountPK ejbCreate( AccountData pData )
146       throws CreateException JavaDoc
147    {
148       setId( pData.getCustomerId() + ":" + pData.getType() );
149       setData( pData );
150       
151       return null;
152    }
153    
154    public void ejbPostCreate( AccountData data )
155       throws CreateException JavaDoc
156    {
157    }
158 }
159
160 /*
161  * $Id: AccountBean.java 41581 2006-03-01 16:10:00Z adrian $
162  * Currently locked by:$Locker$
163  * Revision:
164  * $Log$
165  * Revision 1.4 2006/03/01 16:09:58 adrian
166  * Remove xdoclet from jca tests
167  *
168  * Revision 1.2.16.1 2005/10/29 05:04:35 starksm
169  * Update the LGPL header
170  *
171  * Revision 1.2 2002/05/06 00:07:36 danch
172  * Added ejbql query specs, schema names
173  *
174  * Revision 1.1 2002/05/04 01:08:25 schaefera
175  * Added new Stats classes (JMS related) to JSR-77 implemenation and added the
176  * bank-new test application but this does not work right now properly but
177  * it is not added to the default tests so I shouldn't bother someone.
178  *
179  * Revision 1.1.2.5 2002/04/30 01:21:23 schaefera
180  * Added some fixes to the marathon test and a windows script.
181  *
182  * Revision 1.1.2.4 2002/04/29 21:05:17 schaefera
183  * Added new marathon test suite using the new bank application
184  *
185  * Revision 1.1.2.3 2002/04/17 05:07:24 schaefera
186  * Redesigned the banknew example therefore to a create separation between
187  * the Entity Bean (CMP) and the Session Beans (Business Logic).
188  * The test cases are redesigned but not finished yet.
189  *
190  * Revision 1.1.2.2 2002/04/15 04:28:15 schaefera
191  * Minor fixes regarding to the JNDI names of the beans.
192  *
193  * Revision 1.1.2.1 2002/04/15 02:32:24 schaefera
194  * Add a new test version of the bank because the old did no use transactions
195  * and the new uses XDoclet 1.1.2 to generate the DDs and other Java classes.
196  * Also a marathon test is added. Please specify the jbosstest.duration for
197  * how long and the test.timeout (which must be longer than the duration) to
198  * run the test with run_tests.xml, tag marathon-test-and-report.
199  *
200  * Revision 1.2.2.1 2001/12/27 22:00:02 starksm
201  *
202  * Set dirty to false in ejbStore
203  *
204  * Revision 1.2 2001/01/07 23:14:34 peter
205  * Trying to get JAAS to work within test suite.
206  *
207  * Revision 1.1.1.1 2000/06/21 15:52:37 oberg
208  * Initial import of jBoss test. This module contains CTS tests, some simple examples, and small bean suites.
209  */

210
Popular Tags