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.module.ec.util;
017    
018    import org.kuali.kfs.integration.ld.LaborLedgerBalance;
019    import org.kuali.kfs.sys.KFSConstants;
020    import org.kuali.rice.kim.bo.Person;
021    
022    /**
023     * To hold the neccessary information of ledger balance for the report generation
024     */
025    public class LedgerBalanceWithMessage {
026    
027        private String chartOfAccountsCode;
028        private String accountNumber;
029        private String subAccountNumber;
030        private String financialObjectCode;
031        private String positionNumber;
032        private String employeeName;
033        private String emplid;
034        private String message;
035    
036        /**
037         * Constructs a LedgerBalanceWithMessage.java.
038         */
039        public LedgerBalanceWithMessage() {
040            this(KFSConstants.EMPTY_STRING, KFSConstants.EMPTY_STRING, KFSConstants.EMPTY_STRING);
041        }
042    
043        /**
044         * Constructs a LedgerBalanceWithMessage.java.
045         * 
046         * @param emplid the given employee id
047         * @param employeeName the given employee name
048         * @param message the message associated with the given ledger balance
049         */
050        public LedgerBalanceWithMessage(String emplid, String employeeName, String message) {
051            super();
052            this.chartOfAccountsCode = KFSConstants.EMPTY_STRING;
053            this.accountNumber = KFSConstants.EMPTY_STRING;
054            this.subAccountNumber = KFSConstants.EMPTY_STRING;
055            this.financialObjectCode = KFSConstants.EMPTY_STRING;
056            this.positionNumber = KFSConstants.EMPTY_STRING;
057            this.emplid = emplid;
058            this.employeeName = employeeName;
059            this.message = message;
060        }
061    
062        /**
063         * Constructs a LedgerBalanceWithMessage.java.
064         * 
065         * @param ledgerBalance the given ledger balance
066         * @param message the message associated with the given ledger balance
067         */
068        public LedgerBalanceWithMessage(LaborLedgerBalance ledgerBalance, String message) {
069            super();
070            this.chartOfAccountsCode = ledgerBalance.getChartOfAccountsCode();
071            this.accountNumber = ledgerBalance.getAccountNumber();
072            this.subAccountNumber = ledgerBalance.getSubAccountNumber();
073            this.financialObjectCode = ledgerBalance.getFinancialObjectCode();
074            this.positionNumber = ledgerBalance.getPositionNumber();
075            this.emplid = ledgerBalance.getEmplid();
076            this.message = message;
077            
078            Person employee = ledgerBalance.getLedgerPerson();
079            this.employeeName = employee != null ? employee.getName() : KFSConstants.EMPTY_STRING;
080        }
081    
082        /**
083         * Gets the chartOfAccountsCode attribute.
084         * 
085         * @return Returns the chartOfAccountsCode.
086         */
087        public String getChartOfAccountsCode() {
088            return chartOfAccountsCode;
089        }
090    
091        /**
092         * Sets the chartOfAccountsCode attribute value.
093         * 
094         * @param chartOfAccountsCode The chartOfAccountsCode to set.
095         */
096        public void setChartOfAccountsCode(String chartOfAccountsCode) {
097            this.chartOfAccountsCode = chartOfAccountsCode;
098        }
099    
100        /**
101         * Gets the accountNumber attribute.
102         * 
103         * @return Returns the accountNumber.
104         */
105        public String getAccountNumber() {
106            return accountNumber;
107        }
108    
109        /**
110         * Sets the accountNumber attribute value.
111         * 
112         * @param accountNumber The accountNumber to set.
113         */
114        public void setAccountNumber(String accountNumber) {
115            this.accountNumber = accountNumber;
116        }
117    
118        /**
119         * Gets the subAccountNumber attribute.
120         * 
121         * @return Returns the subAccountNumber.
122         */
123        public String getSubAccountNumber() {
124            return subAccountNumber;
125        }
126    
127        /**
128         * Sets the subAccountNumber attribute value.
129         * 
130         * @param subAccountNumber The subAccountNumber to set.
131         */
132        public void setSubAccountNumber(String subAccountNumber) {
133            this.subAccountNumber = subAccountNumber;
134        }
135    
136        /**
137         * Gets the financialObjectCode attribute.
138         * 
139         * @return Returns the financialObjectCode.
140         */
141        public String getFinancialObjectCode() {
142            return financialObjectCode;
143        }
144    
145        /**
146         * Sets the financialObjectCode attribute value.
147         * 
148         * @param financialObjectCode The financialObjectCode to set.
149         */
150        public void setFinancialObjectCode(String financialObjectCode) {
151            this.financialObjectCode = financialObjectCode;
152        }
153    
154        /**
155         * Gets the positionNumber attribute.
156         * 
157         * @return Returns the positionNumber.
158         */
159        public String getPositionNumber() {
160            return positionNumber;
161        }
162    
163        /**
164         * Sets the positionNumber attribute value.
165         * 
166         * @param positionNumber The positionNumber to set.
167         */
168        public void setPositionNumber(String positionNumber) {
169            this.positionNumber = positionNumber;
170        }
171    
172        /**
173         * Gets the emplid attribute.
174         * 
175         * @return Returns the emplid.
176         */
177        public String getEmplid() {
178            return emplid;
179        }
180    
181        /**
182         * Sets the emplid attribute value.
183         * 
184         * @param emplid The emplid to set.
185         */
186        public void setEmplid(String emplid) {
187            this.emplid = emplid;
188        }
189        
190        /**
191         * Gets the employeeName attribute. 
192         * @return Returns the employeeName.
193         */
194        public String getEmployeeName() {
195            return employeeName;
196        }
197    
198        /**
199         * Sets the employeeName attribute value.
200         * @param employeeName The employeeName to set.
201         */
202        public void setEmployeeName(String employeeName) {
203            this.employeeName = employeeName;
204        }
205    
206        /**
207         * Gets the message attribute.
208         * 
209         * @return Returns the message.
210         */
211        public String getMessage() {
212            return message;
213        }
214    
215        /**
216         * Sets the message attribute value.
217         * 
218         * @param message The message to set.
219         */
220        public void setMessage(String message) {
221            this.message = message;
222        }
223    
224        /**
225         * @see java.lang.Object#toString()
226         */
227        @Override
228        public String toString() {
229            StringBuilder ledgerBalanceWithMessage = new StringBuilder();
230            ledgerBalanceWithMessage.append("[chartOfAccountsCode=").append(this.getChartOfAccountsCode()).append(", ");
231            ledgerBalanceWithMessage.append("accountNumber=").append(this.getAccountNumber()).append(", ");
232            ledgerBalanceWithMessage.append("subAccountNumber=").append(this.getSubAccountNumber()).append(", ");
233            ledgerBalanceWithMessage.append("financialObjectCode=").append(this.getFinancialObjectCode()).append(", ");
234            ledgerBalanceWithMessage.append("positionNumber=").append(this.getPositionNumber()).append(", ");
235            ledgerBalanceWithMessage.append("emplid=").append(this.getEmplid()).append(", ");
236            ledgerBalanceWithMessage.append("employeeName=").append(this.getEmployeeName()).append(", ");
237            ledgerBalanceWithMessage.append("message=").append(this.getMessage()).append("]");
238    
239            return ledgerBalanceWithMessage.toString();
240        }
241    }
242