View Javadoc
1   /*
2    * Copyright 2007 The Kuali Foundation
3    * 
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    * http://www.opensource.org/licenses/ecl2.php
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.ole.pdp.batch;
17  
18  import java.util.ArrayList;
19  import java.util.Date;
20  import java.util.List;
21  
22  import org.kuali.ole.pdp.PdpParameterConstants;
23  import org.kuali.ole.pdp.service.AchBankService;
24  import org.kuali.ole.sys.batch.AbstractStep;
25  import org.kuali.ole.sys.service.impl.OleParameterConstants;
26  
27  public class LoadFederalReserveBankDataStep extends AbstractStep {
28      private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(LoadFederalReserveBankDataStep.class);
29  
30      private AchBankService achBankService;
31      private String directoryName;
32  
33      /**
34       * @see org.kuali.ole.sys.batch.AbstractStep#getRequiredDirectoryNames()
35       */
36      @Override
37      public List<String> getRequiredDirectoryNames() {
38          return new ArrayList<String>() {{add(directoryName); }};
39      }
40      
41      /**
42       * @see org.kuali.ole.sys.batch.Step#execute(java.lang.String, java.util.Date)
43       */
44      public boolean execute(String jobName, Date jobRunDate) throws InterruptedException {
45          LOG.debug("execute() started");
46  
47          String filename = getParameterService().getParameterValueAsString(OleParameterConstants.PRE_DISBURSEMENT_BATCH.class, PdpParameterConstants.ACH_BANK_INPUT_FILE);
48  
49          return achBankService.reloadTable(directoryName + filename);
50      }
51  
52      public void setAchBankService(AchBankService achBankService) {
53          this.achBankService = achBankService;
54      }
55  
56      public void setDirectoryName(String dn) {
57          directoryName = dn;
58      }
59  }