KickJava   Java API By Example, From Geeks To Geeks.

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

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

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

50    // Constructors --------------------------------------------------
51

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

149
Popular Tags