Search in sources :

Example 1 with SearchParameterNode

use of org.hl7.fhir.r4.utils.IntegrityChecker.SearchParameterNode in project org.hl7.fhir.core by hapifhir.

the class IntegrityChecker method checkSP.

private void checkSP() throws IOException {
    List<SearchParameter> list = new ArrayList<>();
    for (String sdn : npm.listResources("SearchParameter")) {
        InputStream s = npm.load(sdn);
        SearchParameter sp = (SearchParameter) new JsonParser().parse(s);
        list.add(sp);
    }
    msg("Loaded " + list.size() + " resources");
    Map<String, SearchParameterNode> map = new HashMap<>();
    for (SearchParameter sp : list) {
        for (CodeType c : sp.getBase()) {
            String s = c.primitiveValue();
            if (!map.containsKey(s)) {
                map.put(s, new SearchParameterNode(s));
            }
            addNode(sp, sp.getBase().size() == 1, map.get(s));
        }
    }
    for (SearchParameterNode node : sort(map.values())) {
        dump(node);
    }
}
Also used : SearchParameterNode(org.hl7.fhir.r4.utils.IntegrityChecker.SearchParameterNode) HashMap(java.util.HashMap) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) ArrayList(java.util.ArrayList) CodeType(org.hl7.fhir.r4.model.CodeType) SearchParameter(org.hl7.fhir.r4.model.SearchParameter) JsonParser(org.hl7.fhir.r4.formats.JsonParser)

Example 2 with SearchParameterNode

use of org.hl7.fhir.r4.utils.IntegrityChecker.SearchParameterNode in project org.hl7.fhir.core by hapifhir.

the class IntegrityChecker method sort.

private List<SearchParameterNode> sort(Collection<SearchParameterNode> values) {
    List<SearchParameterNode> res = new ArrayList<>();
    res.addAll(values);
    Collections.sort(res, new SearchParameterNodeSorter());
    return res;
}
Also used : SearchParameterNode(org.hl7.fhir.r4b.utils.IntegrityChecker.SearchParameterNode) SearchParameterNodeSorter(org.hl7.fhir.r4b.utils.IntegrityChecker.SearchParameterNodeSorter) ArrayList(java.util.ArrayList)

Example 3 with SearchParameterNode

use of org.hl7.fhir.r4.utils.IntegrityChecker.SearchParameterNode in project org.hl7.fhir.core by hapifhir.

the class IntegrityChecker method checkSP.

private void checkSP() throws IOException {
    List<SearchParameter> list = new ArrayList<>();
    for (String sdn : npm.listResources("SearchParameter")) {
        InputStream s = npm.load(sdn);
        SearchParameter sp = (SearchParameter) new JsonParser().parse(s);
        list.add(sp);
    }
    msg("Loaded " + list.size() + " resources");
    Map<String, SearchParameterNode> map = new HashMap<>();
    for (SearchParameter sp : list) {
        for (CodeType c : sp.getBase()) {
            String s = c.primitiveValue();
            if (!map.containsKey(s)) {
                map.put(s, new SearchParameterNode(s));
            }
            addNode(sp, sp.getBase().size() == 1, map.get(s));
        }
    }
    for (SearchParameterNode node : sort(map.values())) {
        dump(node);
    }
}
Also used : SearchParameterNode(org.hl7.fhir.r4b.utils.IntegrityChecker.SearchParameterNode) HashMap(java.util.HashMap) ZipInputStream(java.util.zip.ZipInputStream) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) ArrayList(java.util.ArrayList) CodeType(org.hl7.fhir.r4b.model.CodeType) SearchParameter(org.hl7.fhir.r4b.model.SearchParameter) JsonParser(org.hl7.fhir.r4b.formats.JsonParser)

Example 4 with SearchParameterNode

use of org.hl7.fhir.r4.utils.IntegrityChecker.SearchParameterNode in project org.hl7.fhir.core by hapifhir.

the class IntegrityChecker method sort.

private List<SearchParameterNode> sort(Collection<SearchParameterNode> values) {
    List<SearchParameterNode> res = new ArrayList<>();
    res.addAll(values);
    Collections.sort(res, new SearchParameterNodeSorter());
    return res;
}
Also used : SearchParameterNode(org.hl7.fhir.r4.utils.IntegrityChecker.SearchParameterNode) SearchParameterNodeSorter(org.hl7.fhir.r4.utils.IntegrityChecker.SearchParameterNodeSorter) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)4 FileInputStream (java.io.FileInputStream)2 InputStream (java.io.InputStream)2 HashMap (java.util.HashMap)2 SearchParameterNode (org.hl7.fhir.r4.utils.IntegrityChecker.SearchParameterNode)2 SearchParameterNode (org.hl7.fhir.r4b.utils.IntegrityChecker.SearchParameterNode)2 ZipInputStream (java.util.zip.ZipInputStream)1 JsonParser (org.hl7.fhir.r4.formats.JsonParser)1 CodeType (org.hl7.fhir.r4.model.CodeType)1 SearchParameter (org.hl7.fhir.r4.model.SearchParameter)1 SearchParameterNodeSorter (org.hl7.fhir.r4.utils.IntegrityChecker.SearchParameterNodeSorter)1 JsonParser (org.hl7.fhir.r4b.formats.JsonParser)1 CodeType (org.hl7.fhir.r4b.model.CodeType)1 SearchParameter (org.hl7.fhir.r4b.model.SearchParameter)1 SearchParameterNodeSorter (org.hl7.fhir.r4b.utils.IntegrityChecker.SearchParameterNodeSorter)1