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 9, 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 delyea
038: * @hibernate.class table="PDP.PDP_DOC_TYP_CD_T"
039: */
040: public class DocumentType implements UserRequired, Serializable,
041: PersistenceBrokerAware {
042:
043: private Integer id; // DOC_TYP_ID
044: private String fsOriginCode; // FS_ORIGIN_CD
045: private String fdocTypeCode; // FDOC_TYP_CD
046: private Timestamp lastUpdate; // LST_UPDT_TS
047: private PdpUser lastUpdateUser;
048: private String lastUpdateUserId; // LST_UPDT_USR_ID
049: private Integer version; // VER_NBR
050: private TransactionType transactionType;
051: private DisbursementType disbursementType;
052:
053: public DocumentType() {
054: super ();
055: }
056:
057: public PdpUser getLastUpdateUser() {
058: return lastUpdateUser;
059: }
060:
061: public void setLastUpdateUser(PdpUser s) {
062: if (s != null) {
063: this .lastUpdateUserId = s.getUniversalUser()
064: .getPersonUniversalIdentifier();
065: } else {
066: this .lastUpdateUserId = null;
067: }
068: this .lastUpdateUser = s;
069: }
070:
071: public String getLastUpdateUserId() {
072: return lastUpdateUserId;
073: }
074:
075: public void setLastUpdateUserId(String lastUpdateUserId) {
076: this .lastUpdateUserId = lastUpdateUserId;
077: }
078:
079: public void updateUser(UniversalUserService userService)
080: throws UserNotFoundException {
081: UniversalUser u = userService
082: .getUniversalUser(lastUpdateUserId);
083: if (u == null) {
084: setLastUpdateUser(null);
085: } else {
086: setLastUpdateUser(new PdpUser(u));
087: }
088: }
089:
090: /**
091: * @hibernate.id column="DOC_TYP_ID" generator-class="sequence"
092: * @hibernate.generator-param name="sequence" value="PDP.PDP_DOC_TYP_ID_SEQ"
093: * @return Returns the documentTypeId.
094: */
095: public Integer getId() {
096: return id;
097: }
098:
099: /**
100: * @param documentTypeId The documentTypeId to set.
101: */
102: public void setId(Integer documentTypeId) {
103: this .id = documentTypeId;
104: }
105:
106: /**
107: * @return
108: * @hibernate.property column="LST_UPDT_TS" not-null="true"
109: */
110: public Timestamp getLastUpdate() {
111: return lastUpdate;
112: }
113:
114: /**
115: * @return
116: * @hibernate.property column="FDOC_TYP_CD" length="4"
117: */
118: public String getFdocTypeCode() {
119: return fdocTypeCode;
120: }
121:
122: /**
123: * @return
124: * @hibernate.version column="VER_NBR" not-null="true"
125: */
126: public Integer getVersion() {
127: return version;
128: }
129:
130: /**
131: * @return
132: * @hibernate.property class="edu.iu.uis.pdp.bo.DisbursementType" column="DISB_TYP_CD" not-null="true"
133: */
134: public DisbursementType getDisbursementType() {
135: return disbursementType;
136: }
137:
138: /**
139: * @return
140: * @hibernate.property column="FS_ORIGIN_CD" length="2"
141: */
142: public String getFsOriginCode() {
143: return fsOriginCode;
144: }
145:
146: /**
147: * @return
148: * @hibernate.many-to-one class="edu.iu.uis.pdp.bo.TransactionType" column="TRN_TYP_CD" not-null="true"
149: */
150: public TransactionType getTransactionType() {
151: return transactionType;
152: }
153:
154: /**
155: * @param string
156: */
157: public void setDisbursementType(DisbursementType disbursementType) {
158: this .disbursementType = disbursementType;
159: }
160:
161: /**
162: * @param string
163: */
164: public void setFdocTypeCode(String string) {
165: fdocTypeCode = string;
166: }
167:
168: /**
169: * @param string
170: */
171: public void setFsOriginCode(String string) {
172: fsOriginCode = string;
173: }
174:
175: /**
176: * @param timestamp
177: */
178: public void setLastUpdate(Timestamp timestamp) {
179: lastUpdate = timestamp;
180: }
181:
182: /**
183: * @param string
184: */
185: public void setTransactionType(TransactionType transactionType) {
186: this .transactionType = transactionType;
187: }
188:
189: /**
190: * @param integer
191: */
192: public void setVersion(Integer integer) {
193: version = integer;
194: }
195:
196: public boolean equals(Object obj) {
197: if (!(obj instanceof DocumentType)) {
198: return false;
199: }
200: DocumentType o = (DocumentType) obj;
201: return new EqualsBuilder().append(id, o.getId()).isEquals();
202: }
203:
204: public int hashCode() {
205: return new HashCodeBuilder(83, 47).append(id).toHashCode();
206: }
207:
208: public String toString() {
209: return new ToStringBuilder(this ).append("id", this .id)
210: .toString();
211: }
212:
213: public void beforeInsert(PersistenceBroker broker)
214: throws PersistenceBrokerException {
215: lastUpdate = new Timestamp((new Date()).getTime());
216: }
217:
218: public void afterInsert(PersistenceBroker broker)
219: throws PersistenceBrokerException {
220:
221: }
222:
223: public void beforeUpdate(PersistenceBroker broker)
224: throws PersistenceBrokerException {
225: lastUpdate = new Timestamp((new Date()).getTime());
226: }
227:
228: public void afterUpdate(PersistenceBroker broker)
229: throws PersistenceBrokerException {
230:
231: }
232:
233: public void beforeDelete(PersistenceBroker broker)
234: throws PersistenceBrokerException {
235:
236: }
237:
238: public void afterDelete(PersistenceBroker broker)
239: throws PersistenceBrokerException {
240:
241: }
242:
243: public void afterLookup(PersistenceBroker broker)
244: throws PersistenceBrokerException {
245:
246: }
247: }
|