KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > bankiiop > ejb > AccountBeanCMP


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.bankiiop.ejb;
23
24 import java.io.ObjectStreamException JavaDoc;
25 import java.rmi.RemoteException JavaDoc;
26 import javax.ejb.CreateException JavaDoc;
27
28 import org.jboss.test.bankiiop.interfaces.AccountData;
29 import org.jboss.test.bankiiop.interfaces.Customer;
30
31 /**
32  *
33  * @see <related>
34  * @author $Author: starksm $
35  * @version $Revision: 37406 $
36  */

37 public class AccountBeanCMP
38    extends AccountBean
39 {
40    // Constants -----------------------------------------------------
41

42    // Attributes ----------------------------------------------------
43
public String JavaDoc id;
44    public float balance;
45    public Customer owner;
46    
47    private boolean dirty;
48    
49    // Static --------------------------------------------------------
50

51    // Constructors --------------------------------------------------
52

53    // Public --------------------------------------------------------
54
public String JavaDoc getId()
55    {
56       return id;
57    }
58    
59    public void setId(String JavaDoc id)
60    {
61       this.id = id;
62       dirty = true;
63    }
64    
65    public float getBalance()
66    {
67       return balance;
68    }
69    
70    public void setBalance(float balance)
71    {
72       this.balance = balance;
73       dirty = true;
74    }
75    
76    public Customer getOwner()
77    {
78       return owner;
79    }
80    
81    public void setOwner(Customer owner)
82    {
83       this.owner = owner;
84       dirty = true;
85    }
86    
87    public void setData(AccountData data)
88    {
89       setBalance(data.getBalance());
90       setOwner(data.getOwner());
91    }
92    
93    public AccountData getData()
94    {
95       AccountData data = new AccountData();
96       data.setId(id);
97       data.setBalance(balance);
98       data.setOwner(owner);
99       return data;
100    }
101    
102    public boolean isModified()
103    {
104       return dirty;
105    }
106    
107    // EntityBean implementation -------------------------------------
108
public String JavaDoc ejbCreate(AccountData data)
109       throws RemoteException JavaDoc, CreateException JavaDoc
110    {
111       setId(data.id);
112       setData(data);
113       dirty = false;
114       return null;
115    }
116    
117    public void ejbPostCreate(AccountData data)
118       throws RemoteException JavaDoc, CreateException JavaDoc
119    {
120    }
121    
122    public void ejbLoad()
123       throws RemoteException JavaDoc
124    {
125       super.ejbLoad();
126       dirty = false;
127    }
128 }
129
130 /*
131  * $Id: AccountBeanCMP.java 37406 2005-10-29 23:41:24Z starksm $
132  * Currently locked by:$Locker$
133  * Revision:
134  * $Log$
135  * Revision 1.2 2005/10/29 23:41:18 starksm
136  * Update the jboss LGPL headers
137  *
138  * Revision 1.1 2002/03/15 22:36:28 reverbel
139  * Initial version of the bank test for JBoss/IIOP.
140  *
141  * Revision 1.2 2001/01/07 23:14:34 peter
142  * Trying to get JAAS to work within test suite.
143  *
144  * Revision 1.1.1.1 2000/06/21 15:52:37 oberg
145  * Initial import of jBoss test. This module contains CTS tests, some simple examples, and small bean suites.
146  *
147  *
148  *
149  */

150
Popular Tags