Skip to content

Commit

Permalink
fixed breaking change, changing pdf document name
Browse files Browse the repository at this point in the history
  • Loading branch information
pspeasegood committed Nov 14, 2022
1 parent 4b3f3ce commit 182ef6c
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
@RequiredArgsConstructor()
public class PdfService {

private static final String ENGLISH = "English";
private static final String WELSH = "Welsh";

private final PdfMapperService pdfMapperService;
@Value("${pdf.english}")
public String englishPdfTemplateSource;
Expand Down Expand Up @@ -87,8 +90,7 @@ private static String createPdfDocumentNameFromCaseData(CaseData caseData, Strin
+ caseData.getClaimantIndType().getClaimantFirstNames().replace(" ", "_")
+ "_"
+ caseData.getClaimantIndType().getClaimantLastName().replace(" ", "_")
+ "_"
+ documentLanguage
+ documentLanguage == ENGLISH ? "" : "_" + documentLanguage
+ ".pdf";
}

Expand Down Expand Up @@ -124,13 +126,13 @@ public List<PdfDecodedMultipartFile> convertCaseDataToPdfDecodedMultipartFile(Ca
throws PdfServiceException {
List<PdfDecodedMultipartFile> files = new ArrayList<>();
files.add(new PdfDecodedMultipartFile(convertCaseToPdf(caseData, this.englishPdfTemplateSource),
createPdfDocumentNameFromCaseData(caseData, "English"),
createPdfDocumentNameFromCaseData(caseData, ENGLISH),
PDF_FILE_TIKA_CONTENT_TYPE,
createPdfDocumentDescriptionFromCaseData(caseData)));

if (caseData.getClaimantType().getClaimantContactLanguage().equals("Welsh")) {
if (caseData.getClaimantType().getClaimantContactLanguage().equals(WELSH)) {
files.add(new PdfDecodedMultipartFile(convertCaseToPdf(caseData, this.welshPdfTemplateSource),
createPdfDocumentNameFromCaseData(caseData, "Welsh"),
createPdfDocumentNameFromCaseData(caseData, WELSH),
PDF_FILE_TIKA_CONTENT_TYPE,
createPdfDocumentDescriptionFromCaseData(caseData)));
}
Expand Down

0 comments on commit 182ef6c

Please sign in to comment.