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.endow.batch.service.impl;
017
018 import java.util.Collection;
019
020 import org.kuali.kfs.module.endow.batch.service.KEMIDCurrentAvailableBalanceService;
021 import org.kuali.kfs.module.endow.businessobject.KEMIDCurrentAvailableBalance;
022 import org.kuali.rice.kns.service.BusinessObjectService;
023
024 /**
025 * This class implements the AvailableCashService.
026 */
027 public class KEMIDCurrentAvailableBalanceServiceImpl implements KEMIDCurrentAvailableBalanceService {
028 protected static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(KEMIDCurrentAvailableBalanceServiceImpl.class);
029
030 protected BusinessObjectService businessObjectService;
031
032 /**
033 * @see org.kuali.kfs.module.endow.batch.service.AvailableCashUpdateService#clearAvailableCash()
034 * Method to clear all the records in the kEMIDCurrentAvailableBalance table
035 */
036 public void clearAllAvailableCash() {
037 LOG.info("Step1: Clearing all available cash records");
038
039 Collection<KEMIDCurrentAvailableBalance> KEMIDCurrentAvailableBalances = businessObjectService.findAll(KEMIDCurrentAvailableBalance.class);
040
041 for (KEMIDCurrentAvailableBalance kEMIDCurrentAvailableBalance : KEMIDCurrentAvailableBalances) {
042 businessObjectService.delete(kEMIDCurrentAvailableBalance);
043 }
044 }
045
046 /**
047 * @see org.kuali.kfs.module.endow.batch.service.AvailableCashUpdateService#InsertAvailableCash(KemidCurrentCash)
048 * Method to clear all the records in the kEMIDCurrentAvailableBalance table
049 */
050 public void InsertAvailableCash(KEMIDCurrentAvailableBalance kEMIDCurrentAvailableBalance) {
051 if (kEMIDCurrentAvailableBalance == null) {
052 throw new IllegalArgumentException("invalid (null) kEMIDCurrentAvailableBalance");
053 }
054
055 businessObjectService.save(kEMIDCurrentAvailableBalance);
056 }
057
058 /**
059 * Sets the BusinessObjectService
060 *
061 * @param businessObjectService The BusinessObjectService to set.
062 */
063 public void setBusinessObjectService(BusinessObjectService businessObjectService) {
064 this.businessObjectService = businessObjectService;
065 }
066 }