@Test(expectedExceptions = {}) public void testPopulateSearchParameterMapFromFile() throws IOException, FHIRParserException { File customSearchParams = new File("src/test/resources/config/tenant1/extension-search-parameters.json"); if (DEBUG) { System.out.println(customSearchParams.getAbsolutePath()); } Reader reader = new FileReader(customSearchParams); Bundle bundle = FHIRParser.parser(Format.JSON).parse(reader); Map<String, ParametersMap> params = ParametersUtil.buildSearchParametersMapFromBundle(bundle); if (DEBUG) { System.out.println(params.keySet()); } assertNotNull(params); assertFalse(params.isEmpty()); assertEquals(params.size(), 2); }
public static Map<String, ParametersMap> buildSearchParametersMapFromBundle(Bundle bundle) { Map<String, ParametersMap> typeToParamMap = new HashMap<>(); for (Bundle.Entry entry : bundle.getEntry()) { SearchParameter parameter = entry.getResource().as(SearchParameter.class); if (log.isLoggable(Level.FINE)) { log.fine(String.format(LOG_PARAMETERS, parameter.getCode().getValue())); } if (parameter.getExpression() == null || !parameter.getExpression().hasValue()) { if (log.isLoggable(Level.FINE)) { log.fine(String.format(MISSING_EXPRESSION, parameter.getCode().getValue())); } } else { List<ResourceType> types = parameter.getBase(); for (ResourceType type : types) { String base = type.getValue(); ParametersMap map = typeToParamMap.get(base); if (map == null) { map = new ParametersMap(); typeToParamMap.put(base, map); } String code = parameter.getCode().getValue(); String name = parameter.getName().getValue(); checkAndWarnForIssueWithCodeAndName(code, name); map.insert(code, parameter); } } } return Collections.unmodifiableMap(typeToParamMap); }
ParametersUtil { public static Map<String, ParametersMap> buildSearchParametersMapFromBundle(Bundle bundle) { Map<String, ParametersMap> typeToParamMap = new HashMap<>(); for (Bundle.Entry entry : bundle.getEntry()) { SearchParameter parameter = entry.getResource().as(SearchParameter.class); if (log.isLoggable(Level.FINE)) { log.fine(String.format(LOG_PARAMETERS, parameter.getCode().getValue())); } if (parameter.getExpression() == null || !parameter.getExpression().hasValue()) { if (log.isLoggable(Level.FINE)) { log.fine(String.format(MISSING_EXPRESSION, parameter.getCode().getValue())); } } else { List<ResourceType> types = parameter.getBase(); for (ResourceType type : types) { String base = type.getValue(); ParametersMap map = typeToParamMap.get(base); if (map == null) { map = new ParametersMap(); typeToParamMap.put(base, map); } String code = parameter.getCode().getValue(); String name = parameter.getName().getValue(); checkAndWarnForIssueWithCodeAndName(code, name); map.insert(code, parameter); } } } return Collections.unmodifiableMap(typeToParamMap); } }
ParametersUtil { public static Map<String, ParametersMap> buildSearchParametersMapFromBundle(Bundle bundle) { Map<String, ParametersMap> typeToParamMap = new HashMap<>(); for (Bundle.Entry entry : bundle.getEntry()) { SearchParameter parameter = entry.getResource().as(SearchParameter.class); if (log.isLoggable(Level.FINE)) { log.fine(String.format(LOG_PARAMETERS, parameter.getCode().getValue())); } if (parameter.getExpression() == null || !parameter.getExpression().hasValue()) { if (log.isLoggable(Level.FINE)) { log.fine(String.format(MISSING_EXPRESSION, parameter.getCode().getValue())); } } else { List<ResourceType> types = parameter.getBase(); for (ResourceType type : types) { String base = type.getValue(); ParametersMap map = typeToParamMap.get(base); if (map == null) { map = new ParametersMap(); typeToParamMap.put(base, map); } String code = parameter.getCode().getValue(); String name = parameter.getName().getValue(); checkAndWarnForIssueWithCodeAndName(code, name); map.insert(code, parameter); } } } return Collections.unmodifiableMap(typeToParamMap); } private  ParametersUtil(); }
ParametersUtil { public static Map<String, ParametersMap> buildSearchParametersMapFromBundle(Bundle bundle) { Map<String, ParametersMap> typeToParamMap = new HashMap<>(); for (Bundle.Entry entry : bundle.getEntry()) { SearchParameter parameter = entry.getResource().as(SearchParameter.class); if (log.isLoggable(Level.FINE)) { log.fine(String.format(LOG_PARAMETERS, parameter.getCode().getValue())); } if (parameter.getExpression() == null || !parameter.getExpression().hasValue()) { if (log.isLoggable(Level.FINE)) { log.fine(String.format(MISSING_EXPRESSION, parameter.getCode().getValue())); } } else { List<ResourceType> types = parameter.getBase(); for (ResourceType type : types) { String base = type.getValue(); ParametersMap map = typeToParamMap.get(base); if (map == null) { map = new ParametersMap(); typeToParamMap.put(base, map); } String code = parameter.getCode().getValue(); String name = parameter.getName().getValue(); checkAndWarnForIssueWithCodeAndName(code, name); map.insert(code, parameter); } } } return Collections.unmodifiableMap(typeToParamMap); } private  ParametersUtil(); static void init(); static Map<String, ParametersMap> buildSearchParametersMapFromBundle(Bundle bundle); static Map<String, ParametersMap> getBuiltInSearchParametersMap(); static void print(PrintStream out); static void printSearchParameter(SearchParameter parameter, PrintStream out); }
ParametersUtil { public static Map<String, ParametersMap> buildSearchParametersMapFromBundle(Bundle bundle) { Map<String, ParametersMap> typeToParamMap = new HashMap<>(); for (Bundle.Entry entry : bundle.getEntry()) { SearchParameter parameter = entry.getResource().as(SearchParameter.class); if (log.isLoggable(Level.FINE)) { log.fine(String.format(LOG_PARAMETERS, parameter.getCode().getValue())); } if (parameter.getExpression() == null || !parameter.getExpression().hasValue()) { if (log.isLoggable(Level.FINE)) { log.fine(String.format(MISSING_EXPRESSION, parameter.getCode().getValue())); } } else { List<ResourceType> types = parameter.getBase(); for (ResourceType type : types) { String base = type.getValue(); ParametersMap map = typeToParamMap.get(base); if (map == null) { map = new ParametersMap(); typeToParamMap.put(base, map); } String code = parameter.getCode().getValue(); String name = parameter.getName().getValue(); checkAndWarnForIssueWithCodeAndName(code, name); map.insert(code, parameter); } } } return Collections.unmodifiableMap(typeToParamMap); } private  ParametersUtil(); static void init(); static Map<String, ParametersMap> buildSearchParametersMapFromBundle(Bundle bundle); static Map<String, ParametersMap> getBuiltInSearchParametersMap(); static void print(PrintStream out); static void printSearchParameter(SearchParameter parameter, PrintStream out); static final String FHIR_PATH_BUNDLE_ENTRY; static final String FHIR_DEFAULT_SEARCH_PARAMETERS_FILE; static final String FROM_STEAM; static final String ERROR_EXCEPTION; static final String BUILTIN_ERROR_EXCEPTION; static final String STREAM_ERROR_EXCEPTION; static final String LOG_PARAMETERS; static final String MISSING_EXPRESSION_WARNING; static final String LOG_HEADER; static final String LOG_SIZE; }