use of org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent in project org.hl7.fhir.core by hapifhir.
the class ValueSetExpanderSimple method addCodeAndDescendents.
private void addCodeAndDescendents(CodeSystem cs, String system, ConceptDefinitionComponent def, ValueSetExpansionContainsComponent parent, Parameters expParams, List<ValueSet> filters, ConceptDefinitionComponent exclusion, IConceptFilter filterFunc) throws FHIRException {
def.checkNoModifiers("Code in Code System", "expanding");
if (exclusion != null) {
if (exclusion.getCode().equals(def.getCode()))
// excluded.
return;
}
if (!CodeSystemUtilities.isDeprecated(cs, def, false)) {
ValueSetExpansionContainsComponent np = null;
boolean abs = CodeSystemUtilities.isNotSelectable(cs, def);
boolean inc = CodeSystemUtilities.isInactive(cs, def);
if ((includeAbstract || !abs) && filterFunc.includeConcept(cs, def)) {
np = addCode(system, def.getCode(), def.getDisplay(), parent, def.getDesignation(), expParams, abs, inc, filters);
}
for (ConceptDefinitionComponent c : def.getConcept()) {
addCodeAndDescendents(cs, system, c, np, expParams, filters, exclusion, filterFunc);
}
if (def.hasUserData(CodeSystemUtilities.USER_DATA_CROSS_LINK)) {
List<ConceptDefinitionComponent> children = (List<ConceptDefinitionComponent>) def.getUserData(CodeSystemUtilities.USER_DATA_CROSS_LINK);
for (ConceptDefinitionComponent c : children) addCodeAndDescendents(cs, system, c, np, expParams, filters, exclusion, filterFunc);
}
} else {
for (ConceptDefinitionComponent c : def.getConcept()) {
addCodeAndDescendents(cs, system, c, null, expParams, filters, exclusion, filterFunc);
}
if (def.hasUserData(CodeSystemUtilities.USER_DATA_CROSS_LINK)) {
List<ConceptDefinitionComponent> children = (List<ConceptDefinitionComponent>) def.getUserData(CodeSystemUtilities.USER_DATA_CROSS_LINK);
for (ConceptDefinitionComponent c : children) addCodeAndDescendents(cs, system, c, null, expParams, filters, exclusion, filterFunc);
}
}
}
use of org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent in project org.hl7.fhir.core by hapifhir.
the class ValueSetExpanderSimple method copyImportContains.
private void copyImportContains(List<ValueSetExpansionContainsComponent> list, ValueSetExpansionContainsComponent parent, Parameters expParams, List<ValueSet> filter) throws FHIRException {
for (ValueSetExpansionContainsComponent c : list) {
c.checkNoModifiers("Imported Expansion in Code System", "expanding");
ValueSetExpansionContainsComponent np = addCode(c.getSystem(), c.getCode(), c.getDisplay(), parent, null, expParams, c.getAbstract(), c.getInactive(), filter);
copyImportContains(c.getContains(), np, expParams, filter);
}
}
use of org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent in project org.hl7.fhir.core by hapifhir.
the class ValueSetExpanderSimple method doServerIncludeCodes.
private void doServerIncludeCodes(ConceptSetComponent inc, boolean heirarchical, ValueSetExpansionComponent exp, List<ValueSet> imports, Parameters expParams, List<Extension> extensions) throws FHIRException {
ValueSetExpansionOutcome vso = context.expandVS(inc, heirarchical);
if (vso.getError() != null) {
throw failTSE("Unable to expand imported value set: " + vso.getError());
}
ValueSet vs = vso.getValueset();
if (vs.hasVersion()) {
if (!existsInParams(exp.getParameter(), "version", new UriType(vs.getUrl() + "|" + vs.getVersion()))) {
exp.getParameter().add(new ValueSetExpansionParameterComponent().setName("version").setValue(new UriType(vs.getUrl() + "|" + vs.getVersion())));
}
}
for (ValueSetExpansionParameterComponent p : vso.getValueset().getExpansion().getParameter()) {
if (!existsInParams(exp.getParameter(), p.getName(), p.getValue())) {
exp.getParameter().add(p);
}
}
for (Extension ex : vs.getExpansion().getExtension()) {
if (Utilities.existsInList(ex.getUrl(), ToolingExtensions.EXT_EXP_TOOCOSTLY, "http://hl7.org/fhir/StructureDefinition/valueset-unclosed")) {
if (!hasExtension(extensions, ex.getUrl())) {
extensions.add(ex);
}
}
}
for (ValueSetExpansionContainsComponent cc : vs.getExpansion().getContains()) {
addCodeAndDescendents(cc, null, expParams, imports);
}
}
use of org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent in project org.hl7.fhir.core by hapifhir.
the class ValueSetExpanderSimple method copyExpansion.
public void copyExpansion(List<ValueSetExpansionContainsComponent> list) {
for (ValueSetExpansionContainsComponent cc : list) {
ValueSetExpansionContainsComponent n = new ValueSet.ValueSetExpansionContainsComponent();
n.setSystem(cc.getSystem());
n.setCode(cc.getCode());
n.setAbstract(cc.getAbstract());
n.setInactive(cc.getInactive());
n.setDisplay(cc.getDisplay());
n.getDesignation().addAll(cc.getDesignation());
String s = key(n);
if (!map.containsKey(s) && !excludeKeys.contains(s)) {
codes.add(n);
map.put(s, n);
total++;
}
copyExpansion(cc.getContains());
}
}
use of org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent in project org.hl7.fhir.core by hapifhir.
the class ValueSetRenderer method addDesignationRow.
private void addDesignationRow(ValueSetExpansionContainsComponent c, XhtmlNode t, List<String> langs, Map<String, String> designations) {
XhtmlNode tr = t.tr();
tr.td().addText(c.getCode());
addDesignationsToRow(c, designations, tr);
addLangaugesToRow(c, langs, tr);
for (ValueSetExpansionContainsComponent cc : c.getContains()) {
addDesignationRow(cc, t, langs, designations);
}
}
Aggregations