001    /*
002     * Copyright 2011 The Kuali Foundation.
003     * 
004     * Licensed under the Educational Community License, Version 2.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/ecl2.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 Sep 2, 2004
018     *
019     */
020    package org.kuali.kfs.pdp.businessobject;
021    
022    import java.sql.Date;
023    import java.sql.Timestamp;
024    import java.util.LinkedHashMap;
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.kuali.kfs.coa.businessobject.Account;
030    import org.kuali.kfs.gl.businessobject.FlexibleAccountUpdateable;
031    import org.kuali.kfs.gl.businessobject.OriginEntryFull;
032    import org.kuali.kfs.sys.KFSPropertyConstants;
033    import org.kuali.rice.kns.bo.PersistableBusinessObjectBase;
034    import org.kuali.rice.kns.util.KualiDecimal;
035    import org.kuali.rice.kns.util.KualiInteger;
036    
037    /**
038     * General Ledger Pending Table for PDP
039     */
040    public class GlPendingTransaction extends PersistableBusinessObjectBase implements FlexibleAccountUpdateable {
041        private KualiInteger id; // GL_PENDING_ENTRY_ID NUMBER 8 0
042        private String fsOriginCd; // FS_ORIGIN_CD VARCHAR2 2
043        private String fdocNbr; // FDOC_NBR VARCHAR2 9
044        private KualiInteger sequenceNbr; // TRN_ENTR_SEQ_NBR NUMBER 5 0
045        private String chartOfAccountsCode; // FIN_COA_CD VARCHAR2 2
046        private String accountNumber; // ACCOUNT_NBR VARCHAR2 7
047        private String subAccountNumber; // SUB_ACCOUNT_NBR VARCHAR2 5
048        private String financialObjectCode; // FIN_OBJECT_CD VARCHAR2 4
049        private String financialSubObjectCode; // FIN_SUB_OBJ_CD VARCHAR2 3
050        private String financialBalanceTypeCode; // FIN_BALANCE_TYP_CD VARCHAR2 2
051        private String finObjTypCd; // FIN_OBJ_TYP_CD VARCHAR2 2
052        private Integer universityFiscalYear; // UNIV_FISCAL_YR NUMBER 4 0
053        private String univFiscalPrdCd; // UNIV_FISCAL_PRD_CD VARCHAR2 2
054        private String description; // TRN_LDGR_ENTR_DESC VARCHAR2 40
055        private KualiDecimal amount; // TRN_LDGR_ENTR_AMT NUMBER 19 2
056        private String debitCrdtCd; // TRN_DEBIT_CRDT_CD VARCHAR2 1
057        private Date transactionDt; // TRANSACTION_DT DATE 7
058        private String financialDocumentTypeCode; // FDOC_TYP_CD VARCHAR2 4
059        private String orgDocNbr; // ORG_DOC_NBR VARCHAR2 10
060        private String projectCd; // PROJECT_CD VARCHAR2 10
061        private String orgReferenceId; // ORG_REFERENCE_ID VARCHAR2 8
062        private String fdocRefTypCd; // FDOC_REF_TYP_CD VARCHAR2 4
063        private String fsRefOriginCd; // FS_REF_ORIGIN_CD VARCHAR2 2
064        private String fdocRefNbr; // FDOC_REF_NBR VARCHAR2 9
065        private Date fdocReversalDt; // FDOC_REVERSAL_DT DATE 7
066        private String trnEncumUpdtCd; // TRN_ENCUM_UPDT_CD VARCHAR2 1
067        private String fdocApprovedCd; // FDOC_APPROVED_CD VARCHAR2 1
068        private String acctSfFinObjCd; // ACCT_SF_FINOBJ_CD VARCHAR2 4
069        private String trnEntrOfstCd; // TRN_ENTR_OFST_CD VARCHAR2 1
070        private boolean processInd; // TRN_EXTRT_IND VARCHAR2 7
071    
072        public GlPendingTransaction() {
073            super();
074            
075            processInd = false;
076        }
077    
078        public OriginEntryFull getOriginEntry() {
079            OriginEntryFull oe = new OriginEntryFull();
080    
081            oe.setFinancialSystemOriginationCode(fsOriginCd);
082            oe.setDocumentNumber(fdocNbr);
083            oe.setTransactionLedgerEntrySequenceNumber(sequenceNbr.intValue());
084            oe.setChartOfAccountsCode(chartOfAccountsCode);
085            oe.setAccountNumber(accountNumber);
086            oe.setSubAccountNumber(subAccountNumber);
087            oe.setFinancialObjectCode(financialObjectCode);
088            oe.setFinancialSubObjectCode(financialSubObjectCode);
089            oe.setFinancialBalanceTypeCode(financialBalanceTypeCode);
090            oe.setFinancialObjectTypeCode(finObjTypCd);
091            oe.setUniversityFiscalYear(universityFiscalYear);
092            oe.setUniversityFiscalPeriodCode(univFiscalPrdCd);
093            oe.setTransactionLedgerEntryDescription(description);
094            if (amount != null) {
095                oe.setTransactionLedgerEntryAmount(amount);
096            }
097            oe.setTransactionDebitCreditCode(debitCrdtCd);
098            if (transactionDt != null) {
099                oe.setTransactionDate(new Date(transactionDt.getTime()));
100            }
101            oe.setFinancialDocumentTypeCode(financialDocumentTypeCode);
102            oe.setOrganizationDocumentNumber(orgDocNbr);
103            oe.setProjectCode(projectCd);
104            oe.setOrganizationReferenceId(orgReferenceId);
105            oe.setReferenceFinancialDocumentTypeCode(fdocRefTypCd);
106            oe.setReferenceFinancialSystemOriginationCode(fsRefOriginCd);
107            oe.setReferenceFinancialDocumentNumber(fdocRefNbr);
108            if (fdocReversalDt != null) {
109                oe.setFinancialDocumentReversalDate(new Date(fdocReversalDt.getTime()));
110            }
111            oe.setTransactionEncumbranceUpdateCode(trnEncumUpdtCd);
112    
113            return oe;
114        }
115    
116        public String getAccountNumber() {
117            return accountNumber;
118        }
119    
120        public void setAccountNumber(String accountNbr) {
121            this.accountNumber = accountNbr;
122        }
123    
124        public String getAcctSfFinObjCd() {
125            return acctSfFinObjCd;
126        }
127    
128        public void setAcctSfFinObjCd(String acctSfFinObjCd) {
129            this.acctSfFinObjCd = acctSfFinObjCd;
130        }
131    
132        public KualiDecimal getAmount() {
133            return amount;
134        }
135    
136        public void setAmount(KualiDecimal amount) {
137            this.amount = amount;
138        }
139    
140        public String getDebitCrdtCd() {
141            return debitCrdtCd;
142        }
143    
144        public void setDebitCrdtCd(String debitCrdtCd) {
145            this.debitCrdtCd = debitCrdtCd;
146        }
147    
148        public String getDescription() {
149            return description;
150        }
151    
152        public void setDescription(String description) {
153            this.description = description;
154        }
155    
156        public String getFdocApprovedCd() {
157            return fdocApprovedCd;
158        }
159    
160        public void setFdocApprovedCd(String fdocApprovedCd) {
161            this.fdocApprovedCd = fdocApprovedCd;
162        }
163    
164        public String getFdocNbr() {
165            return fdocNbr;
166        }
167    
168        public void setFdocNbr(String fdocNbr) {
169            this.fdocNbr = fdocNbr;
170        }
171    
172        public String getFdocRefNbr() {
173            return fdocRefNbr;
174        }
175    
176        public void setFdocRefNbr(String fdocRefNbr) {
177            this.fdocRefNbr = fdocRefNbr;
178        }
179    
180        public String getFdocRefTypCd() {
181            return fdocRefTypCd;
182        }
183    
184        public void setFdocRefTypCd(String fdocRefTypCd) {
185            this.fdocRefTypCd = fdocRefTypCd;
186        }
187    
188        public Date getFdocReversalDt() {
189            return fdocReversalDt;
190        }
191    
192        public void setFdocReversalDt(Date fdocReversalDt) {
193            this.fdocReversalDt = fdocReversalDt;
194        }
195    
196        public String getFinancialDocumentTypeCode() {
197            return financialDocumentTypeCode;
198        }
199    
200        public void setFinancialDocumentTypeCode(String fdocTypCd) {
201            this.financialDocumentTypeCode = fdocTypCd;
202        }
203    
204        public String getFinancialBalanceTypeCode() {
205            return financialBalanceTypeCode;
206        }
207    
208        public void setFinancialBalanceTypeCode(String finBalanceTypCd) {
209            this.financialBalanceTypeCode = finBalanceTypCd;
210        }
211    
212        public String getChartOfAccountsCode() {
213            return chartOfAccountsCode;
214        }
215    
216        public void setChartOfAccountsCode(String finCoaCd) {
217            this.chartOfAccountsCode = finCoaCd;
218        }
219    
220        public String getFinancialObjectCode() {
221            return financialObjectCode;
222        }
223    
224        public void setFinancialObjectCode(String finObjectCd) {
225            this.financialObjectCode = finObjectCd;
226        }
227    
228        public String getFinObjTypCd() {
229            return finObjTypCd;
230        }
231    
232        public void setFinObjTypCd(String finObjTypCd) {
233            this.finObjTypCd = finObjTypCd;
234        }
235    
236        public String getFinancialSubObjectCode() {
237            return financialSubObjectCode;
238        }
239    
240        public void setFinancialSubObjectCode(String finSubObjCd) {
241            this.financialSubObjectCode = finSubObjCd;
242        }
243    
244        public String getFsOriginCd() {
245            return fsOriginCd;
246        }
247    
248        public void setFsOriginCd(String fsOriginCd) {
249            this.fsOriginCd = fsOriginCd;
250        }
251    
252        public String getFsRefOriginCd() {
253            return fsRefOriginCd;
254        }
255    
256        public void setFsRefOriginCd(String fsRefOriginCd) {
257            this.fsRefOriginCd = fsRefOriginCd;
258        }
259    
260        public KualiInteger getId() {
261            return id;
262        }
263    
264        public void setId(KualiInteger id) {
265            this.id = id;
266        }
267    
268        public String getOrgDocNbr() {
269            return orgDocNbr;
270        }
271    
272        public void setOrgDocNbr(String orgDocNbr) {
273            this.orgDocNbr = orgDocNbr;
274        }
275    
276        public String getOrgReferenceId() {
277            return orgReferenceId;
278        }
279    
280        public void setOrgReferenceId(String orgReferenceId) {
281            this.orgReferenceId = orgReferenceId;
282        }
283    
284        /**
285         * Gets the processInd attribute.
286         * 
287         * @return Returns the processInd.
288         */
289        public boolean isProcessInd() {
290            return processInd;
291        }
292    
293        /**
294         * Sets the processInd attribute value.
295         * 
296         * @param processInd The processInd to set.
297         */
298        public void setProcessInd(boolean processInd) {
299            this.processInd = processInd;
300        }
301    
302        public String getProjectCd() {
303            return projectCd;
304        }
305    
306        public void setProjectCd(String projectCd) {
307            this.projectCd = projectCd;
308        }
309    
310        public KualiInteger getSequenceNbr() {
311            return sequenceNbr;
312        }
313    
314        public void setSequenceNbr(KualiInteger sequenceNbr) {
315            this.sequenceNbr = sequenceNbr;
316        }
317    
318        public String getSubAccountNumber() {
319            return subAccountNumber;
320        }
321    
322        public void setSubAccountNumber(String subAccountNbr) {
323            this.subAccountNumber = subAccountNbr;
324        }
325    
326        public Date getTransactionDt() {
327            return transactionDt;
328        }
329    
330        public void setTransactionDt(Date transactionDt) {
331            this.transactionDt = transactionDt;
332        }
333    
334        public String getTrnEncumUpdtCd() {
335            return trnEncumUpdtCd;
336        }
337    
338        public void setTrnEncumUpdtCd(String trnEncumUpdtCd) {
339            this.trnEncumUpdtCd = trnEncumUpdtCd;
340        }
341    
342        public String getTrnEntrOfstCd() {
343            return trnEntrOfstCd;
344        }
345    
346        public void setTrnEntrOfstCd(String trnEntrOfstCd) {
347            this.trnEntrOfstCd = trnEntrOfstCd;
348        }
349    
350        public String getUnivFiscalPrdCd() {
351            return univFiscalPrdCd;
352        }
353    
354        public void setUnivFiscalPrdCd(String univFiscalPrdCd) {
355            this.univFiscalPrdCd = univFiscalPrdCd;
356        }
357    
358        public Integer getUniversityFiscalYear() {
359            return universityFiscalYear;
360        }
361    
362        public void setUniversityFiscalYear(Integer univFiscalYr) {
363            this.universityFiscalYear = univFiscalYr;
364        }
365    
366        public boolean equals(Object obj) {
367            if (!(obj instanceof GlPendingTransaction)) {
368                return false;
369            }
370            GlPendingTransaction o = (GlPendingTransaction) obj;
371            return new EqualsBuilder().append(id, o.getId()).isEquals();
372        }
373    
374        public int hashCode() {
375            return new HashCodeBuilder(83, 5).append(id).toHashCode();
376        }
377    
378        public String toString() {
379            return new ToStringBuilder(this).append("id", id).toString();
380        }
381    
382        public void setAccount(Account a) { /* don't do nada; we're just fulfilling the contract of FlexibleAccountUpdateable */
383        }
384    
385        @Override
386        protected LinkedHashMap toStringMapper() {
387            LinkedHashMap m = new LinkedHashMap();
388            m.put(KFSPropertyConstants.ID, this.id);
389    
390            return m;
391        }
392    }