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    package org.kuali.kfs.module.ld.businessobject;
018    
019    import org.kuali.rice.kns.util.KualiDecimal;
020    
021    /**
022     * Labor business object for Account Status (Base Funds).
023     */
024    public class AccountStatusBaseFunds extends LedgerBalance {
025        private KualiDecimal csfAmount;
026        private KualiDecimal baseBudgetAmount;
027        private KualiDecimal baseCSFVarianceAmount;
028    
029        /**
030         * Default constructor.
031         */
032        public AccountStatusBaseFunds() {
033            super();
034            this.setBaseCSFVarianceAmount(KualiDecimal.ZERO);
035            this.setCsfAmount(KualiDecimal.ZERO);
036            this.setBaseBudgetAmount(KualiDecimal.ZERO);
037        }
038    
039        /**
040         * Gets the baseBudgetAmount attribute.
041         * 
042         * @return Returns the baseBudgetAmount.
043         */
044        public KualiDecimal getBaseBudgetAmount() {
045            return this.getAccountLineAnnualBalanceAmount().add(this.getFinancialBeginningBalanceLineAmount()).add(this.getContractsGrantsBeginningBalanceAmount());
046        }
047    
048        /**
049         * Sets the baseBudgetAmount attribute value.
050         * 
051         * @param baseBudgetAmount The baseBudgetAmount to set.
052         */
053        public void setBaseBudgetAmount(KualiDecimal baseBudgetAmount) {
054            this.baseBudgetAmount = baseBudgetAmount;
055        }
056    
057        /**
058         * Gets the baseCSFVarianceAmount attribute.
059         * 
060         * @return Returns the baseCSFVarianceAmount.
061         */
062        public KualiDecimal getBaseCSFVarianceAmount() {
063            return this.getBaseBudgetAmount().subtract(this.getCsfAmount());
064        }
065    
066        /**
067         * Sets the baseCSFVarianceAmount attribute value.
068         * 
069         * @param baseCSFVarianceAmount The baseCSFVarianceAmount to set.
070         */
071        public void setBaseCSFVarianceAmount(KualiDecimal baseCSFVarianceAmount) {
072            this.baseCSFVarianceAmount = baseCSFVarianceAmount;
073        }
074    
075        /**
076         * Gets the csfAmount attribute.
077         * 
078         * @return Returns the csfAmount.
079         */
080        public KualiDecimal getCsfAmount() {
081            return csfAmount;
082        }
083    
084        /**
085         * Sets the csfAmount attribute value.
086         * 
087         * @param csfAmount The csfAmount to set.
088         */
089        public void setCsfAmount(KualiDecimal csfAmount) {
090            this.csfAmount = csfAmount;
091        }
092    
093        /**
094         * @see java.lang.Object#hashCode()
095         */
096        @Override
097        public int hashCode() {
098            final int PRIME = 31;
099            int result = 1;
100            result = PRIME * result + ((getAccountNumber() == null) ? 0 : getAccountNumber().hashCode());
101            result = PRIME * result + ((getChartOfAccountsCode() == null) ? 0 : getChartOfAccountsCode().hashCode());
102            result = PRIME * result + ((getFinancialObjectCode() == null) ? 0 : getFinancialObjectCode().hashCode());
103            result = PRIME * result + ((getFinancialSubObjectCode() == null) ? 0 : getFinancialSubObjectCode().hashCode());
104            result = PRIME * result + ((getSubAccountNumber() == null) ? 0 : getSubAccountNumber().hashCode());
105            result = PRIME * result + ((getUniversityFiscalYear() == null) ? 0 : getUniversityFiscalYear().hashCode());
106    
107            return result;
108        }
109    
110        /**
111         * @see java.lang.Object#equals(java.lang.Object)
112         */
113        @Override
114        public boolean equals(Object obj) {
115            if (this == obj)
116                return true;
117            if (obj == null)
118                return false;
119            if (getClass() != obj.getClass())
120                return false;
121    
122            final AccountStatusBaseFunds other = (AccountStatusBaseFunds) obj;
123            if (getAccountNumber() == null) {
124                if (other.getAccountNumber() != null)
125                    return false;
126            }
127            else if (!getAccountNumber().equals(other.getAccountNumber())) {
128                return false;
129            }
130    
131            if (getChartOfAccountsCode() == null) {
132                if (other.getChartOfAccountsCode() != null)
133                    return false;
134            }
135            else if (!getChartOfAccountsCode().equals(other.getChartOfAccountsCode())) {
136                return false;
137            }
138    
139            if (getFinancialObjectCode() == null) {
140                if (other.getFinancialObjectCode() != null)
141                    return false;
142            }
143            else if (!getFinancialObjectCode().equals(other.getFinancialObjectCode())) {
144                return false;
145            }
146    
147            if (getFinancialSubObjectCode() == null) {
148                if (other.getFinancialSubObjectCode() != null)
149                    return false;
150            }
151            else if (!getFinancialSubObjectCode().equals(other.getFinancialSubObjectCode())) {
152                return false;
153            }
154    
155            if (getSubAccountNumber() == null) {
156                if (other.getSubAccountNumber() != null)
157                    return false;
158            }
159            else if (!getSubAccountNumber().equals(other.getSubAccountNumber())) {
160                return false;
161            }
162    
163            if (getUniversityFiscalYear() == null) {
164                if (other.getUniversityFiscalYear() != null)
165                    return false;
166            }
167            else if (!getUniversityFiscalYear().equals(other.getUniversityFiscalYear())) {
168                return false;
169            }
170    
171            return true;
172        }
173    }