Skip to content

Commit

Permalink
line filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
cameroncaci committed Dec 11, 2023
1 parent c5cd407 commit a1be487
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</parent>
<groupId>com.milmove.trdmlambda</groupId>
<artifactId>trdm-lambda</artifactId>
<version>1.0.2.8</version>
<version>1.0.3.0</version>
<name>trdm java spring interface</name>
<description>Project for deploying a Java TRDM interfacer for TGET data.</description>
<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,14 @@ public List<LineOfAccounting> parse(byte[] fileContent, XMLGregorianCalendar trd

logger.info("headers received and mapped, beginning to process every other line");
// Loop until the last line in the file is found
int lineCount = 0;
while (scanner.hasNextLine()) {
String line = scanner.nextLine();
lineCount++;
// "Unclassified" will always be the last line in the file
if (line.equals("Unclassified")) {
logger.info("finished parsing TGET data file from TRDM");
break;
}
String[] values = line.split("\\|");
logger.info("Line {} | Values Length: {} | Values: {}", lineCount, values.length, Arrays.toString(values));
LineOfAccounting code = processLineIntoLOA(values, columnNamesAndLocations, trdmLastUpdate);

if (code != null) {
Expand All @@ -93,6 +90,10 @@ public List<LineOfAccounting> parse(byte[] fileContent, XMLGregorianCalendar trd
private LineOfAccounting processLineIntoLOA(String[] values, Map<String, Integer> columnHeaders,
XMLGregorianCalendar lastLoaUpdate)
throws RuntimeException {
// Check if value length does not align with columns
if (values.length != columnHeaders.size()) {
return null; // Skip this line
}
// Check if LOA is empty or if ROW_STS_CD is "DLT"
if (values[columnHeaders.get("LOA_SYS_ID")].isEmpty()
|| "DLT".equals(values[columnHeaders.get("ROW_STS_CD")])) {
Expand Down

0 comments on commit a1be487

Please sign in to comment.