From dadc3701e4666e7eadb36e2e288c68400afd9e8b Mon Sep 17 00:00:00 2001 From: dksharma Date: Fri, 17 Feb 2023 15:59:54 -0600 Subject: [PATCH] Added method comments for better understand of utility method usage --- .../fhir/r5/test/ShexGeneratorTestUtils.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/ShexGeneratorTestUtils.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/ShexGeneratorTestUtils.java index 7e210bc1f..ee490b294 100644 --- a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/ShexGeneratorTestUtils.java +++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/ShexGeneratorTestUtils.java @@ -7,6 +7,14 @@ import java.util.Collections; import java.util.Comparator; import java.util.List; +/** + * ShexGeneratorTestUtils + * + * This class provides auxiliary methos to perform testing of + * Shape Expressions (ShEx) translation of various FHIR Resources. + * + * Author: Deepak Sharma + */ public class ShexGeneratorTestUtils { public class resDef { public String name; @@ -28,6 +36,14 @@ public class ShexGeneratorTestUtils { public enum RESOURCE_CATEGORY{ LOGICAL_NAMES, STRUCTURE_DEFINITIONS, EXTENSIONS, PROFILES, ALL } + + /** + * Filters Structure Definitions from a given list of + * mixed types of StructureDefinitons based on resource categories + * @param sds List of StructureDefiniton of any resource type + * @param cat Resource category filter criteria (inclusive) + * @return List of resDef with just Structure Definition's name, url and description. + */ public List getSDs(List sds, RESOURCE_CATEGORY cat) { List selSDs = new ArrayList(); sds.forEach((StructureDefinition sd) -> { @@ -64,6 +80,14 @@ public class ShexGeneratorTestUtils { return selSDs; } + + /** + * This method is used in testing only - during Resource Constraint translation to ShEx constructs. + * It can be used by future developers to avoid unnecessary processing of constraints + * that belong to these Meta Level Resources of FHIR. This list was created by FHIRCat + * Project group for testing (fhircat.org). It does not skip these SDs for the build. + * @return List of StructureDefinitions at meta Level + */ public static List getMetaStructureDefinitionsToSkip(){ List skipSDs = new ArrayList(); skipSDs.add("http://hl7.org/fhir/StructureDefinition/ActivityDefinition"); @@ -114,6 +138,11 @@ public class ShexGeneratorTestUtils { return selectedExtesnsions; } + /** + * Structure Definition Information for debug/printing purpose during testing. + * @param sd Structure Definition + * @return String representation of basic SD Information + */ public static String getSDInfo(StructureDefinition sd) { if (sd != null) { String kind = " "; @@ -157,6 +186,11 @@ public class ShexGeneratorTestUtils { return ""; } + /** + * Utility Print method to print interim resDef object for debug/testing purpose. + * @param title title of resDef types (Resources, Extensions, profiles, etc.) + * @param items List of resDef objects + */ public static void printList(String title, List items) { System.out.println("************************************************************************"); System.out.println("Printing " + title);