use of org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionComponent in project org.hl7.fhir.core by hapifhir.
the class BaseWorkerContext method expandVS.
@Override
public ValueSetExpansionComponent expandVS(ConceptSetComponent inc) {
ValueSet vs = new ValueSet();
vs.setCompose(new ValueSetComposeComponent());
vs.getCompose().getInclude().add(inc);
ValueSetExpansionOutcome vse = expandVS(vs, true);
return vse.getValueset().getExpansion();
}
use of org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionComponent in project org.hl7.fhir.core by hapifhir.
the class ValueSet method setProperty.
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("url"))
// UriType
this.url = castToUri(value);
else if (name.equals("identifier"))
// Identifier
this.identifier = castToIdentifier(value);
else if (name.equals("version"))
// StringType
this.version = castToString(value);
else if (name.equals("name"))
// StringType
this.name = castToString(value);
else if (name.equals("status"))
// Enumeration<ConformanceResourceStatus>
this.status = new ConformanceResourceStatusEnumFactory().fromType(value);
else if (name.equals("experimental"))
// BooleanType
this.experimental = castToBoolean(value);
else if (name.equals("publisher"))
// StringType
this.publisher = castToString(value);
else if (name.equals("contact"))
this.getContact().add((ValueSetContactComponent) value);
else if (name.equals("date"))
// DateTimeType
this.date = castToDateTime(value);
else if (name.equals("lockedDate"))
// DateType
this.lockedDate = castToDate(value);
else if (name.equals("description"))
// StringType
this.description = castToString(value);
else if (name.equals("useContext"))
this.getUseContext().add(castToCodeableConcept(value));
else if (name.equals("immutable"))
// BooleanType
this.immutable = castToBoolean(value);
else if (name.equals("requirements"))
// StringType
this.requirements = castToString(value);
else if (name.equals("copyright"))
// StringType
this.copyright = castToString(value);
else if (name.equals("extensible"))
// BooleanType
this.extensible = castToBoolean(value);
else if (name.equals("compose"))
// ValueSetComposeComponent
this.compose = (ValueSetComposeComponent) value;
else if (name.equals("expansion"))
// ValueSetExpansionComponent
this.expansion = (ValueSetExpansionComponent) value;
else
super.setProperty(name, value);
}
use of org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionComponent in project org.hl7.fhir.core by hapifhir.
the class BaseWorkerContext method expandVS.
@Override
public ValueSetExpansionComponent expandVS(ConceptSetComponent inc, boolean heirachical) throws TerminologyServiceException {
ValueSet vs = new ValueSet();
vs.setCompose(new ValueSetComposeComponent());
vs.getCompose().getInclude().add(inc);
ValueSetExpansionOutcome vse = expandVS(vs, true, heirachical);
ValueSet valueset = vse.getValueset();
if (valueset == null) {
throw new TerminologyServiceException("Error Expanding ValueSet: " + vse.getError());
}
return valueset.getExpansion();
}
use of org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionComponent in project org.hl7.fhir.core by hapifhir.
the class QuestionnaireBuilder method makeTypeList.
private ValueSet makeTypeList(StructureDefinition profile, List<TypeRefComponent> types, String path) {
ValueSet vs = new ValueSet();
vs.setName("Type options for " + path);
vs.setDescription(vs.getName());
vs.setStatus(ConformanceResourceStatus.ACTIVE);
vs.setExpansion(new ValueSetExpansionComponent());
vs.getExpansion().setIdentifier(Factory.createUUID());
vs.getExpansion().setTimestampElement(DateTimeType.now());
for (TypeRefComponent t : types) {
ValueSetExpansionContainsComponent cc = vs.getExpansion().addContains();
if (t.getCode().equals("Reference") && (t.hasProfile() && t.getProfile().get(0).getValue().startsWith("http://hl7.org/fhir/StructureDefinition/"))) {
cc.setCode(t.getProfile().get(0).getValue().substring(40));
cc.setSystem("http://hl7.org/fhir/resource-types");
cc.setDisplay(cc.getCode());
} else {
ProfileUtilities pu = new ProfileUtilities(context, null, null);
StructureDefinition ps = null;
if (t.hasProfile())
ps = pu.getProfile(profile, t.getProfile().get(0).getValue());
if (ps != null) {
cc.setCode(t.getProfile().get(0).getValue());
cc.setDisplay(ps.getSnapshot().getElement().get(0).getType().get(0).getCode());
cc.setSystem("http://hl7.org/fhir/resource-types");
} else {
cc.setCode(t.getCode());
cc.setDisplay(t.getCode());
cc.setSystem("http://hl7.org/fhir/data-types");
}
}
t.setUserData("text", cc.getCode());
}
return vs;
}
use of org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionComponent in project org.hl7.fhir.core by hapifhir.
the class QuestionnaireBuilder method makeTypeList.
private ValueSet makeTypeList(StructureDefinition profile, List<TypeRefComponent> types, String path) {
ValueSet vs = new ValueSet();
vs.setName("Type options for " + path);
vs.setDescription(vs.present());
vs.setStatus(PublicationStatus.ACTIVE);
vs.setExpansion(new ValueSetExpansionComponent());
vs.getExpansion().setIdentifier(Factory.createUUID());
vs.getExpansion().setTimestampElement(DateTimeType.now());
for (TypeRefComponent t : types) {
if (t.hasTarget()) {
for (UriType u : t.getTargetProfile()) {
if (u.getValue().startsWith("http://hl7.org/fhir/StructureDefinition/")) {
ValueSetExpansionContainsComponent cc = vs.getExpansion().addContains();
cc.setCode(u.getValue().substring(40));
cc.setSystem("http://hl7.org/fhir/resource-types");
cc.setDisplay(cc.getCode());
}
}
} else if (!t.hasProfile()) {
ValueSetExpansionContainsComponent cc = vs.getExpansion().addContains();
cc.setCode(t.getWorkingCode());
cc.setDisplay(t.getWorkingCode());
cc.setSystem("http://hl7.org/fhir/data-types");
} else
for (UriType u : t.getProfile()) {
ProfileUtilities pu = new ProfileUtilities(context, null, null);
StructureDefinition ps = pu.getProfile(profile, u.getValue());
if (ps != null) {
ValueSetExpansionContainsComponent cc = vs.getExpansion().addContains();
cc.setCode(u.getValue());
cc.setDisplay(ps.getType());
cc.setSystem("http://hl7.org/fhir/resource-types");
}
}
}
return vs;
}
Aggregations