Source Code Cross Referenced for LaborLedgerBalanceServiceImpl.java in  » ERP-CRM-Financial » Kuali-Financial-System » org » kuali » module » labor » service » impl » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » ERP CRM Financial » Kuali Financial System » org.kuali.module.labor.service.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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:        package org.kuali.module.labor.service.impl;
017:
018:        import java.util.Collection;
019:        import java.util.Iterator;
020:        import java.util.List;
021:        import java.util.Map;
022:
023:        import org.apache.commons.collections.IteratorUtils;
024:        import org.kuali.core.util.KualiDecimal;
025:        import org.kuali.module.gl.util.OJBUtility;
026:        import org.kuali.module.labor.bo.EmployeeFunding;
027:        import org.kuali.module.labor.bo.LaborBalanceSummary;
028:        import org.kuali.module.labor.bo.LaborTransaction;
029:        import org.kuali.module.labor.bo.LedgerBalance;
030:        import org.kuali.module.labor.bo.LedgerBalanceForYearEndBalanceForward;
031:        import org.kuali.module.labor.dao.LaborLedgerBalanceDao;
032:        import org.kuali.module.labor.service.LaborCalculatedSalaryFoundationTrackerService;
033:        import org.kuali.module.labor.service.LaborLedgerBalanceService;
034:        import org.kuali.module.labor.util.DebitCreditUtil;
035:        import org.kuali.module.labor.util.ObjectUtil;
036:        import org.springframework.transaction.annotation.Transactional;
037:
038:        @Transactional
039:        public class LaborLedgerBalanceServiceImpl implements 
040:                LaborLedgerBalanceService {
041:            private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger
042:                    .getLogger(LaborLedgerBalanceServiceImpl.class);
043:
044:            private LaborLedgerBalanceDao laborLedgerBalanceDao;
045:            private LaborCalculatedSalaryFoundationTrackerService laborCalculatedSalaryFoundationTrackerService;
046:
047:            /**
048:             * @see org.kuali.module.labor.service.LaborLedgerBalanceService#findBalancesForFiscalYear(java.lang.Integer)
049:             */
050:            public Iterator<LedgerBalance> findBalancesForFiscalYear(
051:                    Integer fiscalYear) {
052:                return laborLedgerBalanceDao
053:                        .findBalancesForFiscalYear(fiscalYear);
054:            }
055:
056:            /**
057:             * @see org.kuali.module.labor.service.LaborLedgerBalanceService#findBalancesForFiscalYear(java.lang.Integer, java.util.Map)
058:             */
059:            public Iterator<LedgerBalance> findBalancesForFiscalYear(
060:                    Integer fiscalYear, Map<String, String> fieldValues) {
061:                return laborLedgerBalanceDao.findBalancesForFiscalYear(
062:                        fiscalYear, fieldValues);
063:            }
064:
065:            /**
066:             * @see org.kuali.module.labor.service.LaborLedgerBalanceService#findBalance(java.util.Map, boolean)
067:             */
068:            public Iterator findBalance(Map fieldValues, boolean isConsolidated) {
069:                LOG.debug("findBalance() started");
070:                return laborLedgerBalanceDao.findBalance(fieldValues,
071:                        isConsolidated);
072:            }
073:
074:            /**
075:             * @see org.kuali.module.labor.service.LaborLedgerBalanceService#getBalanceRecordCount(java.util.Map, boolean)
076:             */
077:            public Integer getBalanceRecordCount(Map fieldValues,
078:                    boolean isConsolidated) {
079:                LOG.debug("getBalanceRecordCount() started");
080:
081:                Integer recordCount = null;
082:                if (!isConsolidated) {
083:                    recordCount = OJBUtility.getResultSizeFromMap(fieldValues,
084:                            new LedgerBalance()).intValue();
085:                } else {
086:                    Iterator recordCountIterator = laborLedgerBalanceDao
087:                            .getConsolidatedBalanceRecordCount(fieldValues);
088:                    List recordCountList = IteratorUtils
089:                            .toList(recordCountIterator);
090:                    recordCount = recordCountList.size();
091:                }
092:                return recordCount;
093:            }
094:
095:            /**
096:             * @see org.kuali.module.labor.service.LaborLedgerBalanceService#findLedgerBalance(java.util.Collection,
097:             *      org.kuali.module.labor.bo.LaborTransaction)
098:             */
099:            public <T extends LedgerBalance> T findLedgerBalance(
100:                    Collection<T> ledgerBalanceCollection,
101:                    LaborTransaction transaction, List<String> keyList) {
102:                for (T ledgerBalance : ledgerBalanceCollection) {
103:                    boolean found = ObjectUtil.compareObject(ledgerBalance,
104:                            transaction, keyList);
105:                    if (found) {
106:                        return ledgerBalance;
107:                    }
108:                }
109:                return null;
110:            }
111:
112:            /**
113:             * @see org.kuali.module.labor.service.LaborLedgerBalanceService#findLedgerBalance(java.util.Collection,
114:             *      org.kuali.module.labor.bo.LaborTransaction)
115:             */
116:            public <T extends LedgerBalance> T findLedgerBalance(
117:                    Collection<T> ledgerBalanceCollection,
118:                    LaborTransaction transaction) {
119:                for (T ledgerBalance : ledgerBalanceCollection) {
120:                    boolean found = ObjectUtil.compareObject(ledgerBalance,
121:                            transaction, ledgerBalance.getPrimaryKeyList());
122:                    if (found) {
123:                        return ledgerBalance;
124:                    }
125:                }
126:                return null;
127:            }
128:
129:            /**
130:             * @see org.kuali.module.labor.service.LaborLedgerBalanceService#updateLedgerBalance(org.kuali.module.labor.bo.LedgerBalance,
131:             *      org.kuali.module.labor.bo.LaborTransaction)
132:             */
133:            public <T extends LedgerBalance> void updateLedgerBalance(
134:                    T ledgerBalance, LaborTransaction transaction) {
135:                String debitCreditCode = transaction
136:                        .getTransactionDebitCreditCode();
137:                KualiDecimal amount = transaction
138:                        .getTransactionLedgerEntryAmount();
139:                amount = DebitCreditUtil.getNumericAmount(amount,
140:                        debitCreditCode);
141:                ledgerBalance.addAmount(transaction
142:                        .getUniversityFiscalPeriodCode(), amount);
143:            }
144:
145:            /**
146:             * @see org.kuali.module.labor.service.LaborLedgerBalanceService#addLedgerBalance(java.util.Collection,
147:             *      org.kuali.module.labor.bo.LaborTransaction)
148:             */
149:            public LedgerBalance addLedgerBalance(
150:                    Collection<LedgerBalance> ledgerBalanceCollection,
151:                    LaborTransaction transaction) {
152:                LedgerBalance ledgerBalance = this .findLedgerBalance(
153:                        ledgerBalanceCollection, transaction);
154:
155:                if (ledgerBalance == null) {
156:                    LedgerBalance newLedgerBalance = new LedgerBalance();
157:                    ObjectUtil.buildObject(newLedgerBalance, transaction);
158:                    updateLedgerBalance(newLedgerBalance, transaction);
159:
160:                    ledgerBalanceCollection.add(newLedgerBalance);
161:                    return newLedgerBalance;
162:                }
163:                return null;
164:            }
165:
166:            /**
167:             * @see org.kuali.module.labor.service.LaborLedgerBalanceService#findEmployeeFunding(java.util.Map)
168:             */
169:            public List<EmployeeFunding> findEmployeeFunding(Map fieldValues,
170:                    boolean isConsolidated) {
171:                List<EmployeeFunding> currentFundsCollection = laborLedgerBalanceDao
172:                        .findCurrentEmployeeFunds(fieldValues);
173:                List<EmployeeFunding> encumbranceFundsCollection = laborLedgerBalanceDao
174:                        .findEncumbranceEmployeeFunds(fieldValues);
175:
176:                // merge encumberance with the current funds
177:                for (EmployeeFunding encumbranceFunding : encumbranceFundsCollection) {
178:                    KualiDecimal encumbrance = encumbranceFunding
179:                            .getAccountLineAnnualBalanceAmount()
180:                            .add(
181:                                    encumbranceFunding
182:                                            .getContractsGrantsBeginningBalanceAmount());
183:                    encumbranceFunding.setOutstandingEncumbrance(encumbrance);
184:
185:                    if (currentFundsCollection.contains(encumbranceFunding)) {
186:                        int index = currentFundsCollection
187:                                .indexOf(encumbranceFunding);
188:                        currentFundsCollection.get(index)
189:                                .setOutstandingEncumbrance(
190:                                        encumbranceFunding
191:                                                .getOutstandingEncumbrance());
192:                    } else {
193:                        currentFundsCollection.add(encumbranceFunding);
194:                    }
195:                }
196:
197:                // update the employee fundings
198:                for (EmployeeFunding employeeFunding : currentFundsCollection) {
199:                    employeeFunding.setPersonName(employeeFunding.getEmplid());
200:                    employeeFunding.setCurrentAmount(employeeFunding
201:                            .getAccountLineAnnualBalanceAmount());
202:                }
203:                return currentFundsCollection;
204:            }
205:
206:            /**
207:             * @see org.kuali.module.labor.service.LaborLedgerBalanceService#findEmployeeFundingWithCSFTracker(java.util.Map)
208:             */
209:            public List<EmployeeFunding> findEmployeeFundingWithCSFTracker(
210:                    Map fieldValues, boolean isConsolidated) {
211:                List<EmployeeFunding> currentFundsCollection = this 
212:                        .findEmployeeFunding(fieldValues, isConsolidated);
213:                List<EmployeeFunding> CSFTrackersCollection = laborCalculatedSalaryFoundationTrackerService
214:                        .findCSFTrackersAsEmployeeFunding(fieldValues,
215:                                isConsolidated);
216:
217:                for (EmployeeFunding CSFTrackerAsEmployeeFunding : CSFTrackersCollection) {
218:                    if (currentFundsCollection
219:                            .contains(CSFTrackerAsEmployeeFunding)) {
220:                        int index = currentFundsCollection
221:                                .indexOf(CSFTrackerAsEmployeeFunding);
222:                        EmployeeFunding currentFunds = currentFundsCollection
223:                                .get(index);
224:
225:                        currentFunds
226:                                .setCsfDeleteCode(CSFTrackerAsEmployeeFunding
227:                                        .getCsfDeleteCode());
228:                        currentFunds
229:                                .setCsfTimePercent(CSFTrackerAsEmployeeFunding
230:                                        .getCsfTimePercent());
231:                        currentFunds
232:                                .setCsfFundingStatusCode(CSFTrackerAsEmployeeFunding
233:                                        .getCsfFundingStatusCode());
234:                        currentFunds.setCsfAmount(CSFTrackerAsEmployeeFunding
235:                                .getCsfAmount());
236:                        currentFunds
237:                                .setCsfFullTimeEmploymentQuantity(CSFTrackerAsEmployeeFunding
238:                                        .getCsfFullTimeEmploymentQuantity());
239:                    } else {
240:                        currentFundsCollection.add(CSFTrackerAsEmployeeFunding);
241:                    }
242:                }
243:                return currentFundsCollection;
244:            }
245:
246:            /**
247:             * @see org.kuali.module.labor.service.LaborLedgerBalanceService#findBalanceSummary(java.lang.Integer, java.util.Collection)
248:             */
249:            public List<LaborBalanceSummary> findBalanceSummary(
250:                    Integer fiscalYear, Collection<String> balanceTypes) {
251:                return laborLedgerBalanceDao.findBalanceSummary(fiscalYear,
252:                        balanceTypes);
253:            }
254:
255:            /**
256:             * @see org.kuali.module.labor.service.LaborLedgerBalanceService#save(org.kuali.module.labor.bo.LedgerBalance)
257:             */
258:            public void save(LedgerBalance ledgerBalance) {
259:                laborLedgerBalanceDao.save(ledgerBalance);
260:            }
261:
262:            /**
263:             * @see org.kuali.module.labor.service.LaborLedgerBalanceService#findBalancesForFiscalYear(java.lang.Integer, java.util.Map,
264:             *      java.util.List, java.util.List)
265:             */
266:            public Iterator<LedgerBalanceForYearEndBalanceForward> findBalancesForFiscalYear(
267:                    Integer fiscalYear, Map<String, String> fieldValues,
268:                    List<String> subFundGroupCodes, List<String> fundGroupCodes) {
269:                return laborLedgerBalanceDao.findBalancesForFiscalYear(
270:                        fiscalYear, fieldValues, subFundGroupCodes,
271:                        fundGroupCodes);
272:            }
273:
274:            /**
275:             * @see org.kuali.module.labor.service.LaborLedgerBalanceService#findAccountsInFundGroups(java.lang.Integer, java.util.Map,
276:             *      java.util.List, java.util.List)
277:             */
278:            public List<List<String>> findAccountsInFundGroups(
279:                    Integer fiscalYear, Map<String, String> fieldValues,
280:                    List<String> subFundGroupCodes, List<String> fundGroupCodes) {
281:                return laborLedgerBalanceDao.findAccountsInFundGroups(
282:                        fiscalYear, fieldValues, subFundGroupCodes,
283:                        fundGroupCodes);
284:            }
285:
286:            /**
287:             * Sets the laborLedgerBalanceDao attribute value.
288:             * 
289:             * @param laborLedgerBalanceDao The laborLedgerBalanceDao to set.
290:             */
291:            public void setLaborLedgerBalanceDao(
292:                    LaborLedgerBalanceDao laborLedgerBalanceDao) {
293:                this .laborLedgerBalanceDao = laborLedgerBalanceDao;
294:            }
295:
296:            /**
297:             * Sets the laborCalculatedSalaryFoundationTrackerService attribute value.
298:             * 
299:             * @param laborCalculatedSalaryFoundationTrackerService The laborCalculatedSalaryFoundationTrackerService to set.
300:             */
301:            public void setLaborCalculatedSalaryFoundationTrackerService(
302:                    LaborCalculatedSalaryFoundationTrackerService laborCalculatedSalaryFoundationTrackerService) {
303:                this.laborCalculatedSalaryFoundationTrackerService = laborCalculatedSalaryFoundationTrackerService;
304:            }
305:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.