Java Code Examples for org.hl7.fhir.dstu3.model.ValueSet#hasMeta()

The following examples show how to use org.hl7.fhir.dstu3.model.ValueSet#hasMeta() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ValueSetUtilities.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public static ValueSet makeShareable(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 vs;
  vs.getMeta().getProfile().add(new UriType("http://hl7.org/fhir/StructureDefinition/shareablevalueset"));
  return vs;
}
 
Example 2
Source File: ValueSetUtilities.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public static void checkShareable(ValueSet vs) {
  if (!vs.hasMeta())
    throw new Error("ValueSet "+vs.getUrl()+" is not shareable");
  for (UriType t : vs.getMeta().getProfile()) {
    if (t.getValue().equals("http://hl7.org/fhir/StructureDefinition/shareablevalueset"))
      return;
  }
  throw new Error("ValueSet "+vs.getUrl()+" is not shareable");    
}