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 Aug 19, 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: */
039: public class PaymentProcess implements UserRequired, Serializable,
040: PersistenceBrokerAware {
041: private Integer id;
042: private Timestamp processTimestamp;
043: private String campus;
044: private String processUserId;
045: private PdpUser processUser;
046: private Timestamp lastUpdate;
047: private Integer version;
048:
049: public PaymentProcess() {
050: super ();
051: }
052:
053: public void updateUser(UniversalUserService userService)
054: throws UserNotFoundException {
055: UniversalUser u = userService.getUniversalUser(processUserId);
056: if (u == null) {
057: setProcessUser(null);
058: } else {
059: setProcessUser(new PdpUser(u));
060: }
061: }
062:
063: public String getCampus() {
064: return campus;
065: }
066:
067: public void setCampus(String campus) {
068: this .campus = campus;
069: }
070:
071: public Integer getId() {
072: return id;
073: }
074:
075: public void setId(Integer id) {
076: this .id = id;
077: }
078:
079: public Timestamp getProcessTimestamp() {
080: return processTimestamp;
081: }
082:
083: public void setProcessTimestamp(Timestamp processTimestamp) {
084: this .processTimestamp = processTimestamp;
085: }
086:
087: public PdpUser getProcessUser() {
088: return processUser;
089: }
090:
091: public void setProcessUser(PdpUser processUser) {
092: if (processUser != null) {
093: processUserId = processUser.getPersonUniversalIdentifier();
094: }
095: this .processUser = processUser;
096: }
097:
098: public String getProcessUserId() {
099: return processUserId;
100: }
101:
102: public void setProcessUserId(String processUserId) {
103: this .processUserId = processUserId;
104: }
105:
106: public Integer getVersion() {
107: return version;
108: }
109:
110: public void setVersion(Integer version) {
111: this .version = version;
112: }
113:
114: public boolean equals(Object obj) {
115: if (!(obj instanceof PaymentProcess)) {
116: return false;
117: }
118: PaymentProcess tc = (PaymentProcess) obj;
119: return new EqualsBuilder().append(id, tc.getId()).isEquals();
120: }
121:
122: public int hashCode() {
123: return new HashCodeBuilder(67, 3).append(id).toHashCode();
124: }
125:
126: public String toString() {
127: return new ToStringBuilder(this ).append("id", this .id)
128: .toString();
129: }
130:
131: /**
132: * @return Returns the lastUpdate.
133: */
134: public Timestamp getLastUpdate() {
135: return lastUpdate;
136: }
137:
138: /**
139: * @param lastUpdate The lastUpdate to set.
140: */
141: public void setLastUpdate(Timestamp lastUpdate) {
142: this .lastUpdate = lastUpdate;
143: }
144:
145: public void beforeInsert(PersistenceBroker broker)
146: throws PersistenceBrokerException {
147: lastUpdate = new Timestamp((new Date()).getTime());
148: }
149:
150: public void afterInsert(PersistenceBroker broker)
151: throws PersistenceBrokerException {
152:
153: }
154:
155: public void beforeUpdate(PersistenceBroker broker)
156: throws PersistenceBrokerException {
157: lastUpdate = new Timestamp((new Date()).getTime());
158: }
159:
160: public void afterUpdate(PersistenceBroker broker)
161: throws PersistenceBrokerException {
162:
163: }
164:
165: public void beforeDelete(PersistenceBroker broker)
166: throws PersistenceBrokerException {
167:
168: }
169:
170: public void afterDelete(PersistenceBroker broker)
171: throws PersistenceBrokerException {
172:
173: }
174:
175: public void afterLookup(PersistenceBroker broker)
176: throws PersistenceBrokerException {
177:
178: }
179: }
|