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.gl.batch;
017    
018    import java.util.Date;
019    
020    import org.kuali.kfs.gl.batch.service.SufficientFundsFullRebuildService;
021    import org.kuali.kfs.sys.batch.AbstractStep;
022    import org.kuali.kfs.sys.batch.TestingStep;
023    
024    /**
025     * A step to run the sufficient funds sync process. One typically doesn't need to do this - which is why it's marked as TestingStep -
026     * as Account, Chart, and Object Code records, when saved, will populate the sufficient funds tables, making this task redundant.
027     * However, if that information has not been built, this job will generate that information.
028     */
029    public class SufficientFundsFullRebuildStep extends AbstractStep implements TestingStep {
030        private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(SufficientFundsFullRebuildStep.class);
031        private SufficientFundsFullRebuildService sufficientFundsFullRebuildService;
032    
033        /**
034         * Runs the sufficient funds sync service.
035         * 
036         * @param jobName the name of the job this step is being run as part of
037         * @param jobRunDate the time/date the job was started
038         * @return true if the job completed successfully, false if otherwise
039         * @see org.kuali.kfs.sys.batch.Step#execute(String, Date)
040         */
041        public boolean execute(String jobName, Date jobRunDate) {
042            sufficientFundsFullRebuildService.syncSufficientFunds();
043            return true;
044        }
045    
046        /**
047         * Sets the sufficientFundsFullRebuildService, allowing the injection of an implementation of that service
048         * 
049         * @param sufficientFundsFullRebuildService an implementation sufficientFundsFullRebuildService to set
050         * @see org.kuali.kfs.gl.batch.service.SufficientFundsFullRebuildService
051         */
052        public void setSufficientFundsFullRebuildService(SufficientFundsFullRebuildService sfss) {
053            sufficientFundsFullRebuildService = sfss;
054        }
055    }