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.service.PaymentFileService;
23 import org.kuali.ole.sys.batch.AbstractStep;
24 import org.kuali.ole.sys.batch.BatchInputFileType;
25
26 /**
27 * This step will call the <code>PaymentService</code> to pick up incoming PDP payment files and process.
28 */
29 public class LoadPaymentsStep extends AbstractStep {
30 private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(LoadPaymentsStep.class);
31
32 private PaymentFileService paymentFileService;
33 private BatchInputFileType paymentInputFileType;
34
35 /**
36 * Picks up the required path from the batchInputFIleType as well as from the payment
37 * file service
38 *
39 * @see org.kuali.ole.sys.batch.AbstractStep#getRequiredDirectoryNames()
40 */
41 @Override
42 public List<String> getRequiredDirectoryNames() {
43 List<String> requiredDirectoryList = new ArrayList<String>();
44 requiredDirectoryList.add(paymentInputFileType.getDirectoryPath());
45 requiredDirectoryList.addAll(paymentFileService.getRequiredDirectoryNames());
46
47 return requiredDirectoryList;
48 }
49
50 /**
51 * @see org.kuali.ole.sys.batch.Step#execute(java.lang.String, java.util.Date)
52 */
53 public boolean execute(String jobName, Date jobRunDate) throws InterruptedException {
54 LOG.debug("execute() started");
55 paymentFileService.processPaymentFiles(paymentInputFileType);
56
57 return true;
58 }
59
60 /**
61 * Sets the paymentFileService attribute value.
62 *
63 * @param paymentFileService The paymentFileService to set.
64 */
65 public void setPaymentFileService(PaymentFileService paymentFileService) {
66 this.paymentFileService = paymentFileService;
67 }
68
69 /**
70 * Sets the paymentInputFileType attribute value.
71 *
72 * @param paymentInputFileType The paymentInputFileType to set.
73 */
74 public void setPaymentInputFileType(BatchInputFileType paymentInputFileType) {
75 this.paymentInputFileType = paymentInputFileType;
76 }
77
78 }