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.bankiiop.ejb;
023:
024: import java.io.ObjectStreamException;
025: import java.rmi.RemoteException;
026: import javax.ejb.CreateException;
027:
028: import org.jboss.test.bankiiop.interfaces.AccountData;
029: import org.jboss.test.bankiiop.interfaces.Customer;
030:
031: /**
032: *
033: * @author Rickard Oberg
034: * @author $Author: dimitris@jboss.org $
035: * @version $Revision: 57211 $
036: */
037: public class AccountBeanCMP extends AccountBean {
038: // Constants -----------------------------------------------------
039:
040: // Attributes ----------------------------------------------------
041: public String id;
042: public float balance;
043: public Customer owner;
044:
045: private boolean dirty;
046:
047: // Static --------------------------------------------------------
048:
049: // Constructors --------------------------------------------------
050:
051: // Public --------------------------------------------------------
052: public String getId() {
053: return id;
054: }
055:
056: public void setId(String id) {
057: this .id = id;
058: dirty = true;
059: }
060:
061: public float getBalance() {
062: return balance;
063: }
064:
065: public void setBalance(float balance) {
066: this .balance = balance;
067: dirty = true;
068: }
069:
070: public Customer getOwner() {
071: return owner;
072: }
073:
074: public void setOwner(Customer owner) {
075: this .owner = owner;
076: dirty = true;
077: }
078:
079: public void setData(AccountData data) {
080: setBalance(data.getBalance());
081: setOwner(data.getOwner());
082: }
083:
084: public AccountData getData() {
085: AccountData data = new AccountData();
086: data.setId(id);
087: data.setBalance(balance);
088: data.setOwner(owner);
089: return data;
090: }
091:
092: public boolean isModified() {
093: return dirty;
094: }
095:
096: // EntityBean implementation -------------------------------------
097: public String ejbCreate(AccountData data) throws RemoteException,
098: CreateException {
099: setId(data.id);
100: setData(data);
101: dirty = false;
102: return null;
103: }
104:
105: public void ejbPostCreate(AccountData data) throws RemoteException,
106: CreateException {
107: }
108:
109: public void ejbLoad() throws RemoteException {
110: super .ejbLoad();
111: dirty = false;
112: }
113: }
114:
115: /*
116: * $Id: AccountBeanCMP.java 57211 2006-09-26 12:39:46Z dimitris@jboss.org $
117: * Currently locked by:$Locker$
118: * Revision:
119: * $Log$
120: * Revision 1.1.26.2 2005/10/29 05:04:35 starksm
121: * Update the LGPL header
122: *
123: * Revision 1.1.26.1 2005/04/06 16:28:03 starksm
124: * Fix the license header
125: *
126: * Revision 1.1 2002/03/15 22:36:28 reverbel
127: * Initial version of the bank test for JBoss/IIOP.
128: *
129: * Revision 1.2 2001/01/07 23:14:34 peter
130: * Trying to get JAAS to work within test suite.
131: *
132: * Revision 1.1.1.1 2000/06/21 15:52:37 oberg
133: * Initial import of jBoss test. This module contains CTS tests, some simple examples, and small bean suites.
134: *
135: *
136: *
137: */
|