fix rendering of type for previous versions
This commit is contained in:
parent
ceaa131d81
commit
75a3c325ef
|
@ -6,6 +6,7 @@ import java.io.UnsupportedEncodingException;
|
|||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r5.model.CodeType;
|
||||
import org.hl7.fhir.r5.model.Enumeration;
|
||||
import org.hl7.fhir.r5.model.Enumerations.FHIRTypes;
|
||||
import org.hl7.fhir.r5.model.Enumerations.VersionIndependentResourceTypesAll;
|
||||
import org.hl7.fhir.r5.model.Extension;
|
||||
import org.hl7.fhir.r5.model.OperationDefinition;
|
||||
|
@ -21,6 +22,7 @@ import org.hl7.fhir.r5.utils.ToolingExtensions;
|
|||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||
import org.hl7.fhir.utilities.StandardsStatus;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.VersionUtilities;
|
||||
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
|
||||
|
||||
public class OperationDefinitionRenderer extends TerminologyRenderer {
|
||||
|
@ -122,9 +124,10 @@ public class OperationDefinitionRenderer extends TerminologyRenderer {
|
|||
}
|
||||
tr.td().addText(Integer.toString(p.getMin())+".."+p.getMax());
|
||||
td = tr.td();
|
||||
StructureDefinition sd = p.getType() != null ? context.getWorker().fetchTypeDefinition(p.getType().toCode()) : null;
|
||||
String actualType = translateTypeToVersion(p.getTypeElement());
|
||||
StructureDefinition sd = actualType != null ? context.getWorker().fetchTypeDefinition(actualType) : null;
|
||||
if (sd == null)
|
||||
td.tx(p.hasType() ? p.getType().toCode() : "");
|
||||
td.tx(p.hasType() ? actualType : "");
|
||||
else if (sd.getAbstract() && p.hasExtension(ToolingExtensions.EXT_ALLOWED_TYPE)) {
|
||||
boolean first = true;
|
||||
for (Extension ex : p.getExtensionsByUrl(ToolingExtensions.EXT_ALLOWED_TYPE)) {
|
||||
|
@ -132,12 +135,12 @@ public class OperationDefinitionRenderer extends TerminologyRenderer {
|
|||
String s = ex.getValue().primitiveValue();
|
||||
StructureDefinition sdt = context.getWorker().fetchTypeDefinition(s);
|
||||
if (sdt == null)
|
||||
td.tx(p.hasType() ? p.getType().toCode() : "");
|
||||
td.tx(p.hasType() ? actualType : "");
|
||||
else
|
||||
td.ah(sdt.getWebPath()).tx(s);
|
||||
}
|
||||
} else
|
||||
td.ah(sd.getWebPath()).tx(p.hasType() ? p.getType().toCode() : "");
|
||||
td.ah(sd.getWebPath()).tx(actualType);
|
||||
if (p.hasSearchType()) {
|
||||
td.br();
|
||||
td.tx("(");
|
||||
|
@ -156,6 +159,16 @@ public class OperationDefinitionRenderer extends TerminologyRenderer {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final String EXT_OPDEF_ORIGINAL_TYPE = "http://hl7.org/fhir/4.0/StructureDefinition/extension-OperationDefinition.parameter.type";
|
||||
|
||||
private String translateTypeToVersion(Enumeration<FHIRTypes> src) {
|
||||
if (src.hasExtension(EXT_OPDEF_ORIGINAL_TYPE)) {
|
||||
return src.getExtensionString(EXT_OPDEF_ORIGINAL_TYPE);
|
||||
} else {
|
||||
return src.asStringValue();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue