diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/CodeSystemUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/CodeSystemUtilities.java index 9de226f72..5482a2645 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/CodeSystemUtilities.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/CodeSystemUtilities.java @@ -282,6 +282,16 @@ public class CodeSystemUtilities { return cs; } + public static boolean makeCSShareable(CodeSystem cs) { + if (!cs.hasMeta()) + cs.setMeta(new Meta()); + for (UriType t : cs.getMeta().getProfile()) + if (t.getValue().equals("http://hl7.org/fhir/StructureDefinition/shareablecodesystem")) + return false; + cs.getMeta().getProfile().add(new CanonicalType("http://hl7.org/fhir/StructureDefinition/shareablecodesystem")); + return true; + } + public static void setOID(CodeSystem cs, String oid) { if (!oid.startsWith("urn:oid:")) oid = "urn:oid:" + oid; diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/ValueSetUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/ValueSetUtilities.java index 1fb3bb354..ae0f24f9e 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/ValueSetUtilities.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/ValueSetUtilities.java @@ -57,6 +57,16 @@ public class ValueSetUtilities { return vs; } + public static boolean makeVSShareable(ValueSet vs) { + if (!vs.hasMeta()) + vs.setMeta(new Meta()); + for (UriType t : vs.getMeta().getProfile()) + if (t.getValue().equals("http://hl7.org/fhir/StructureDefinition/shareablevalueset")) + return false; + vs.getMeta().getProfile().add(new CanonicalType("http://hl7.org/fhir/StructureDefinition/shareablevalueset")); + return true; + } + public static void checkShareable(ValueSet vs) { if (!vs.hasMeta()) throw new Error("ValueSet "+vs.getUrl()+" is not shareable");