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    package org.kuali.kfs.sys.businessobject;
017    
018    import java.io.Serializable;
019    import java.util.HashMap;
020    import java.util.Iterator;
021    import java.util.LinkedHashMap;
022    import java.util.Map;
023    
024    import org.apache.commons.lang.StringUtils;
025    import org.apache.commons.lang.builder.EqualsBuilder;
026    import org.apache.commons.lang.builder.HashCodeBuilder;
027    import org.apache.log4j.Logger;
028    import org.kuali.kfs.coa.businessobject.Account;
029    import org.kuali.kfs.coa.businessobject.BalanceType;
030    import org.kuali.kfs.coa.businessobject.Chart;
031    import org.kuali.kfs.coa.businessobject.ObjectCode;
032    import org.kuali.kfs.coa.businessobject.ObjectType;
033    import org.kuali.kfs.coa.businessobject.ProjectCode;
034    import org.kuali.kfs.coa.businessobject.SubAccount;
035    import org.kuali.kfs.coa.businessobject.SubObjectCode;
036    import org.kuali.kfs.coa.service.AccountService;
037    import org.kuali.kfs.fp.businessobject.SalesTax;
038    import org.kuali.kfs.sys.KFSPropertyConstants;
039    import org.kuali.kfs.sys.context.SpringContext;
040    import org.kuali.kfs.sys.service.UniversityDateService;
041    import org.kuali.rice.kew.doctype.bo.DocumentTypeEBO;
042    import org.kuali.rice.kew.service.impl.KEWModuleService;
043    import org.kuali.rice.kns.bo.PersistableBusinessObjectBase;
044    import org.kuali.rice.kns.util.KualiDecimal;
045    import org.kuali.rice.kns.util.ObjectUtils;
046    
047    /**
048     * This is the generic class which contains all the elements on a typical line of accounting elements. These are all the accounting
049     * items necessary to create a pending entry to the G/L. All transaction documents will use this business object inherently.
050     */
051    public abstract class AccountingLineBase extends PersistableBusinessObjectBase implements Serializable, AccountingLine, GeneralLedgerPendingEntrySourceDetail {
052        private static Logger LOG = Logger.getLogger(AccountingLineBase.class);
053    
054        private String documentNumber;
055        private Integer sequenceNumber; // relative to the grouping of acctng lines
056        private Integer postingYear;
057        private KualiDecimal amount;
058        private String referenceOriginCode;
059        private String referenceNumber;
060        private String referenceTypeCode;
061        private String overrideCode = AccountingLineOverride.CODE.NONE;
062        private boolean accountExpiredOverride; // for the UI, persisted in overrideCode
063        private boolean accountExpiredOverrideNeeded; // for the UI, not persisted
064        private boolean nonFringeAccountOverride; // for the UI, persisted in overrideCode
065        private boolean nonFringeAccountOverrideNeeded; // for the UI, not persisted
066        private boolean objectBudgetOverride;
067        private boolean objectBudgetOverrideNeeded;
068        private String organizationReferenceId;
069        private String debitCreditCode; // should only be set by the Journal Voucher or Auxiliary Voucher document
070        private String encumbranceUpdateCode; // should only be set by the Journal Voucher document
071        protected String financialDocumentLineTypeCode;
072        protected String financialDocumentLineDescription;
073        protected boolean salesTaxRequired;
074    
075        private String chartOfAccountsCode;
076        private String accountNumber;
077        private String financialObjectCode;
078        private String subAccountNumber;
079        private String financialSubObjectCode;
080        private String projectCode;
081        private String balanceTypeCode;
082    
083        // bo references
084        private Chart chart;
085        private Account account;
086        private ObjectCode objectCode;
087        private SubAccount subAccount;
088        private SubObjectCode subObjectCode;
089        private ProjectCode project;
090        private BalanceType balanceTyp;
091        private OriginationCode referenceOrigin;
092        private DocumentTypeEBO referenceFinancialSystemDocumentTypeCode;
093        private SalesTax salesTax;
094    
095        /**
096         * This constructor sets up empty instances for the dependent objects.
097         */
098        public AccountingLineBase() {
099            setAmount(KualiDecimal.ZERO);
100            chart = new Chart();
101            account = new Account();
102            objectCode = new ObjectCode();
103            subAccount = new SubAccount();
104            subObjectCode = new SubObjectCode();
105            project = new ProjectCode();
106    
107            balanceTyp = new BalanceType();
108            // salesTax = new SalesTax();
109            salesTaxRequired = false;
110        }
111    
112    
113        /**
114         * @return Returns the account.
115         */
116        public Account getAccount() {
117            return account;
118        }
119    
120        /**
121         * @param account The account to set.
122         * @deprecated
123         */
124        public void setAccount(Account account) {
125            this.account = account;
126        }
127    
128        /**
129         * @return Returns the chartOfAccountsCode.
130         */
131        public Chart getChart() {
132            return chart;
133        }
134    
135        /**
136         * @param chart The chartOfAccountsCode to set.
137         * @deprecated
138         */
139        public void setChart(Chart chart) {
140            this.chart = chart;
141        }
142    
143        /**
144         * @return Returns the documentNumber.
145         */
146        public String getDocumentNumber() {
147            return documentNumber;
148        }
149    
150        /**
151         * @return Returns the amount.
152         */
153        public KualiDecimal getAmount() {
154            return amount;
155        }
156    
157        /**
158         * @param amount The amount to set.
159         */
160        public void setAmount(KualiDecimal amount) {
161            this.amount = amount;
162        }
163    
164        /**
165         * @return Returns the balanceTyp.
166         */
167        public BalanceType getBalanceTyp() {
168            return balanceTyp;
169        }
170    
171        /**
172         * @param balanceTyp The balanceTyp to set.
173         * @deprecated
174         */
175        public void setBalanceTyp(BalanceType balanceTyp) {
176            this.balanceTyp = balanceTyp;
177        }
178    
179        /**
180         * @return Returns the objectCode.
181         */
182        public ObjectCode getObjectCode() {
183            return objectCode;
184        }
185    
186        /**
187         * @param objectCode The objectCode to set.
188         * @deprecated
189         */
190        public void setObjectCode(ObjectCode objectCode) {
191            this.objectCode = objectCode;
192        }
193    
194        /**
195         * @return Returns the referenceOriginCode.
196         */
197        public String getReferenceOriginCode() {
198            return referenceOriginCode;
199        }
200    
201        /**
202         * @param originCode The referenceOriginCode to set.
203         */
204        public void setReferenceOriginCode(String originCode) {
205            this.referenceOriginCode = originCode;
206        }
207    
208        /**
209         * This method returns the object related to referenceOriginCode
210         * 
211         * @return referenceOrigin
212         */
213        public OriginationCode getReferenceOrigin() {
214            return referenceOrigin;
215        }
216    
217        /**
218         * This method sets the referenceOrigin object, this is only to be used by OJB
219         * 
220         * @param referenceOrigin
221         * @deprecated
222         */
223        public void setReferenceOrigin(OriginationCode referenceOrigin) {
224            this.referenceOrigin = referenceOrigin;
225        }
226    
227        /**
228         * Gets the referenceFinancialSystemDocumentTypeCode attribute. 
229         * @return Returns the referenceFinancialSystemDocumentTypeCode.
230         */
231        public DocumentTypeEBO getReferenceFinancialSystemDocumentTypeCode() {
232            return referenceFinancialSystemDocumentTypeCode = SpringContext.getBean(KEWModuleService.class).retrieveExternalizableBusinessObjectIfNecessary(this, referenceFinancialSystemDocumentTypeCode, "referenceFinancialSystemDocumentTypeCode");
233        }
234    
235        /**
236         * @return Returns the organizationReferenceId.
237         */
238        public String getOrganizationReferenceId() {
239            return organizationReferenceId;
240        }
241    
242        /**
243         * @param organizationReferenceId The organizationReferenceId to set.
244         */
245        public void setOrganizationReferenceId(String organizationReferenceId) {
246            this.organizationReferenceId = organizationReferenceId;
247        }
248    
249        /**
250         * @return Returns the overrideCode.
251         */
252        public String getOverrideCode() {
253            return overrideCode;
254        }
255    
256        /**
257         * @param overrideCode The overrideCode to set.
258         */
259        public void setOverrideCode(String overrideCode) {
260            this.overrideCode = overrideCode;
261        }
262    
263        /**
264         * @return Returns the postingYear.
265         */
266        public Integer getPostingYear() {
267            if (postingYear == null) {
268                postingYear = SpringContext.getBean(UniversityDateService.class).getCurrentFiscalYear();
269            }
270            return postingYear;
271        }
272    
273        /**
274         * @param postingYear The postingYear to set.
275         */
276        public void setPostingYear(Integer postingYear) {
277            this.postingYear = postingYear;
278        }
279    
280        /**
281         * @return Returns the projectCode.
282         */
283        public String getProjectCode() {
284            return projectCode;
285        }
286    
287        /**
288         * @param projectCode The projectCode to set.
289         */
290        public void setProjectCode(String projectCode) {
291            this.projectCode = projectCode;
292        }
293    
294        /**
295         * @return Returns the referenceNumber.
296         */
297        public String getReferenceNumber() {
298            return referenceNumber;
299        }
300    
301        /**
302         * @param referenceNumber The referenceNumber to set.
303         */
304        public void setReferenceNumber(String referenceNumber) {
305            this.referenceNumber = referenceNumber;
306        }
307    
308        /**
309         * @return Returns the referenceTypeCode.
310         */
311        public String getReferenceTypeCode() {
312            return referenceTypeCode;
313        }
314    
315        /**
316         * @param referenceTypeCode The referenceTypeCode to set.
317         */
318        public void setReferenceTypeCode(String referenceTypeCode) {
319            this.referenceTypeCode = referenceTypeCode;
320        }
321    
322        /**
323         * @return Returns the sequenceNumber.
324         */
325        public Integer getSequenceNumber() {
326            return sequenceNumber;
327        }
328    
329        /**
330         * @param sequenceNumber The sequenceNumber to set.
331         */
332        public void setSequenceNumber(Integer sequenceNumber) {
333            this.sequenceNumber = sequenceNumber;
334        }
335    
336        /**
337         * @return Returns the subAccount.
338         */
339        public SubAccount getSubAccount() {
340            return subAccount;
341        }
342    
343        /**
344         * @param subAccount The subAccount to set.
345         * @deprecated
346         */
347        public void setSubAccount(SubAccount subAccount) {
348            this.subAccount = subAccount;
349        }
350    
351        /**
352         * @return Returns the subObjectCode.
353         */
354        public SubObjectCode getSubObjectCode() {
355            return subObjectCode;
356        }
357    
358        /**
359         * @param subObjectCode The subObjectCode to set.
360         * @deprecated
361         */
362        public void setSubObjectCode(SubObjectCode subObjectCode) {
363            this.subObjectCode = subObjectCode;
364        }
365    
366    
367        /**
368         * @see org.kuali.kfs.sys.businessobject.AccountingLine#getSalesTax()
369         */
370        public SalesTax getSalesTax() {
371            return salesTax;
372        }
373    
374        /**
375         * @see org.kuali.kfs.sys.businessobject.AccountingLine#setSalesTax(org.kuali.kfs.fp.businessobject.SalesTax)
376         * @deprecated
377         */
378        public void setSalesTax(SalesTax salesTax) {
379            this.salesTax = salesTax;
380        }
381    
382        /**
383         * @see org.kuali.kfs.sys.businessobject.AccountingLine#isSalesTaxRequired()
384         */
385        public boolean isSalesTaxRequired() {
386            return salesTaxRequired;
387        }
388    
389        /**
390         * @see org.kuali.kfs.sys.businessobject.AccountingLine#setSalesTaxRequired(boolean)
391         */
392        public void setSalesTaxRequired(boolean salesTaxRequired) {
393            this.salesTaxRequired = salesTaxRequired;
394        }
395    
396    
397        /**
398         * @param documentNumber The documentNumber to set.
399         */
400        public void setDocumentNumber(String documentNumber) {
401            this.documentNumber = documentNumber;
402        }
403    
404        /**
405         * This method retrieves the debit/credit code for the accounting line. This method will only return a not null value for a
406         * Journal Voucher document.
407         * 
408         * @return A String code.
409         */
410        public String getDebitCreditCode() {
411            return debitCreditCode;
412        }
413    
414        /**
415         * This method sets the debit/credit code for the accounting line. This method should only be used for a Journal Voucher
416         * document.
417         * 
418         * @param debitCreditCode
419         */
420        public void setDebitCreditCode(String debitCreditCode) {
421            this.debitCreditCode = debitCreditCode;
422        }
423    
424        /**
425         * This method retrieves the encumbrance update code for the accounting line. This method will only return a not null value for
426         * a Journal Voucher document.
427         * 
428         * @return A String code.
429         */
430        public String getEncumbranceUpdateCode() {
431            return encumbranceUpdateCode;
432        }
433    
434        /**
435         * This method sets the debit/credit code for the accounting line. This method should only be used for a Journal Voucher
436         * document.
437         * 
438         * @param encumbranceUpdateCode
439         */
440        public void setEncumbranceUpdateCode(String encumbranceUpdateCode) {
441            this.encumbranceUpdateCode = encumbranceUpdateCode;
442        }
443    
444        /**
445         * This method retrieves the ObjectType for the accounting line. This method will only return a not null value for a Journal
446         * Voucher document.
447         * 
448         * @return An ObjectType instance.
449         */
450        public ObjectType getObjectType() {
451            if ( getObjectTypeCode() != null ) {
452                return objectCode.getFinancialObjectType();
453            }
454            return null;
455        }
456    
457        /**
458         * @return Returns the accountNumber.
459         */
460        public String getAccountNumber() {
461            return accountNumber;
462        }
463    
464        /**
465         * @param accountNumber The accountNumber to set.
466         */
467        public void setAccountNumber(String accountNumber) {
468            this.accountNumber = accountNumber;
469            // if accounts can't cross charts, set chart code whenever account number is set
470            SpringContext.getBean(AccountService.class).populateAccountingLineChartIfNeeded(this);
471        }
472    
473        /**
474         * @return Returns the balanceTypeCode.
475         */
476        public String getBalanceTypeCode() {
477            return balanceTypeCode;
478        }
479    
480        /**
481         * @param balanceTypeCode The balanceTypeCode to set.
482         */
483        public void setBalanceTypeCode(String balanceTypeCode) {
484            this.balanceTypeCode = balanceTypeCode;
485        }
486    
487        /**
488         * @return Returns the chartOfAccountsCode.
489         */
490        public String getChartOfAccountsCode() {
491            return chartOfAccountsCode;
492        }
493    
494        /**
495         * @param chartOfAccountsCode The chartOfAccountsCode to set.
496         */
497        public void setChartOfAccountsCode(String chartOfAccountsCode) {
498            this.chartOfAccountsCode = chartOfAccountsCode;
499        }
500    
501        /**
502         * @return Returns the financialObjectCode.
503         */
504        public String getFinancialObjectCode() {
505            return financialObjectCode;
506        }
507    
508        /**
509         * @param financialObjectCode The financialObjectCode to set.
510         */
511        public void setFinancialObjectCode(String financialObjectCode) {
512            this.financialObjectCode = financialObjectCode;
513        }
514    
515        /**
516         * @return Returns the financialSubObjectCode.
517         */
518        public String getFinancialSubObjectCode() {
519            return financialSubObjectCode;
520        }
521    
522        /**
523         * @param financialSubObjectCode The financialSubObjectCode to set.
524         */
525        public void setFinancialSubObjectCode(String financialSubObjectCode) {
526            this.financialSubObjectCode = financialSubObjectCode;
527        }
528    
529        /**
530         * @return Returns the objectTypeCode.
531         */
532        public String getObjectTypeCode() {
533            if ( ObjectUtils.isNull(objectCode)
534                    || !StringUtils.equals(getFinancialObjectCode(), objectCode.getFinancialObjectCode())
535                    || !StringUtils.equals(getChartOfAccountsCode(), objectCode.getChartOfAccountsCode())
536                    || !getPostingYear().equals(objectCode.getUniversityFiscalYear() )
537                            ) {
538                refreshReferenceObject("objectCode");
539            }
540           
541            if (!ObjectUtils.isNull(objectCode)) {
542                return objectCode.getFinancialObjectTypeCode();
543            }
544            return null;
545        }
546    
547        /**
548         * @return Returns the financialDocumentLineTypeCode.
549         */
550        public String getFinancialDocumentLineTypeCode() {
551            return financialDocumentLineTypeCode;
552        }
553    
554        /**
555         * @param financialDocumentLineTypeCode The financialDocumentLineTypeCode to set.
556         */
557        public void setFinancialDocumentLineTypeCode(String financialDocumentLineTypeCode) {
558            this.financialDocumentLineTypeCode = financialDocumentLineTypeCode;
559        }
560    
561        /**
562         * @return Returns the project.
563         */
564        public ProjectCode getProject() {
565            return project;
566        }
567    
568        /**
569         * @param project The project to set.
570         * @deprecated
571         */
572        public void setProject(ProjectCode project) {
573            this.project = project;
574        }
575    
576        /**
577         * @return Returns the subAccountNumber.
578         */
579        public String getSubAccountNumber() {
580            return subAccountNumber;
581        }
582    
583        /**
584         * @param subAccountNumber The subAccountNumber to set.
585         */
586        public void setSubAccountNumber(String subAccountNumber) {
587            this.subAccountNumber = subAccountNumber;
588        }
589    
590        /**
591         * @return Returns the financialDocumentLineDescription.
592         */
593        public String getFinancialDocumentLineDescription() {
594            return financialDocumentLineDescription;
595        }
596    
597        /**
598         * @param financialDocumentLineDescription The financialDocumentLineDescription to set.
599         */
600        public void setFinancialDocumentLineDescription(String financialDocumentLineDescription) {
601            this.financialDocumentLineDescription = financialDocumentLineDescription;
602        }
603    
604        /**
605         * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper()
606         */
607        protected LinkedHashMap toStringMapper() {
608            LinkedHashMap m = new LinkedHashMap();
609    
610            m.put(KFSPropertyConstants.DOCUMENT_NUMBER, documentNumber);
611    
612            m.put("sequenceNumber", sequenceNumber);
613            m.put("postingYear", postingYear);
614            m.put("amount", amount);
615            m.put("debitCreditCode", debitCreditCode);
616            m.put("encumbranceUpdateCode", encumbranceUpdateCode);
617            m.put("financialDocumentLineDescription", financialDocumentLineDescription);
618    
619            m.put("chart", getChartOfAccountsCode());
620            m.put("account", getAccountNumber());
621            m.put("objectCode", getFinancialObjectCode());
622            m.put("subAccount", getSubAccountNumber());
623            m.put("subObjectCode", getFinancialSubObjectCode());
624            m.put("projectCode", getProjectCode());
625            m.put("balanceTyp", getBalanceTypeCode());
626    
627            m.put("orgRefId", getOrganizationReferenceId());
628    
629            return m;
630        }
631    
632        /**
633         * @see org.kuali.rice.kns.bo.AccountingLine#isSourceAccountingLine()
634         */
635        public boolean isSourceAccountingLine() {
636            return (this instanceof SourceAccountingLine);
637        }
638    
639        /**
640         * @see org.kuali.rice.kns.bo.AccountingLine#isTargetAccountingLine()
641         */
642        public boolean isTargetAccountingLine() {
643            return (this instanceof TargetAccountingLine);
644        }
645    
646    
647        /**
648         * @see org.kuali.rice.kns.bo.AccountingLine#getAccountKey()
649         */
650        public String getAccountKey() {
651            String key = getChartOfAccountsCode() + ":" + getAccountNumber();
652            return key;
653        }
654    
655    
656        /**
657         * @see org.kuali.rice.kns.bo.AccountingLine#copyFrom(org.kuali.rice.kns.bo.AccountingLine)
658         */
659        public void copyFrom(AccountingLine other) {
660            if (other == null) {
661                throw new IllegalArgumentException("invalid (null) other");
662            }
663    
664            if (this != other) {
665                // primitive fields
666                setSequenceNumber(other.getSequenceNumber());
667                setDocumentNumber(other.getDocumentNumber());
668                setPostingYear(other.getPostingYear());
669                setAmount(other.getAmount());
670                setReferenceOriginCode(other.getReferenceOriginCode());
671                setReferenceNumber(other.getReferenceNumber());
672                setReferenceTypeCode(other.getReferenceTypeCode());
673                setOverrideCode(other.getOverrideCode());
674                setOrganizationReferenceId(other.getOrganizationReferenceId());
675                setDebitCreditCode(other.getDebitCreditCode());
676                setEncumbranceUpdateCode(other.getEncumbranceUpdateCode());
677                setFinancialDocumentLineTypeCode(other.getFinancialDocumentLineTypeCode());
678                setFinancialDocumentLineDescription(other.getFinancialDocumentLineDescription());
679                setAccountExpiredOverride(other.getAccountExpiredOverride());
680                setAccountExpiredOverrideNeeded(other.getAccountExpiredOverrideNeeded());
681                setObjectBudgetOverride(other.isObjectBudgetOverride());
682                setObjectBudgetOverrideNeeded(other.isObjectBudgetOverrideNeeded());
683    
684                // foreign keys
685                setChartOfAccountsCode(other.getChartOfAccountsCode());
686                setAccountNumber(other.getAccountNumber());
687                setFinancialObjectCode(other.getFinancialObjectCode());
688                setSubAccountNumber(other.getSubAccountNumber());
689                setFinancialSubObjectCode(other.getFinancialSubObjectCode());
690                setProjectCode(other.getProjectCode());
691                setBalanceTypeCode(other.getBalanceTypeCode());
692    
693                // sales tax
694                if (ObjectUtils.isNotNull(other.getSalesTax())) {
695                    SalesTax salesTax = getSalesTax();
696                    SalesTax origSalesTax = other.getSalesTax();
697                    if (salesTax != null) {
698                        salesTax.setAccountNumber(origSalesTax.getAccountNumber());
699                        salesTax.setChartOfAccountsCode(origSalesTax.getChartOfAccountsCode());
700                        salesTax.setFinancialDocumentGrossSalesAmount(origSalesTax.getFinancialDocumentGrossSalesAmount());
701                        salesTax.setFinancialDocumentTaxableSalesAmount(origSalesTax.getFinancialDocumentTaxableSalesAmount());
702                        salesTax.setFinancialDocumentSaleDate(origSalesTax.getFinancialDocumentSaleDate());
703    
704                        // primary keys
705                        salesTax.setDocumentNumber(other.getDocumentNumber());
706                        salesTax.setFinancialDocumentLineNumber(other.getSequenceNumber());
707                        salesTax.setFinancialDocumentLineTypeCode(other.getFinancialDocumentLineTypeCode());
708                    }
709                    else {
710                        salesTax = origSalesTax;
711                    }
712                }
713    
714                // object references
715                setChart(other.getChart());
716                setAccount(other.getAccount());
717                setObjectCode(other.getObjectCode());
718                setSubAccount(other.getSubAccount());
719                setSubObjectCode(other.getSubObjectCode());
720                setProject(other.getProject());
721                setBalanceTyp(other.getBalanceTyp());
722            }
723        }
724    
725    
726        /**
727         * @see org.kuali.rice.kns.bo.AccountingLine#isLike(org.kuali.rice.kns.bo.AccountingLine)
728         */
729        public boolean isLike(AccountingLine other) {
730            boolean isLike = false;
731    
732            if (other != null) {
733                if (other == this) {
734                    isLike = true;
735                }
736                else {
737                    Map thisValues = this.getValuesMap();
738                    Map otherValues = other.getValuesMap();
739    
740                    isLike = thisValues.equals(otherValues);
741    
742                    if (!isLike && LOG.isDebugEnabled()) {
743                        StringBuffer inequalities = new StringBuffer();
744                        boolean first = true;
745    
746                        for (Iterator i = thisValues.keySet().iterator(); i.hasNext();) {
747                            String key = (String) i.next();
748    
749                            Object thisValue = thisValues.get(key);
750                            Object otherValue = otherValues.get(key);
751                            if (!org.apache.commons.lang.ObjectUtils.equals(thisValue, otherValue)) {
752                                inequalities.append(key + "(" + thisValue + " != " + otherValue + ")");
753    
754                                if (first) {
755                                    first = false;
756                                }
757                                else {
758                                    inequalities.append(",");
759                                }
760                            }
761                        }
762    
763                        LOG.debug("inequalities: " + inequalities);
764                    }
765                }
766            }
767    
768            return isLike;
769        }
770    
771        /**
772         * @see AccountingLine#getAccountExpiredOverride()
773         */
774        public boolean getAccountExpiredOverride() {
775            return accountExpiredOverride;
776        }
777    
778        /**
779         * @see AccountingLine#setAccountExpiredOverride(boolean)
780         */
781        public void setAccountExpiredOverride(boolean b) {
782            accountExpiredOverride = b;
783        }
784    
785        /**
786         * @see AccountingLine#getAccountExpiredOverrideNeeded()
787         */
788        public boolean getAccountExpiredOverrideNeeded() {
789            return accountExpiredOverrideNeeded;
790        }
791    
792        /**
793         * @see AccountingLine#setAccountExpiredOverrideNeeded(boolean)
794         */
795        public void setAccountExpiredOverrideNeeded(boolean b) {
796            accountExpiredOverrideNeeded = b;
797        }
798    
799        /**
800         * @return Returns the objectBudgetOverride.
801         */
802        public boolean isObjectBudgetOverride() {
803            return objectBudgetOverride;
804        }
805    
806        /**
807         * @param objectBudgetOverride The objectBudgetOverride to set.
808         */
809        public void setObjectBudgetOverride(boolean objectBudgetOverride) {
810            this.objectBudgetOverride = objectBudgetOverride;
811        }
812    
813        /**
814         * @return Returns the objectBudgetOverrideNeeded.
815         */
816        public boolean isObjectBudgetOverrideNeeded() {
817            return objectBudgetOverrideNeeded;
818        }
819    
820        /**
821         * @param objectBudgetOverrideNeeded The objectBudgetOverrideNeeded to set.
822         */
823        public void setObjectBudgetOverrideNeeded(boolean objectBudgetOverrideNeeded) {
824            this.objectBudgetOverrideNeeded = objectBudgetOverrideNeeded;
825        }
826    
827        /**
828         * @see org.kuali.kfs.sys.businessobject.AccountingLine#isNonFringeAccountOverride()
829         */
830        public boolean getNonFringeAccountOverride() {
831            return nonFringeAccountOverride;
832        }
833    
834        /**
835         * @see org.kuali.kfs.sys.businessobject.AccountingLine#setNonFringeAccountOverride(boolean)
836         */
837        public void setNonFringeAccountOverride(boolean nonFringeAccountOverride) {
838            this.nonFringeAccountOverride = nonFringeAccountOverride;
839        }
840    
841        /**
842         * @see org.kuali.kfs.sys.businessobject.AccountingLine#isNonFringeAccountOverrideNeeded()
843         */
844        public boolean getNonFringeAccountOverrideNeeded() {
845            return nonFringeAccountOverrideNeeded;
846        }
847    
848        /**
849         * @see org.kuali.kfs.sys.businessobject.AccountingLine#setNonFringeAccountOverrideNeeded(boolean)
850         */
851        public void setNonFringeAccountOverrideNeeded(boolean nonFringeAccountOverrideNeeded) {
852            this.nonFringeAccountOverrideNeeded = nonFringeAccountOverrideNeeded;
853        }
854    
855        /**
856         * Returns a map with the primitive field names as the key and the primitive values as the map value.
857         * 
858         * @return Map
859         */
860        public Map getValuesMap() {
861            Map simpleValues = new HashMap();
862    
863            simpleValues.put("sequenceNumber", getSequenceNumber());
864            simpleValues.put(KFSPropertyConstants.DOCUMENT_NUMBER, getDocumentNumber());
865            simpleValues.put("postingYear", getPostingYear());
866            simpleValues.put("amount", getAmount());
867            simpleValues.put("referenceOriginCode", getReferenceOriginCode());
868            simpleValues.put("referenceNumber", getReferenceNumber());
869            simpleValues.put("referenceTypeCode", getReferenceTypeCode());
870            simpleValues.put("overrideCode", getOverrideCode());
871            // The override booleans are not in the map because they should not cause isLike() to fail and generate update events.
872            simpleValues.put("organizationReferenceId", getOrganizationReferenceId());
873            simpleValues.put("debitCreditCode", getDebitCreditCode());
874            simpleValues.put("encumbranceUpdateCode", getEncumbranceUpdateCode());
875            simpleValues.put("financialDocumentLineTypeCode", getFinancialDocumentLineTypeCode());
876            simpleValues.put("financialDocumentLineDescription", getFinancialDocumentLineDescription());
877    
878            simpleValues.put("chartOfAccountsCode", getChartOfAccountsCode());
879            simpleValues.put("accountNumber", getAccountNumber());
880            simpleValues.put("financialObjectCode", getFinancialObjectCode());
881            simpleValues.put("subAccountNumber", getSubAccountNumber());
882            simpleValues.put("financialSubObjectCode", getFinancialSubObjectCode());
883            simpleValues.put("projectCode", getProjectCode());
884            simpleValues.put("balanceTypeCode", getBalanceTypeCode());
885            simpleValues.put("objectTypeCode", getObjectTypeCode());
886    
887            return simpleValues;
888        }
889    
890        /**
891         * Override needed for PURAP GL entry creation (hjs) - please do not add "amount" to this method
892         * 
893         * @see java.lang.Object#equals(java.lang.Object)
894         */
895        public boolean equals(Object obj) {
896            if (!(obj instanceof AccountingLine)) {
897                return false;
898            }
899            AccountingLine accountingLine = (AccountingLine) obj;
900            return new EqualsBuilder().append(this.chartOfAccountsCode, accountingLine.getChartOfAccountsCode()).append(this.accountNumber, accountingLine.getAccountNumber()).append(this.subAccountNumber, accountingLine.getSubAccountNumber()).append(this.financialObjectCode, accountingLine.getFinancialObjectCode()).append(this.financialSubObjectCode, accountingLine.getFinancialSubObjectCode()).append(this.projectCode, accountingLine.getProjectCode()).append(this.organizationReferenceId, accountingLine.getOrganizationReferenceId()).isEquals();
901        }
902    
903        /**
904         * Override needed for PURAP GL entry creation (hjs) - please do not add "amount" to this method
905         * 
906         * @see java.lang.Object#hashCode()
907         */
908        public int hashCode() {
909            return new HashCodeBuilder(37, 41).append(this.chartOfAccountsCode).append(this.accountNumber).append(this.subAccountNumber).append(this.financialObjectCode).append(this.financialSubObjectCode).append(this.projectCode).append(this.organizationReferenceId).toHashCode();
910        }
911    
912    }