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.ld.service.impl;
017
018 import java.util.List;
019 import java.util.Map;
020
021 import org.kuali.kfs.module.ld.businessobject.AccountStatusBaseFunds;
022 import org.kuali.kfs.module.ld.dataaccess.LaborBaseFundsDao;
023 import org.kuali.kfs.module.ld.service.LaborBaseFundsService;
024 import org.kuali.kfs.module.ld.service.LaborCalculatedSalaryFoundationTrackerService;
025 import org.kuali.kfs.sys.service.NonTransactional;
026
027 /**
028 * This class provides its clients with access to labor base fund entries in the backend data store.
029 *
030 * @see org.kuali.kfs.module.ld.businessobject.AccountStatusBaseFunds
031 */
032
033 @NonTransactional
034 public class LaborBaseFundsServiceImpl implements LaborBaseFundsService {
035 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(LaborBaseFundsServiceImpl.class);
036
037 private LaborBaseFundsDao laborBaseFundsDao;
038 private LaborCalculatedSalaryFoundationTrackerService laborCalculatedSalaryFoundationTrackerService;
039
040 /**
041 * @see org.kuali.kfs.module.ld.service.LaborBaseFundsService#findLaborBaseFunds(java.util.Map, boolean)
042 */
043 public List<AccountStatusBaseFunds> findLaborBaseFunds(Map fieldValues, boolean isConsolidated) {
044 return laborBaseFundsDao.findLaborBaseFunds(fieldValues, isConsolidated);
045 }
046
047 /**
048 * @see org.kuali.kfs.module.ld.service.LaborBaseFundsService#findAccountStatusBaseFundsAndCSFTracker(java.util.Map, boolean)
049 */
050 public List<AccountStatusBaseFunds> findAccountStatusBaseFundsWithCSFTracker(Map fieldValues, boolean isConsolidated) {
051 List<AccountStatusBaseFunds> baseFundsCollection = this.findLaborBaseFunds(fieldValues, isConsolidated);
052 List<AccountStatusBaseFunds> CSFTrackersCollection = laborCalculatedSalaryFoundationTrackerService.findCSFTrackersAsAccountStatusBaseFunds(fieldValues, isConsolidated);
053
054 for (AccountStatusBaseFunds CSFTracker : CSFTrackersCollection) {
055 if (baseFundsCollection.contains(CSFTracker)) {
056 int index = baseFundsCollection.indexOf(CSFTracker);
057 baseFundsCollection.get(index).setCsfAmount(CSFTracker.getCsfAmount());
058 }
059 else {
060 baseFundsCollection.add(CSFTracker);
061 }
062 }
063 return baseFundsCollection;
064 }
065
066 /**
067 * Sets the laborBaseFundsDao attribute value.
068 *
069 * @param laborBaseFundsDao The laborBaseFundsDao to set.
070 */
071 public void setLaborBaseFundsDao(LaborBaseFundsDao laborBaseFundsDao) {
072 this.laborBaseFundsDao = laborBaseFundsDao;
073 }
074
075 /**
076 * Sets the laborCalculatedSalaryFoundationTrackerService attribute value.
077 *
078 * @param laborCalculatedSalaryFoundationTrackerService The laborCalculatedSalaryFoundationTrackerService to set.
079 */
080 public void setLaborCalculatedSalaryFoundationTrackerService(LaborCalculatedSalaryFoundationTrackerService laborCalculatedSalaryFoundationTrackerService) {
081 this.laborCalculatedSalaryFoundationTrackerService = laborCalculatedSalaryFoundationTrackerService;
082 }
083 }