001: /*
002: * Copyright 2007 The Kuali Foundation.
003: *
004: * Licensed under the Educational Community License, Version 1.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.opensource.org/licenses/ecl1.php
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: /*
017: * Created on Jul 7, 2004
018: *
019: */
020: package org.kuali.module.pdp.bo;
021:
022: import java.io.Serializable;
023: import java.sql.Timestamp;
024: import java.util.Date;
025:
026: import org.apache.commons.lang.builder.EqualsBuilder;
027: import org.apache.commons.lang.builder.HashCodeBuilder;
028: import org.apache.commons.lang.builder.ToStringBuilder;
029: import org.apache.ojb.broker.PersistenceBroker;
030: import org.apache.ojb.broker.PersistenceBrokerAware;
031: import org.apache.ojb.broker.PersistenceBrokerException;
032: import org.kuali.core.bo.user.UniversalUser;
033: import org.kuali.core.exceptions.UserNotFoundException;
034: import org.kuali.core.service.UniversalUserService;
035:
036: /**
037: * @author jsissom
038: * @hibernate.class table="PDP.PDP_BNK_CD_T"
039: */
040: public class Bank implements UserRequired, Serializable,
041: PersistenceBrokerAware {
042: private Integer id;
043: private Integer version;
044: private String description;
045: private String name;
046: private String routingNumber;
047: private String accountNumber;
048: private Boolean active;
049: private DisbursementType disbursementType;
050: private String disbursementTypeCode;
051: private Timestamp lastUpdate;
052: private PdpUser lastUpdateUser;
053: private String lastUpdateUserId;
054:
055: /**
056: *
057: */
058: public Bank() {
059: super ();
060: active = Boolean.FALSE;
061: }
062:
063: public void updateUser(UniversalUserService userService)
064: throws UserNotFoundException {
065: UniversalUser u = userService
066: .getUniversalUser(lastUpdateUserId);
067: if (u == null) {
068: lastUpdateUserId = null;
069: lastUpdateUser = null;
070: } else {
071: lastUpdateUserId = u.getPersonUniversalIdentifier();
072: lastUpdateUser = new PdpUser(u);
073: }
074: }
075:
076: /**
077: * @hibernate.property column="BNK_ACCT_NBR" length="17" not-null="true"
078: * @return Returns the accountNumber.
079: */
080: public String getAccountNumber() {
081: return accountNumber;
082: }
083:
084: /**
085: * @param accountNumber The accountNumber to set.
086: */
087: public void setAccountNumber(String accountNumber) {
088: this .accountNumber = accountNumber;
089: }
090:
091: /**
092: * @hibernate.property column="BNK_ACTV_IND" type="yes_no" not-null="true"
093: * @return Returns the active.
094: */
095: public Boolean getActive() {
096: return active;
097: }
098:
099: /**
100: * @param active The active to set.
101: */
102: public void setActive(Boolean active) {
103: if (active == null) {
104: this .active = Boolean.FALSE;
105: } else {
106: this .active = active;
107: }
108: }
109:
110: /**
111: * @hibernate.property column="BNK_DESC" length="25" not-null="true"
112: * @return Returns the description.
113: */
114: public String getDescription() {
115: return description;
116: }
117:
118: /**
119: * @param description The description to set.
120: */
121: public void setDescription(String description) {
122: this .description = description;
123: }
124:
125: /**
126: * @hibernate.many-to-one column="DISB_TYP_CD" class="edu.iu.uis.pdp.bo.DisbursementType" not-null="true"
127: * @return Returns the disbursementType.
128: */
129: public DisbursementType getDisbursementType() {
130: return disbursementType;
131: }
132:
133: /**
134: * @param disbursementType The disbursementType to set.
135: */
136: public void setDisbursementType(DisbursementType disbursementType) {
137: this .disbursementType = disbursementType;
138: }
139:
140: /**
141: * @hibernate.id column="BNK_ID" generator-class="sequence"
142: * @hibernate.generator-param name="sequence" value="PDP.PDP_BANK_ID_SEQ"
143: * @return Returns the id.
144: */
145: public Integer getId() {
146: return id;
147: }
148:
149: /**
150: * @param id The id to set.
151: */
152: public void setId(Integer id) {
153: this .id = id;
154: }
155:
156: /**
157: * @hibernate.property column="LST_UPDT_TS" not-null="true"
158: * @return Returns the lastUpdate.
159: */
160: public Timestamp getLastUpdate() {
161: return lastUpdate;
162: }
163:
164: /**
165: * @param lastUpdate The lastUpdate to set.
166: */
167: public void setLastUpdate(Timestamp lastUpdate) {
168: this .lastUpdate = lastUpdate;
169: }
170:
171: /**
172: * @hibernate.property column="BNK_NM" not-null="true"
173: * @return Returns the name.
174: */
175: public String getName() {
176: return name;
177: }
178:
179: /**
180: * @param name The name to set.
181: */
182: public void setName(String name) {
183: this .name = name;
184: }
185:
186: /**
187: * @hibernate.version column="VER_NBR"
188: * @return Returns the version.
189: */
190: public Integer getVersion() {
191: return version;
192: }
193:
194: /**
195: * @param ojbVerNbr The ojbVerNbr to set.
196: */
197: public void setVersion(Integer ver) {
198: this .version = ver;
199: }
200:
201: /**
202: * @hibernate.property column="BNK_RTNG_NBR" length="9" not-null="true"
203: * @return Returns the routingNumber.
204: */
205: public String getRoutingNumber() {
206: return routingNumber;
207: }
208:
209: /**
210: * @param routingNumber The routingNumber to set.
211: */
212: public void setRoutingNumber(String routingNumber) {
213: this .routingNumber = routingNumber;
214: }
215:
216: /**
217: * @hibernate.property column="LST_UPDT_USR_ID" not-null="true"
218: * @return Returns the lastUpdateUserId.
219: */
220: public String getLastUpdateUserId() {
221: return lastUpdateUserId;
222: }
223:
224: /**
225: * @return Returns the lastUpdateUser.
226: */
227: public PdpUser getLastUpdateUser() {
228: return lastUpdateUser;
229: }
230:
231: /**
232: * @param lastUpdateUser The lastUpdateUser to set.
233: */
234: public void setLastUpdateUser(PdpUser lastUpdateUser) {
235: if (lastUpdateUser != null) {
236: this .lastUpdateUserId = lastUpdateUser.getUniversalUser()
237: .getPersonUniversalIdentifier();
238: } else {
239: this .lastUpdateUserId = null;
240: }
241: this .lastUpdateUser = lastUpdateUser;
242: }
243:
244: /**
245: * @param lastUpdateUserId The lastUpdateUserId to set.
246: */
247: public void setLastUpdateUserId(String lastUpdateUserId) {
248: this .lastUpdateUserId = lastUpdateUserId;
249: }
250:
251: public boolean equals(Object obj) {
252: if (!(obj instanceof Bank)) {
253: return false;
254: }
255: Bank o = (Bank) obj;
256: return new EqualsBuilder().append(id, o.getId()).isEquals();
257: }
258:
259: public int hashCode() {
260: return new HashCodeBuilder(83, 67).append(id).toHashCode();
261: }
262:
263: public String toString() {
264: return new ToStringBuilder(this ).append("id", this .id)
265: .toString();
266: }
267:
268: public void beforeInsert(PersistenceBroker broker)
269: throws PersistenceBrokerException {
270: lastUpdate = new Timestamp((new Date()).getTime());
271: }
272:
273: public void afterInsert(PersistenceBroker broker)
274: throws PersistenceBrokerException {
275:
276: }
277:
278: public void beforeUpdate(PersistenceBroker broker)
279: throws PersistenceBrokerException {
280: lastUpdate = new Timestamp((new Date()).getTime());
281: }
282:
283: public void afterUpdate(PersistenceBroker broker)
284: throws PersistenceBrokerException {
285:
286: }
287:
288: public void beforeDelete(PersistenceBroker broker)
289: throws PersistenceBrokerException {
290:
291: }
292:
293: public void afterDelete(PersistenceBroker broker)
294: throws PersistenceBrokerException {
295:
296: }
297:
298: public void afterLookup(PersistenceBroker broker)
299: throws PersistenceBrokerException {
300:
301: }
302: }
|