From 2b839e9b34b4329ec82db95b09a385056046a69b Mon Sep 17 00:00:00 2001 From: Bethany Seeger Date: Fri, 17 May 2024 15:03:13 -0400 Subject: [PATCH] Fix error where applicant name was not correct in metatdata file for the SNAP_Application.pdf. --- .../app/cli/SubmissionTransfer.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/ladocuploader/app/cli/SubmissionTransfer.java b/src/main/java/org/ladocuploader/app/cli/SubmissionTransfer.java index 013b921e1..60cb31da7 100644 --- a/src/main/java/org/ladocuploader/app/cli/SubmissionTransfer.java +++ b/src/main/java/org/ladocuploader/app/cli/SubmissionTransfer.java @@ -222,6 +222,8 @@ private void packageUploadedDocuments(String batchIndex, ZipOutputStream zos, St for (UserFile userFile : userFiles) { fileCount += 1; String docUploadFilename = SubmissionUtilities.createFileNameForUploadedDocument(submission, userFile, fileCount, userFiles.size()); + String docOwnerName = submission.getInputData().get("documentOwner_wildcard_" + userFile.getFileId()) + .toString().replace(" ", "_"); ZipEntry docEntry = new ZipEntry(batchIndex + "/" + subfolder + "/" + docUploadFilename); docEntry.setSize(userFile.getFilesize().longValue()); zos.putNextEntry(docEntry); @@ -232,7 +234,8 @@ private void packageUploadedDocuments(String batchIndex, ZipOutputStream zos, St // write doc metadata String docType = getDocType(submission, userFile); - String metaEntry = generateMetaDataEntry(batchIndex, subfolder, docUploadFilename, docType, submission); + String metaEntry = generateMetaDataEntry(batchIndex, subfolder, docUploadFilename, docType, submission, + docOwnerName.split("_")[0], docOwnerName.split("_")[1]); docMeta.append(metaEntry); } } @@ -251,16 +254,22 @@ private void packageSnapApplication(String batchIndex, ZipOutputStream zos, Stri zos.putNextEntry(entry); zos.write(file); zos.closeEntry(); - String metaEntry = generateMetaDataEntry(batchIndex, subfolder, fileName, "APP-OFS 4 APP", submission); + String metaEntry = generateMetaDataEntry(batchIndex, subfolder, fileName, "APP-OFS 4 APP", submission, + submission.getInputData().getOrDefault("firstName", "").toString(), + submission.getInputData().getOrDefault("lastName", "").toString()); docMeta.append(metaEntry); } - private String generateMetaDataEntry(String batchIndex, String subfolder, String filename, String documentType, Submission submission) { + private String generateMetaDataEntry(String batchIndex, + String subfolder, + String filename, + String documentType, + Submission submission, + String documentOwnerFirstName, + String documentOwnerLastName) { Map inputData = submission.getInputData(); String formattedSSN = formatSSN(inputData); String formattedFilename = removeFileExtension(filename); - String documentOwnerFirstName = formattedFilename.split("_")[0]; - String documentOwnerLastName = formattedFilename.split("_")[1]; String formattedBirthdate = formatBirthdate(submission.getInputData()); ZonedDateTime submittedAt = submission.getSubmittedAt().atZoneSameInstant(ZoneId.systemDefault()); String formattedSubmissionDate = submittedAt.withZoneSameInstant(CST).format(MMDDYYYY_HHMMSS);