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/Customer.
026: */
027: public class CustomerData extends java.lang.Object implements
028: java.io.Serializable {
029: /** The serialVersionUID */
030: private static final long serialVersionUID = 713727152767197901L;
031:
032: private java.lang.String id;
033:
034: private java.lang.String bankId;
035:
036: private java.lang.String name;
037:
038: public CustomerData() {
039: }
040:
041: public CustomerData(java.lang.String id, java.lang.String bankId,
042: java.lang.String name) {
043: setId(id);
044: setBankId(bankId);
045: setName(name);
046: }
047:
048: public CustomerData(CustomerData otherData) {
049: setId(otherData.getId());
050: setBankId(otherData.getBankId());
051: setName(otherData.getName());
052:
053: }
054:
055: public org.jboss.test.banknew.interfaces.CustomerPK getPrimaryKey() {
056: org.jboss.test.banknew.interfaces.CustomerPK pk = new org.jboss.test.banknew.interfaces.CustomerPK(
057: this .getId());
058: return pk;
059: }
060:
061: public java.lang.String getId() {
062: return this .id;
063: }
064:
065: public void setId(java.lang.String id) {
066: this .id = id;
067: }
068:
069: public java.lang.String getBankId() {
070: return this .bankId;
071: }
072:
073: public void setBankId(java.lang.String bankId) {
074: this .bankId = bankId;
075: }
076:
077: public java.lang.String getName() {
078: return this .name;
079: }
080:
081: public void setName(java.lang.String name) {
082: this .name = name;
083: }
084:
085: public String toString() {
086: StringBuffer str = new StringBuffer("{");
087:
088: str.append("id=" + getId() + " " + "bankId=" + getBankId()
089: + " " + "name=" + getName());
090: str.append('}');
091:
092: return (str.toString());
093: }
094:
095: public boolean equals(Object pOther) {
096: if (pOther instanceof CustomerData) {
097: CustomerData lTest = (CustomerData) pOther;
098: boolean lEquals = true;
099:
100: if (this .id == null) {
101: lEquals = lEquals && (lTest.id == null);
102: } else {
103: lEquals = lEquals && this .id.equals(lTest.id);
104: }
105: if (this .bankId == null) {
106: lEquals = lEquals && (lTest.bankId == null);
107: } else {
108: lEquals = lEquals && this .bankId.equals(lTest.bankId);
109: }
110: if (this .name == null) {
111: lEquals = lEquals && (lTest.name == null);
112: } else {
113: lEquals = lEquals && this .name.equals(lTest.name);
114: }
115:
116: return lEquals;
117: } else {
118: return false;
119: }
120: }
121:
122: public int hashCode() {
123: int result = 17;
124:
125: result = 37 * result
126: + ((this .id != null) ? this .id.hashCode() : 0);
127:
128: result = 37 * result
129: + ((this .bankId != null) ? this .bankId.hashCode() : 0);
130:
131: result = 37 * result
132: + ((this .name != null) ? this .name.hashCode() : 0);
133:
134: return result;
135: }
136:
137: }
|