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 8, 2004
018: *
019: */
020: package org.kuali.module.pdp.bo;
021:
022: import java.io.Serializable;
023: import java.math.BigDecimal;
024: import java.sql.Timestamp;
025: import java.util.Date;
026:
027: import org.apache.commons.lang.builder.EqualsBuilder;
028: import org.apache.commons.lang.builder.HashCodeBuilder;
029: import org.apache.commons.lang.builder.ToStringBuilder;
030: import org.apache.ojb.broker.PersistenceBroker;
031: import org.apache.ojb.broker.PersistenceBrokerAware;
032: import org.apache.ojb.broker.PersistenceBrokerException;
033: import org.kuali.core.bo.user.UniversalUser;
034: import org.kuali.core.exceptions.UserNotFoundException;
035: import org.kuali.core.service.UniversalUserService;
036:
037: /**
038: * @author delyea
039: * @hibernate.class table="PDP.PDP_BATCH_T"
040: */
041:
042: public class Batch implements UserRequired, Serializable,
043: PersistenceBrokerAware {
044:
045: private Integer id; // PMT_BATCH_ID
046:
047: private Integer customerId;
048: private CustomerProfile customerProfile; // CUST_ID
049:
050: private String paymentFileName; // PMT_FL_NM
051: private Timestamp customerFileCreateTimestamp; // CUST_FL_CRTN_TS
052: private Integer paymentCount; // PMT_CNT
053: private BigDecimal paymentTotalAmount; // PMT_TOT_AMT
054: private PdpUser submiterUser;
055: private String submiterUserId; // SBMTR_USR_ID
056: private Timestamp fileProcessTimestamp; // FL_PROC_TS
057: private Timestamp lastUpdate;
058: private Integer version; // VER_NBR
059:
060: public Batch() {
061: super ();
062: }
063:
064: /**
065: * @hibernate.property column="FL_PROC_TS"
066: */
067: public Timestamp getFileProcessTimestamp() {
068: return fileProcessTimestamp;
069: }
070:
071: /**
072: * @hibernate.version column="VER_NBR" not-null="true"
073: */
074: public Integer getVersion() {
075: return version;
076: }
077:
078: /**
079: * @return
080: * @hibernate.id column="PMT_BATCH_ID" generator-class="sequence"
081: * @hibernate.generator-param name="sequence" value="PDP.PDP_PMT_BATCH_ID_SEQ"
082: */
083: public Integer getId() {
084: return id;
085: }
086:
087: /**
088: * @return
089: * @hibernate.property column="CUST_FL_CRTN_TS"
090: */
091: public Timestamp getCustomerFileCreateTimestamp() {
092: return customerFileCreateTimestamp;
093: }
094:
095: /**
096: * @return
097: * @hibernate.property column="PMT_CNT"
098: */
099: public Integer getPaymentCount() {
100: return paymentCount;
101: }
102:
103: /**
104: * @return
105: * @hibernate.property column="PMT_FL_NM" lenght="30"
106: */
107: public String getPaymentFileName() {
108: return paymentFileName;
109: }
110:
111: /**
112: * @return
113: * @hibernate.property column="PMT_TOT_AMT"
114: */
115: public BigDecimal getPaymentTotalAmount() {
116: return paymentTotalAmount;
117: }
118:
119: /**
120: * @return
121: * @hibernate.many-to-one column="CUST_ID" class="edu.iu.uis.pdp.bo.CustomerProfile"
122: */
123: public CustomerProfile getCustomerProfile() {
124: return customerProfile;
125: }
126:
127: /**
128: * @param string
129: */
130: public void setCustomerFileCreateTimestamp(Timestamp t) {
131: customerFileCreateTimestamp = t;
132: }
133:
134: /**
135: * @param timestamp
136: */
137: public void setFileProcessTimestamp(Timestamp timestamp) {
138: fileProcessTimestamp = timestamp;
139: }
140:
141: /**
142: * @param integer
143: */
144: public void setId(Integer integer) {
145: id = integer;
146: }
147:
148: /**
149: * @param integer
150: */
151: public void setPaymentCount(Integer integer) {
152: paymentCount = integer;
153: }
154:
155: /**
156: * @param string
157: */
158: public void setPaymentFileName(String string) {
159: paymentFileName = string;
160: }
161:
162: /**
163: * @param decimal
164: */
165: public void setPaymentTotalAmount(BigDecimal decimal) {
166: paymentTotalAmount = decimal;
167: }
168:
169: /**
170: * @param integer
171: */
172: public void setVersion(Integer integer) {
173: version = integer;
174: }
175:
176: /**
177: * @param integer
178: */
179: public void setCustomerProfile(CustomerProfile cp) {
180: customerProfile = cp;
181: }
182:
183: public PdpUser getSubmiterUser() {
184: return submiterUser;
185: }
186:
187: public void setSubmiterUser(PdpUser s) {
188: if (s != null) {
189: this .submiterUserId = s.getUniversalUser()
190: .getPersonUniversalIdentifier();
191: } else {
192: this .submiterUserId = null;
193: }
194: this .submiterUser = s;
195: }
196:
197: /**
198: * @hibernate.property column="SBMTR_USR_ID" length="11" not-null="true"
199: * @return Returns the submiterUserId.
200: */
201: public String getSubmiterUserId() {
202: return submiterUserId;
203: }
204:
205: /**
206: * @param submiterUserId The submiterUserId to set.
207: */
208: public void setSubmiterUserId(String submiterUserId) {
209: this .submiterUserId = submiterUserId;
210: }
211:
212: public void updateUser(UniversalUserService userService)
213: throws UserNotFoundException {
214: UniversalUser u = userService.getUniversalUser(submiterUserId);
215: if (u == null) {
216: setSubmiterUser(null);
217: } else {
218: setSubmiterUser(new PdpUser(u));
219: }
220: }
221:
222: public boolean equals(Object obj) {
223: if (!(obj instanceof Batch)) {
224: return false;
225: }
226: Batch o = (Batch) obj;
227: return new EqualsBuilder().append(id, o.getId()).isEquals();
228: }
229:
230: public int hashCode() {
231: return new HashCodeBuilder(83, 89).append(id).toHashCode();
232: }
233:
234: public String toString() {
235: return new ToStringBuilder(this ).append("id", this .id)
236: .toString();
237: }
238:
239: /**
240: * @return Returns the lastUpdate.
241: */
242: public Timestamp getLastUpdate() {
243: return lastUpdate;
244: }
245:
246: /**
247: * @param lastUpdate The lastUpdate to set.
248: */
249: public void setLastUpdate(Timestamp lastUpdate) {
250: this .lastUpdate = lastUpdate;
251: }
252:
253: public void beforeInsert(PersistenceBroker broker)
254: throws PersistenceBrokerException {
255: lastUpdate = new Timestamp((new Date()).getTime());
256: }
257:
258: public void afterInsert(PersistenceBroker broker)
259: throws PersistenceBrokerException {
260:
261: }
262:
263: public void beforeUpdate(PersistenceBroker broker)
264: throws PersistenceBrokerException {
265: lastUpdate = new Timestamp((new Date()).getTime());
266: }
267:
268: public void afterUpdate(PersistenceBroker broker)
269: throws PersistenceBrokerException {
270:
271: }
272:
273: public void beforeDelete(PersistenceBroker broker)
274: throws PersistenceBrokerException {
275:
276: }
277:
278: public void afterDelete(PersistenceBroker broker)
279: throws PersistenceBrokerException {
280:
281: }
282:
283: public void afterLookup(PersistenceBroker broker)
284: throws PersistenceBrokerException {
285:
286: }
287: }
|