Skip to content

Commit

Permalink
Add printing out trailer line to logs
Browse files Browse the repository at this point in the history
  • Loading branch information
smirnovaae committed Apr 24, 2024
1 parent 907d6ae commit a216c5c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ void copyDataToFile(Connection connection) {
writer.newLine();
records++;
}
writer.write(AB2D_TRAILER_REQ + date + String.format("%010d", records));

String lastLine = AB2D_TRAILER_REQ + date + String.format("%010d", records);
writer.write(lastLine);
logger.log("File trailer: " + lastLine);
} catch (SQLException | IOException ex) {
String errorMessage = "An error occurred while exporting data to a file. ";
logger.log(errorMessage + ex.getMessage());
Expand Down
15 changes: 10 additions & 5 deletions optout/src/main/java/gov/cms/ab2d/optout/OptOutProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,10 @@ public void updateOptOut() {
}
public String createResponseContent() {
var date = new SimpleDateFormat(EFFECTIVE_DATE_PATTERN).format(new Date());
var responseContent = new StringBuilder();
responseContent.append(AB2D_HEADER_CONF).append(date);
responseContent.append(LINE_SEPARATOR);
var responseContent = new StringBuilder()
.append(AB2D_HEADER_CONF)
.append(date)
.append(LINE_SEPARATOR);
var recordStatus = getRecordStatus();
var effectiveDate = getEffectiveDate(date);

Expand All @@ -121,8 +122,12 @@ public String createResponseContent() {
.append(recordStatus)
.append(LINE_SEPARATOR);
}
responseContent.append(AB2D_TRAILER_CONF).append(date).append(String.format("%010d", optOutInformationList.size()));

var lastLine = new StringBuilder()
.append(AB2D_TRAILER_CONF)
.append(date)
.append(String.format("%010d", optOutInformationList.size()));
responseContent.append(lastLine);
logger.log("File trailer: " + lastLine);
return responseContent.toString();
}

Expand Down

0 comments on commit a216c5c

Please sign in to comment.