001package org.hl7.fhir.r5.terminologies;
002
003import java.util.HashSet;
004import java.util.Set;
005
006import org.hl7.fhir.r5.model.CanonicalResource;
007import org.hl7.fhir.r5.model.Identifier;
008import org.hl7.fhir.utilities.json.model.JsonObject;
009
010public class TerminologyUtilities {
011
012  public static Set<String> listOids(CanonicalResource cr) {
013    Set<String> oids = new HashSet<>();
014    
015    if (cr.hasUrl() && cr.getUrl().startsWith("urn:oid:")) {
016      oids.add(cr.getUrl().substring(8));
017    }
018      
019    for (Identifier id : cr.getIdentifier()) {
020      String v = id.getValue();
021      if (v != null && v.startsWith("urn:oid:")) {
022        oids.add(v.substring(8));
023      }
024    }
025    return oids;
026  }
027}