use of org.kuali.kfs.sys.batch.PhysicalFlatFileInformation in project cu-kfs by CU-CommunityApps.
the class AdvanceDepositServiceImpl method loadFile.
/**
* @see AdvanceDepositService#loadFile()
*/
public void loadFile() {
List<PhysicalFlatFileInformation> flatFileInformationList = new ArrayList<>();
PhysicalFlatFileInformation physicalflatFileInformation;
List<String> fileNamesToLoad = getListOfFilesToProcess();
if (LOG.isInfoEnabled()) {
LOG.info("Found " + fileNamesToLoad.size() + " file(s) to process.");
}
for (String inputFileName : fileNamesToLoad) {
try {
if (LOG.isInfoEnabled()) {
LOG.info("Beginning processing of filename: " + inputFileName + ".");
}
physicalflatFileInformation = new PhysicalFlatFileInformation(inputFileName);
flatFileInformationList.add(physicalflatFileInformation);
if (loadFile(inputFileName, physicalflatFileInformation)) {
physicalflatFileInformation.addFileInfoMessage("File successfully completed processing.");
} else {
physicalflatFileInformation.addFileErrorMessage("Unable to process file.");
}
} catch (RuntimeException e) {
LOG.error("Caught exception trying to load: " + inputFileName, e);
throw new RuntimeException("Caught exception trying to load: " + inputFileName, e);
} finally {
removeDoneFile(inputFileName);
}
}
sendEmailSummary(flatFileInformationList);
}
use of org.kuali.kfs.sys.batch.PhysicalFlatFileInformation in project cu-kfs by CU-CommunityApps.
the class AdvanceDepositServiceImpl method copyAllMessage.
private void copyAllMessage(Object parsedObject, PhysicalFlatFileInformation physicalFlatFileInformation) {
List<AchIncomeFile> achIncomeFiles = (List<AchIncomeFile>) parsedObject;
for (AchIncomeFile achIncomeFile : achIncomeFiles) {
FlatFileInformation fileInformation = new FlatFileInformation();
FlatFileTransactionInformation information = achIncomeFile.getFlatFileTransactionInformation();
fileInformation.getOrAddFlatFileData(achIncomeFile.getInterchangeControlNumber(), information);
fileInformation.addFileInfoMessage(achIncomeFile.getEmailMessageText());
physicalFlatFileInformation.getFlatFileInfomationList().add(fileInformation);
}
}
use of org.kuali.kfs.sys.batch.PhysicalFlatFileInformation in project cu-kfs by CU-CommunityApps.
the class AdvanceDepositServiceImpl method loadFile.
public boolean loadFile(String fileName, PhysicalFlatFileInformation physicalFlatFileInformation) {
boolean valid = true;
byte[] fileByteContent = safelyLoadFileBytes(fileName);
if (LOG.isInfoEnabled()) {
LOG.info("Attempting to parse the file ");
}
Object parsedObject;
try {
parsedObject = batchInputFileService.parse(batchInputFileType, fileByteContent);
} catch (org.kuali.kfs.sys.exception.ParseException e) {
LOG.error("Error parsing batch file: " + e.getMessage());
FlatFileInformation fileInformation = new FlatFileInformation();
fileInformation.addFileInfoMessage("Unable to process file" + StringUtils.substringAfterLast(fileName, "\\") + "." + e.getMessage());
physicalFlatFileInformation.getFlatFileInfomationList().add(fileInformation);
return false;
}
if (parsedObject != null) {
valid = validate(parsedObject);
copyAllMessage(parsedObject, physicalFlatFileInformation);
if (valid) {
loadAchIncomeTransactions(parsedObject);
}
}
return valid;
}
Aggregations