makeshareable changes

This commit is contained in:
Grahame Grieve 2021-01-14 12:19:14 +11:00
parent fa7341ca44
commit 9bdd663497
2 changed files with 20 additions and 0 deletions

View File

@ -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;

View File

@ -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");