From 4f48bce9593eb2a45c853601a79aaf4646e9b66d Mon Sep 17 00:00:00 2001 From: Brenin Rhodes Date: Wed, 24 Apr 2024 15:02:49 -0600 Subject: [PATCH] cleanup --- .../fhir/cdshooks/svc/cr/CdsCrConstants.java | 2 -- .../PrefetchTemplateBuilderDstu3.java | 9 +++--- .../discovery/PrefetchTemplateBuilderR4.java | 32 ++++++++++--------- .../discovery/PrefetchTemplateBuilderR5.java | 9 +++--- 4 files changed, 27 insertions(+), 25 deletions(-) diff --git a/hapi-fhir-server-cds-hooks/src/main/java/ca/uhn/hapi/fhir/cdshooks/svc/cr/CdsCrConstants.java b/hapi-fhir-server-cds-hooks/src/main/java/ca/uhn/hapi/fhir/cdshooks/svc/cr/CdsCrConstants.java index b7829490b61..ccb6c2a3b3c 100644 --- a/hapi-fhir-server-cds-hooks/src/main/java/ca/uhn/hapi/fhir/cdshooks/svc/cr/CdsCrConstants.java +++ b/hapi-fhir-server-cds-hooks/src/main/java/ca/uhn/hapi/fhir/cdshooks/svc/cr/CdsCrConstants.java @@ -20,8 +20,6 @@ package ca.uhn.hapi.fhir.cdshooks.svc.cr; public class CdsCrConstants { - private CdsCrConstants() {} - public static final String CDS_CR_MODULE_ID = "CR"; public static final String CRMI_EFFECTIVE_DATA_REQUIREMENTS = diff --git a/hapi-fhir-server-cds-hooks/src/main/java/ca/uhn/hapi/fhir/cdshooks/svc/cr/discovery/PrefetchTemplateBuilderDstu3.java b/hapi-fhir-server-cds-hooks/src/main/java/ca/uhn/hapi/fhir/cdshooks/svc/cr/discovery/PrefetchTemplateBuilderDstu3.java index 3cd917b2e6c..446a0bd2b98 100644 --- a/hapi-fhir-server-cds-hooks/src/main/java/ca/uhn/hapi/fhir/cdshooks/svc/cr/discovery/PrefetchTemplateBuilderDstu3.java +++ b/hapi-fhir-server-cds-hooks/src/main/java/ca/uhn/hapi/fhir/cdshooks/svc/cr/discovery/PrefetchTemplateBuilderDstu3.java @@ -185,14 +185,14 @@ public class PrefetchTemplateBuilderDstu3 extends BasePrefetchTemplateBuilder { } protected StringBuilder getCodesStringBuilder( - List theList, StringBuilder theCodes, String theSystem, String theCode) { + List theStrings, StringBuilder theCodes, String theSystem, String theCode) { String codeToken = theSystem + "|" + theCode; int postAppendLength = theCodes.length() + codeToken.length(); if (theCodes.length() > 0 && postAppendLength < myMaxUriLength) { theCodes.append(","); } else if (postAppendLength > myMaxUriLength) { - theList.add(theCodes.toString()); + theStrings.add(theCodes.toString()); theCodes = new StringBuilder(); } theCodes.append(codeToken); @@ -427,8 +427,9 @@ public class PrefetchTemplateBuilderDstu3 extends BasePrefetchTemplateBuilder { return "subject"; case "VisionPrescription": return "patient"; - } - return null; + default: + return null; + } } } diff --git a/hapi-fhir-server-cds-hooks/src/main/java/ca/uhn/hapi/fhir/cdshooks/svc/cr/discovery/PrefetchTemplateBuilderR4.java b/hapi-fhir-server-cds-hooks/src/main/java/ca/uhn/hapi/fhir/cdshooks/svc/cr/discovery/PrefetchTemplateBuilderR4.java index 13ea110453e..301fc963193 100644 --- a/hapi-fhir-server-cds-hooks/src/main/java/ca/uhn/hapi/fhir/cdshooks/svc/cr/discovery/PrefetchTemplateBuilderR4.java +++ b/hapi-fhir-server-cds-hooks/src/main/java/ca/uhn/hapi/fhir/cdshooks/svc/cr/discovery/PrefetchTemplateBuilderR4.java @@ -127,11 +127,11 @@ public class PrefetchTemplateBuilderR4 extends BasePrefetchTemplateBuilder { } } - protected List resolveValueCodingCodes(List valueCodings) { + protected List resolveValueCodingCodes(List theValueCodings) { List result = new ArrayList<>(); StringBuilder codes = new StringBuilder(); - for (Coding coding : valueCodings) { + for (Coding coding : theValueCodings) { if (coding.hasCode()) { String system = coding.getSystem(); String code = coding.getCode(); @@ -144,8 +144,8 @@ public class PrefetchTemplateBuilderR4 extends BasePrefetchTemplateBuilder { return result; } - protected List resolveValueSetCodes(CanonicalType valueSetId) { - ValueSet valueSet = (ValueSet) SearchHelper.searchRepositoryByCanonical(myRepository, valueSetId); + protected List resolveValueSetCodes(CanonicalType theValueSetId) { + ValueSet valueSet = (ValueSet) SearchHelper.searchRepositoryByCanonical(myRepository, theValueSetId); List result = new ArrayList<>(); StringBuilder codes = new StringBuilder(); if (valueSet.hasExpansion() && valueSet.getExpansion().hasContains()) { @@ -172,18 +172,19 @@ public class PrefetchTemplateBuilderR4 extends BasePrefetchTemplateBuilder { return result; } - protected StringBuilder getCodesStringBuilder(List ret, StringBuilder codes, String system, String code) { - String codeToken = system + "|" + code; - int postAppendLength = codes.length() + codeToken.length(); + protected StringBuilder getCodesStringBuilder( + List theStrings, StringBuilder theCodes, String system, String theCode) { + String codeToken = system + "|" + theCode; + int postAppendLength = theCodes.length() + codeToken.length(); - if (codes.length() > 0 && postAppendLength < myMaxUriLength) { - codes.append(","); + if (theCodes.length() > 0 && postAppendLength < myMaxUriLength) { + theCodes.append(","); } else if (postAppendLength > myMaxUriLength) { - ret.add(codes.toString()); - codes = new StringBuilder(); + theStrings.add(theCodes.toString()); + theCodes = new StringBuilder(); } - codes.append(codeToken); - return codes; + theCodes.append(codeToken); + return theCodes; } protected String mapCodePathToSearchParam(String theDataType, String thePath) { @@ -406,8 +407,9 @@ public class PrefetchTemplateBuilderR4 extends BasePrefetchTemplateBuilder { return "subject"; case "VisionPrescription": return "patient"; - } - return null; + default: + return null; + } } } diff --git a/hapi-fhir-server-cds-hooks/src/main/java/ca/uhn/hapi/fhir/cdshooks/svc/cr/discovery/PrefetchTemplateBuilderR5.java b/hapi-fhir-server-cds-hooks/src/main/java/ca/uhn/hapi/fhir/cdshooks/svc/cr/discovery/PrefetchTemplateBuilderR5.java index 2fdec3514d2..accb87a5b54 100644 --- a/hapi-fhir-server-cds-hooks/src/main/java/ca/uhn/hapi/fhir/cdshooks/svc/cr/discovery/PrefetchTemplateBuilderR5.java +++ b/hapi-fhir-server-cds-hooks/src/main/java/ca/uhn/hapi/fhir/cdshooks/svc/cr/discovery/PrefetchTemplateBuilderR5.java @@ -174,14 +174,14 @@ public class PrefetchTemplateBuilderR5 extends BasePrefetchTemplateBuilder { } protected StringBuilder getCodesStringBuilder( - List theList, StringBuilder theCodes, String theSystem, String theCode) { + List theStrings, StringBuilder theCodes, String theSystem, String theCode) { String codeToken = theSystem + "|" + theCode; int postAppendLength = theCodes.length() + codeToken.length(); if (theCodes.length() > 0 && postAppendLength < myMaxUriLength) { theCodes.append(","); } else if (postAppendLength > myMaxUriLength) { - theList.add(theCodes.toString()); + theStrings.add(theCodes.toString()); theCodes = new StringBuilder(); } theCodes.append(codeToken); @@ -414,8 +414,9 @@ public class PrefetchTemplateBuilderR5 extends BasePrefetchTemplateBuilder { return "subject"; case "VisionPrescription": return "patient"; - } - return null; + default: + return null; + } } }