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.interfaces;
023:
024: /**
025: * Data object for bank/Transaction.
026: */
027: public class TransactionData extends java.lang.Object implements
028: java.io.Serializable {
029: /** The serialVersionUID */
030: private static final long serialVersionUID = 8601981534267975114L;
031:
032: private java.lang.String id;
033:
034: private java.lang.String acountId;
035:
036: private int type;
037:
038: private float amount;
039:
040: private java.util.Date date;
041:
042: private java.lang.String description;
043:
044: public TransactionData() {
045: }
046:
047: public TransactionData(java.lang.String id,
048: java.lang.String acountId, int type, float amount,
049: java.util.Date date, java.lang.String description) {
050: setId(id);
051: setAcountId(acountId);
052: setType(type);
053: setAmount(amount);
054: setDate(date);
055: setDescription(description);
056: }
057:
058: public TransactionData(TransactionData otherData) {
059: setId(otherData.getId());
060: setAcountId(otherData.getAcountId());
061: setType(otherData.getType());
062: setAmount(otherData.getAmount());
063: setDate(otherData.getDate());
064: setDescription(otherData.getDescription());
065:
066: }
067:
068: public org.jboss.test.banknew.interfaces.TransactionPK getPrimaryKey() {
069: org.jboss.test.banknew.interfaces.TransactionPK pk = new org.jboss.test.banknew.interfaces.TransactionPK(
070: this .getId());
071: return pk;
072: }
073:
074: public java.lang.String getId() {
075: return this .id;
076: }
077:
078: public void setId(java.lang.String id) {
079: this .id = id;
080: }
081:
082: public java.lang.String getAcountId() {
083: return this .acountId;
084: }
085:
086: public void setAcountId(java.lang.String acountId) {
087: this .acountId = acountId;
088: }
089:
090: public int getType() {
091: return this .type;
092: }
093:
094: public void setType(int type) {
095: this .type = type;
096: }
097:
098: public float getAmount() {
099: return this .amount;
100: }
101:
102: public void setAmount(float amount) {
103: this .amount = amount;
104: }
105:
106: public java.util.Date getDate() {
107: return this .date;
108: }
109:
110: public void setDate(java.util.Date date) {
111: this .date = date;
112: }
113:
114: public java.lang.String getDescription() {
115: return this .description;
116: }
117:
118: public void setDescription(java.lang.String description) {
119: this .description = description;
120: }
121:
122: public String toString() {
123: StringBuffer str = new StringBuffer("{");
124:
125: str.append("id=" + getId() + " " + "acountId=" + getAcountId()
126: + " " + "type=" + getType() + " " + "amount="
127: + getAmount() + " " + "date=" + getDate() + " "
128: + "description=" + getDescription());
129: str.append('}');
130:
131: return (str.toString());
132: }
133:
134: public boolean equals(Object pOther) {
135: if (pOther instanceof TransactionData) {
136: TransactionData lTest = (TransactionData) pOther;
137: boolean lEquals = true;
138:
139: if (this .id == null) {
140: lEquals = lEquals && (lTest.id == null);
141: } else {
142: lEquals = lEquals && this .id.equals(lTest.id);
143: }
144: if (this .acountId == null) {
145: lEquals = lEquals && (lTest.acountId == null);
146: } else {
147: lEquals = lEquals
148: && this .acountId.equals(lTest.acountId);
149: }
150: lEquals = lEquals && this .type == lTest.type;
151: lEquals = lEquals && this .amount == lTest.amount;
152: if (this .date == null) {
153: lEquals = lEquals && (lTest.date == null);
154: } else {
155: lEquals = lEquals && this .date.equals(lTest.date);
156: }
157: if (this .description == null) {
158: lEquals = lEquals && (lTest.description == null);
159: } else {
160: lEquals = lEquals
161: && this .description.equals(lTest.description);
162: }
163:
164: return lEquals;
165: } else {
166: return false;
167: }
168: }
169:
170: public int hashCode() {
171: int result = 17;
172:
173: result = 37 * result
174: + ((this .id != null) ? this .id.hashCode() : 0);
175:
176: result = 37
177: * result
178: + ((this .acountId != null) ? this .acountId.hashCode()
179: : 0);
180:
181: result = 37 * result + type;
182:
183: result = 37 * result + Float.floatToIntBits(amount);
184:
185: result = 37 * result
186: + ((this .date != null) ? this .date.hashCode() : 0);
187:
188: result = 37
189: * result
190: + ((this .description != null) ? this .description
191: .hashCode() : 0);
192:
193: return result;
194: }
195:
196: }
|