From 303bec5408ffccaabeab8397f4ba04959a256a78 Mon Sep 17 00:00:00 2001 From: Martin Ndegwa Date: Fri, 8 Sep 2023 22:46:06 +0300 Subject: [PATCH] Release version 0.1.39 - Exception feedback for unconfigured fhir_core_app_id user attribute - Refactor performance metric logs to show seconds and nano second metrics - Support case insensitive sync strategy configurations --- exec/pom.xml | 2 +- plugins/pom.xml | 2 +- .../gateway/plugin/BenchmarkingHelper.java | 26 +++---------------- .../plugin/PermissionAccessChecker.java | 13 ++++++---- pom.xml | 2 +- server/pom.xml | 9 +------ 6 files changed, 15 insertions(+), 39 deletions(-) diff --git a/exec/pom.xml b/exec/pom.xml index fcdc08fe..e8e3f69e 100755 --- a/exec/pom.xml +++ b/exec/pom.xml @@ -21,7 +21,7 @@ com.google.fhir.gateway fhir-gateway - 0.1.38 + 0.1.39 exec diff --git a/plugins/pom.xml b/plugins/pom.xml index 77d791dd..9d5a4511 100755 --- a/plugins/pom.xml +++ b/plugins/pom.xml @@ -23,7 +23,7 @@ implementations do not have to do this; they can redeclare those deps. --> com.google.fhir.gateway fhir-gateway - 0.1.38 + 0.1.39 plugins diff --git a/plugins/src/main/java/com/google/fhir/gateway/plugin/BenchmarkingHelper.java b/plugins/src/main/java/com/google/fhir/gateway/plugin/BenchmarkingHelper.java index 7a87317b..6a9808b2 100644 --- a/plugins/src/main/java/com/google/fhir/gateway/plugin/BenchmarkingHelper.java +++ b/plugins/src/main/java/com/google/fhir/gateway/plugin/BenchmarkingHelper.java @@ -21,30 +21,10 @@ public class BenchmarkingHelper { public static void printCompletedInDuration(long startTime, String methodDetails, Logger logger) { long nanoSecondsTaken = System.nanoTime() - startTime; long millSecondsTaken = nanoSecondsTaken / 1000000; - logger.error( + logger.info( String.format( - "########## %s completed in %s : Metric in seconds - %d : Metric in nanoseconds - %d", - methodDetails, - getHumanDuration(millSecondsTaken), - millSecondsTaken / 1000, - nanoSecondsTaken)); - } - - public static String getHumanDuration(long milliseconds) { - - long minutes = (milliseconds / 1000) / 60; - long seconds = (milliseconds / 1000) % 60; - String secondsStr = Long.toString(seconds); - String secs; - if (secondsStr.length() >= 2) { - secs = secondsStr.substring(0, 2); - } else { - secs = "0" + secondsStr; - } - - return minutes == 0 && seconds == 0 - ? "less than a second" - : minutes + " mins " + secs + " secs"; + "########## %s : Metric in seconds - %d : Metric in nanoseconds - %d", + methodDetails, millSecondsTaken / 1000, nanoSecondsTaken)); } public static long startBenchmarking() { diff --git a/plugins/src/main/java/com/google/fhir/gateway/plugin/PermissionAccessChecker.java b/plugins/src/main/java/com/google/fhir/gateway/plugin/PermissionAccessChecker.java index 017d5963..433c1f96 100755 --- a/plugins/src/main/java/com/google/fhir/gateway/plugin/PermissionAccessChecker.java +++ b/plugins/src/main/java/com/google/fhir/gateway/plugin/PermissionAccessChecker.java @@ -360,7 +360,7 @@ public AccessChecker create( List organizationIds = new ArrayList<>(); List locationIds = new ArrayList<>(); if (StringUtils.isNotBlank(syncStrategy)) { - if (syncStrategy.equals(Constants.CARE_TEAM)) { + if (Constants.CARE_TEAM.equalsIgnoreCase(syncStrategy)) { careTeams = practitionerDetails != null && practitionerDetails.getFhirPractitionerDetails() != null @@ -371,7 +371,7 @@ public AccessChecker create( careTeamIds.add(careTeam.getIdElement().getIdPart()); } } - } else if (syncStrategy.equals(Constants.ORGANIZATION)) { + } else if (Constants.ORGANIZATION.equalsIgnoreCase(syncStrategy)) { organizations = practitionerDetails != null && practitionerDetails.getFhirPractitionerDetails() != null @@ -382,7 +382,7 @@ public AccessChecker create( organizationIds.add(organization.getIdElement().getIdPart()); } } - } else if (syncStrategy.equals(Constants.LOCATION)) { + } else if (Constants.LOCATION.equalsIgnoreCase(syncStrategy)) { locationIds = practitionerDetails != null && practitionerDetails.getFhirPractitionerDetails() != null @@ -390,9 +390,12 @@ public AccessChecker create( practitionerDetails.getFhirPractitionerDetails().getLocationHierarchyList()) : locationIds; } - } + } else + throw new IllegalStateException( + "Sync strategy not configured. Please confirm Keycloak fhir_core_app_id attribute for" + + " the user matches the Composition.json config official identifier value"); - BenchmarkingHelper.printCompletedInDuration(start, "create ", logger); + BenchmarkingHelper.printCompletedInDuration(start, "create", logger); return new PermissionAccessChecker( fhirContext, diff --git a/pom.xml b/pom.xml index 36fcc47a..21c4ae0b 100755 --- a/pom.xml +++ b/pom.xml @@ -27,7 +27,7 @@ com.google.fhir.gateway fhir-gateway - 0.1.38 + 0.1.39 pom FHIR Information Gateway diff --git a/server/pom.xml b/server/pom.xml index 1f0a3b96..77db3981 100755 --- a/server/pom.xml +++ b/server/pom.xml @@ -21,7 +21,7 @@ com.google.fhir.gateway fhir-gateway - 0.1.38 + 0.1.39 server @@ -78,13 +78,6 @@ test - - org.springframework - spring-test - ${spring.version} - test - - com.google.http-client