@Test public void testVerify() { PopulateParameterNames.verify(); assert true; }
public static void verify() { Properties props = new Properties(); boolean found = false; try (InputStream fis = PopulateParameterNames.class.getClassLoader().getResourceAsStream("parameter_names.properties")) { props.load(fis); Set<String> codes = new HashSet<>(); for (SearchParamType.ValueSet spt : SearchParamType.ValueSet.values()) { Collection<SearchParameter> searchParametersForResourceType = FHIRRegistry.getInstance().getSearchParameters(spt.value()); for (SearchParameter searchParameter : searchParametersForResourceType) { codes.add(searchParameter.getCode().getValue()); } } List<String> codesList = new ArrayList<>(codes); Collections.sort(codesList); Integer highestValue = 1001; Map<String, Integer> valueMap = new HashMap<>(); for (Entry<Object, Object> valueEntry : props.entrySet()) { Integer curVal = Integer.parseInt((String) valueEntry.getValue()); String resource = (String) valueEntry.getKey(); valueMap.put(resource, curVal); if (highestValue < curVal) { highestValue = curVal; } codes.remove(resource); } for (String code : codes.stream().sorted().collect(Collectors.toList())) { LOGGER.info(code + "=" + highestValue++); found = true; } } catch (IOException e) { throw new IllegalArgumentException("File access issue for parameter_names"); } if (found) { throw new IllegalArgumentException("Parameter Name/Code are missing from parameter_names"); } }
PopulateParameterNames implements IDatabaseStatement { public static void verify() { Properties props = new Properties(); boolean found = false; try (InputStream fis = PopulateParameterNames.class.getClassLoader().getResourceAsStream("parameter_names.properties")) { props.load(fis); Set<String> codes = new HashSet<>(); for (SearchParamType.ValueSet spt : SearchParamType.ValueSet.values()) { Collection<SearchParameter> searchParametersForResourceType = FHIRRegistry.getInstance().getSearchParameters(spt.value()); for (SearchParameter searchParameter : searchParametersForResourceType) { codes.add(searchParameter.getCode().getValue()); } } List<String> codesList = new ArrayList<>(codes); Collections.sort(codesList); Integer highestValue = 1001; Map<String, Integer> valueMap = new HashMap<>(); for (Entry<Object, Object> valueEntry : props.entrySet()) { Integer curVal = Integer.parseInt((String) valueEntry.getValue()); String resource = (String) valueEntry.getKey(); valueMap.put(resource, curVal); if (highestValue < curVal) { highestValue = curVal; } codes.remove(resource); } for (String code : codes.stream().sorted().collect(Collectors.toList())) { LOGGER.info(code + "=" + highestValue++); found = true; } } catch (IOException e) { throw new IllegalArgumentException("File access issue for parameter_names"); } if (found) { throw new IllegalArgumentException("Parameter Name/Code are missing from parameter_names"); } } }
PopulateParameterNames implements IDatabaseStatement { public static void verify() { Properties props = new Properties(); boolean found = false; try (InputStream fis = PopulateParameterNames.class.getClassLoader().getResourceAsStream("parameter_names.properties")) { props.load(fis); Set<String> codes = new HashSet<>(); for (SearchParamType.ValueSet spt : SearchParamType.ValueSet.values()) { Collection<SearchParameter> searchParametersForResourceType = FHIRRegistry.getInstance().getSearchParameters(spt.value()); for (SearchParameter searchParameter : searchParametersForResourceType) { codes.add(searchParameter.getCode().getValue()); } } List<String> codesList = new ArrayList<>(codes); Collections.sort(codesList); Integer highestValue = 1001; Map<String, Integer> valueMap = new HashMap<>(); for (Entry<Object, Object> valueEntry : props.entrySet()) { Integer curVal = Integer.parseInt((String) valueEntry.getValue()); String resource = (String) valueEntry.getKey(); valueMap.put(resource, curVal); if (highestValue < curVal) { highestValue = curVal; } codes.remove(resource); } for (String code : codes.stream().sorted().collect(Collectors.toList())) { LOGGER.info(code + "=" + highestValue++); found = true; } } catch (IOException e) { throw new IllegalArgumentException("File access issue for parameter_names"); } if (found) { throw new IllegalArgumentException("Parameter Name/Code are missing from parameter_names"); } } PopulateParameterNames(String adminSchemaName, String schemaName, Integer tenantId); }
PopulateParameterNames implements IDatabaseStatement { public static void verify() { Properties props = new Properties(); boolean found = false; try (InputStream fis = PopulateParameterNames.class.getClassLoader().getResourceAsStream("parameter_names.properties")) { props.load(fis); Set<String> codes = new HashSet<>(); for (SearchParamType.ValueSet spt : SearchParamType.ValueSet.values()) { Collection<SearchParameter> searchParametersForResourceType = FHIRRegistry.getInstance().getSearchParameters(spt.value()); for (SearchParameter searchParameter : searchParametersForResourceType) { codes.add(searchParameter.getCode().getValue()); } } List<String> codesList = new ArrayList<>(codes); Collections.sort(codesList); Integer highestValue = 1001; Map<String, Integer> valueMap = new HashMap<>(); for (Entry<Object, Object> valueEntry : props.entrySet()) { Integer curVal = Integer.parseInt((String) valueEntry.getValue()); String resource = (String) valueEntry.getKey(); valueMap.put(resource, curVal); if (highestValue < curVal) { highestValue = curVal; } codes.remove(resource); } for (String code : codes.stream().sorted().collect(Collectors.toList())) { LOGGER.info(code + "=" + highestValue++); found = true; } } catch (IOException e) { throw new IllegalArgumentException("File access issue for parameter_names"); } if (found) { throw new IllegalArgumentException("Parameter Name/Code are missing from parameter_names"); } } PopulateParameterNames(String adminSchemaName, String schemaName, Integer tenantId); @Override void run(IDatabaseTranslator translator, Connection c); static void verify(); }
PopulateParameterNames implements IDatabaseStatement { public static void verify() { Properties props = new Properties(); boolean found = false; try (InputStream fis = PopulateParameterNames.class.getClassLoader().getResourceAsStream("parameter_names.properties")) { props.load(fis); Set<String> codes = new HashSet<>(); for (SearchParamType.ValueSet spt : SearchParamType.ValueSet.values()) { Collection<SearchParameter> searchParametersForResourceType = FHIRRegistry.getInstance().getSearchParameters(spt.value()); for (SearchParameter searchParameter : searchParametersForResourceType) { codes.add(searchParameter.getCode().getValue()); } } List<String> codesList = new ArrayList<>(codes); Collections.sort(codesList); Integer highestValue = 1001; Map<String, Integer> valueMap = new HashMap<>(); for (Entry<Object, Object> valueEntry : props.entrySet()) { Integer curVal = Integer.parseInt((String) valueEntry.getValue()); String resource = (String) valueEntry.getKey(); valueMap.put(resource, curVal); if (highestValue < curVal) { highestValue = curVal; } codes.remove(resource); } for (String code : codes.stream().sorted().collect(Collectors.toList())) { LOGGER.info(code + "=" + highestValue++); found = true; } } catch (IOException e) { throw new IllegalArgumentException("File access issue for parameter_names"); } if (found) { throw new IllegalArgumentException("Parameter Name/Code are missing from parameter_names"); } } PopulateParameterNames(String adminSchemaName, String schemaName, Integer tenantId); @Override void run(IDatabaseTranslator translator, Connection c); static void verify();  }