Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
d79ac9ba66
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>org.hl7.fhir.core</artifactId>
|
<artifactId>org.hl7.fhir.core</artifactId>
|
||||||
<version>5.6.81-SNAPSHOT</version>
|
<version>5.6.84-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.hl7.fhir.convertors.conv10_40.resources10_40;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.hl7.fhir.convertors.SourceElementComponentWrapper;
|
import org.hl7.fhir.convertors.SourceElementComponentWrapper;
|
||||||
import org.hl7.fhir.convertors.context.ConversionContext10_40;
|
import org.hl7.fhir.convertors.context.ConversionContext10_40;
|
||||||
|
@ -18,6 +19,7 @@ import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.r4.model.CanonicalType;
|
import org.hl7.fhir.r4.model.CanonicalType;
|
||||||
import org.hl7.fhir.r4.model.ConceptMap;
|
import org.hl7.fhir.r4.model.ConceptMap;
|
||||||
import org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent;
|
import org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent;
|
||||||
|
import org.hl7.fhir.r4.model.Type;
|
||||||
|
|
||||||
public class ConceptMap10_40 {
|
public class ConceptMap10_40 {
|
||||||
|
|
||||||
|
@ -55,10 +57,14 @@ public class ConceptMap10_40 {
|
||||||
tgt.setPurpose(src.getRequirements());
|
tgt.setPurpose(src.getRequirements());
|
||||||
if (src.hasCopyright())
|
if (src.hasCopyright())
|
||||||
tgt.setCopyright(src.getCopyright());
|
tgt.setCopyright(src.getCopyright());
|
||||||
|
if (src.hasSource()) {
|
||||||
org.hl7.fhir.r4.model.Type r = ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().convertType(src.getSource());
|
org.hl7.fhir.r4.model.Type r = ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().convertType(src.getSource());
|
||||||
tgt.setSource(r instanceof org.hl7.fhir.r4.model.Reference ? new CanonicalType(((org.hl7.fhir.r4.model.Reference) r).getReference()) : r);
|
tgt.setSource(r instanceof org.hl7.fhir.r4.model.Reference ? new CanonicalType(((org.hl7.fhir.r4.model.Reference) r).getReference()) : r);
|
||||||
r = ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().convertType(src.getTarget());
|
}
|
||||||
|
if (src.hasTarget()) {
|
||||||
|
Type r = ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().convertType(src.getTarget());
|
||||||
tgt.setTarget(r instanceof org.hl7.fhir.r4.model.Reference ? new CanonicalType(((org.hl7.fhir.r4.model.Reference) r).getReference()) : r);
|
tgt.setTarget(r instanceof org.hl7.fhir.r4.model.Reference ? new CanonicalType(((org.hl7.fhir.r4.model.Reference) r).getReference()) : r);
|
||||||
|
}
|
||||||
for (org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent t : src.getElement()) {
|
for (org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent t : src.getElement()) {
|
||||||
List<SourceElementComponentWrapper<ConceptMap.SourceElementComponent>> ws = convertSourceElementComponent(t);
|
List<SourceElementComponentWrapper<ConceptMap.SourceElementComponent>> ws = convertSourceElementComponent(t);
|
||||||
for (SourceElementComponentWrapper<ConceptMap.SourceElementComponent> w : ws)
|
for (SourceElementComponentWrapper<ConceptMap.SourceElementComponent> w : ws)
|
||||||
|
@ -308,7 +314,7 @@ public class ConceptMap10_40 {
|
||||||
|
|
||||||
static public ConceptMapGroupComponent getGroup(ConceptMap map, String srcs, String tgts) {
|
static public ConceptMapGroupComponent getGroup(ConceptMap map, String srcs, String tgts) {
|
||||||
for (ConceptMapGroupComponent grp : map.getGroup()) {
|
for (ConceptMapGroupComponent grp : map.getGroup()) {
|
||||||
if (grp.getSource().equals(srcs) && grp.getTarget().equals(tgts))
|
if (Objects.equals(grp.getSource(), srcs) && Objects.equals(grp.getTarget(), tgts))
|
||||||
return grp;
|
return grp;
|
||||||
}
|
}
|
||||||
ConceptMapGroupComponent grp = map.addGroup();
|
ConceptMapGroupComponent grp = map.addGroup();
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.hl7.fhir.convertors.conv10_50.resources10_50;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import org.hl7.fhir.convertors.SourceElementComponentWrapper;
|
import org.hl7.fhir.convertors.SourceElementComponentWrapper;
|
||||||
import org.hl7.fhir.convertors.VersionConvertorConstants;
|
import org.hl7.fhir.convertors.VersionConvertorConstants;
|
||||||
|
@ -20,6 +21,7 @@ import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.r5.model.CanonicalType;
|
import org.hl7.fhir.r5.model.CanonicalType;
|
||||||
import org.hl7.fhir.r5.model.ConceptMap;
|
import org.hl7.fhir.r5.model.ConceptMap;
|
||||||
import org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent;
|
import org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent;
|
||||||
|
import org.hl7.fhir.r5.model.DataType;
|
||||||
import org.hl7.fhir.r5.model.Enumeration;
|
import org.hl7.fhir.r5.model.Enumeration;
|
||||||
import org.hl7.fhir.r5.model.Enumerations;
|
import org.hl7.fhir.r5.model.Enumerations;
|
||||||
import org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship;
|
import org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship;
|
||||||
|
@ -61,10 +63,14 @@ public class ConceptMap10_50 {
|
||||||
tgt.setPurpose(src.getRequirements());
|
tgt.setPurpose(src.getRequirements());
|
||||||
if (src.hasCopyright())
|
if (src.hasCopyright())
|
||||||
tgt.setCopyright(src.getCopyright());
|
tgt.setCopyright(src.getCopyright());
|
||||||
|
if (src.hasSource()) {
|
||||||
org.hl7.fhir.r5.model.DataType r = ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().convertType(src.getSource());
|
org.hl7.fhir.r5.model.DataType r = ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().convertType(src.getSource());
|
||||||
tgt.setSourceScope(r instanceof org.hl7.fhir.r5.model.Reference ? new CanonicalType(((org.hl7.fhir.r5.model.Reference) r).getReference()) : r);
|
tgt.setSourceScope(r instanceof org.hl7.fhir.r5.model.Reference ? new CanonicalType(((org.hl7.fhir.r5.model.Reference) r).getReference()) : r);
|
||||||
r = ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().convertType(src.getTarget());
|
}
|
||||||
|
if (src.hasTarget()) {
|
||||||
|
DataType r = ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().convertType(src.getTarget());
|
||||||
tgt.setTargetScope(r instanceof org.hl7.fhir.r5.model.Reference ? new CanonicalType(((org.hl7.fhir.r5.model.Reference) r).getReference()) : r);
|
tgt.setTargetScope(r instanceof org.hl7.fhir.r5.model.Reference ? new CanonicalType(((org.hl7.fhir.r5.model.Reference) r).getReference()) : r);
|
||||||
|
}
|
||||||
for (org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent t : src.getElement()) {
|
for (org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent t : src.getElement()) {
|
||||||
List<SourceElementComponentWrapper<ConceptMap.SourceElementComponent>> ws = convertSourceElementComponent(t);
|
List<SourceElementComponentWrapper<ConceptMap.SourceElementComponent>> ws = convertSourceElementComponent(t);
|
||||||
for (SourceElementComponentWrapper<ConceptMap.SourceElementComponent> w : ws)
|
for (SourceElementComponentWrapper<ConceptMap.SourceElementComponent> w : ws)
|
||||||
|
@ -312,7 +318,7 @@ public class ConceptMap10_50 {
|
||||||
|
|
||||||
static public ConceptMapGroupComponent getGroup(ConceptMap map, String srcs, String tgts) {
|
static public ConceptMapGroupComponent getGroup(ConceptMap map, String srcs, String tgts) {
|
||||||
for (ConceptMapGroupComponent grp : map.getGroup()) {
|
for (ConceptMapGroupComponent grp : map.getGroup()) {
|
||||||
if (grp.getSource().equals(srcs) && grp.getTarget().equals(tgts))
|
if (Objects.equals(grp.getSource(), srcs) && Objects.equals(grp.getTarget(), tgts))
|
||||||
return grp;
|
return grp;
|
||||||
}
|
}
|
||||||
ConceptMapGroupComponent grp = map.addGroup();
|
ConceptMapGroupComponent grp = map.addGroup();
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>org.hl7.fhir.core</artifactId>
|
<artifactId>org.hl7.fhir.core</artifactId>
|
||||||
<version>5.6.81-SNAPSHOT</version>
|
<version>5.6.84-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>org.hl7.fhir.core</artifactId>
|
<artifactId>org.hl7.fhir.core</artifactId>
|
||||||
<version>5.6.81-SNAPSHOT</version>
|
<version>5.6.84-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>org.hl7.fhir.core</artifactId>
|
<artifactId>org.hl7.fhir.core</artifactId>
|
||||||
<version>5.6.81-SNAPSHOT</version>
|
<version>5.6.84-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>org.hl7.fhir.core</artifactId>
|
<artifactId>org.hl7.fhir.core</artifactId>
|
||||||
<version>5.6.81-SNAPSHOT</version>
|
<version>5.6.84-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>org.hl7.fhir.core</artifactId>
|
<artifactId>org.hl7.fhir.core</artifactId>
|
||||||
<version>5.6.81-SNAPSHOT</version>
|
<version>5.6.84-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>org.hl7.fhir.core</artifactId>
|
<artifactId>org.hl7.fhir.core</artifactId>
|
||||||
<version>5.6.81-SNAPSHOT</version>
|
<version>5.6.84-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -277,8 +277,14 @@ public class GraphQLSchemaGenerator {
|
||||||
|
|
||||||
private void generateElementBase(Writer writer, EnumSet<FHIROperationType> operations) throws IOException {
|
private void generateElementBase(Writer writer, EnumSet<FHIROperationType> operations) throws IOException {
|
||||||
if (operations.contains(FHIROperationType.READ) || operations.contains(FHIROperationType.SEARCH)) {
|
if (operations.contains(FHIROperationType.READ) || operations.contains(FHIROperationType.SEARCH)) {
|
||||||
|
writer.write("interface IElement {\r\n");
|
||||||
|
writer.write(" id: String\r\n");
|
||||||
|
writer.write(" extension: [Extension]\r\n");
|
||||||
|
writer.write("}\r\n");
|
||||||
|
writer.write("\r\n");
|
||||||
|
|
||||||
writer.write("type ElementBase {\r\n");
|
writer.write("type ElementBase {\r\n");
|
||||||
writer.write(" id: ID\r\n");
|
writer.write(" id: String\r\n");
|
||||||
writer.write(" extension: [Extension]\r\n");
|
writer.write(" extension: [Extension]\r\n");
|
||||||
writer.write("}\r\n");
|
writer.write("}\r\n");
|
||||||
writer.write("\r\n");
|
writer.write("\r\n");
|
||||||
|
@ -298,19 +304,25 @@ public class GraphQLSchemaGenerator {
|
||||||
List<StringBuilder> list = new ArrayList<>();
|
List<StringBuilder> list = new ArrayList<>();
|
||||||
StringBuilder b = new StringBuilder();
|
StringBuilder b = new StringBuilder();
|
||||||
list.add(b);
|
list.add(b);
|
||||||
b.append("type ");
|
b.append("interface ");
|
||||||
b.append(sd.getName());
|
b.append("I" + sd.getName());
|
||||||
StructureDefinition sdp = context.fetchResource(StructureDefinition.class, sd.getBaseDefinition());
|
generateTypeSuperinterfaceDeclaration(sd, b);
|
||||||
if (sdp != null) {
|
|
||||||
b.append(" implements ");
|
|
||||||
b.append(sdp.getType());
|
|
||||||
}
|
|
||||||
b.append(" {\r\n");
|
b.append(" {\r\n");
|
||||||
ElementDefinition ed = sd.getSnapshot().getElementFirstRep();
|
ElementDefinition ed = sd.getSnapshot().getElementFirstRep();
|
||||||
generateProperties(existingTypeNames, list, b, sd.getName(), sd, ed, "type", "");
|
generateProperties(existingTypeNames, list, b, sd.getName(), sd, ed, "type", "");
|
||||||
b.append("}");
|
b.append("}");
|
||||||
b.append("\r\n");
|
b.append("\r\n");
|
||||||
b.append("\r\n");
|
b.append("\r\n");
|
||||||
|
|
||||||
|
b.append("type ");
|
||||||
|
b.append(sd.getName());
|
||||||
|
generateTypeSuperinterfaceDeclaration(sd, b);
|
||||||
|
b.append(" {\r\n");
|
||||||
|
generateProperties(existingTypeNames, list, b, sd.getName(), sd, ed, "type", "");
|
||||||
|
b.append("}");
|
||||||
|
b.append("\r\n");
|
||||||
|
b.append("\r\n");
|
||||||
|
|
||||||
for (StringBuilder bs : list) {
|
for (StringBuilder bs : list) {
|
||||||
writer.write(bs.toString());
|
writer.write(bs.toString());
|
||||||
}
|
}
|
||||||
|
@ -336,6 +348,23 @@ public class GraphQLSchemaGenerator {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void generateTypeSuperinterfaceDeclaration(StructureDefinition theParentSd, StringBuilder theBuilder) {
|
||||||
|
StructureDefinition baseSd = theParentSd;
|
||||||
|
boolean first = true;
|
||||||
|
while (baseSd != null && baseSd.getBaseDefinition() != null) {
|
||||||
|
baseSd = context.fetchResource(StructureDefinition.class, baseSd.getBaseDefinition());
|
||||||
|
if (baseSd != null) {
|
||||||
|
if (first) {
|
||||||
|
theBuilder.append(" implements ");
|
||||||
|
first = false;
|
||||||
|
} else {
|
||||||
|
theBuilder.append(" & ");
|
||||||
|
}
|
||||||
|
theBuilder.append("I" + baseSd.getType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void generateProperties(Map<String, String> existingTypeNames, List<StringBuilder> list, StringBuilder b, String typeName, StructureDefinition sd, ElementDefinition ed, String mode, String suffix) throws IOException {
|
private void generateProperties(Map<String, String> existingTypeNames, List<StringBuilder> list, StringBuilder b, String typeName, StructureDefinition sd, ElementDefinition ed, String mode, String suffix) throws IOException {
|
||||||
List<ElementDefinition> children = profileUtilities.getChildList(sd, ed);
|
List<ElementDefinition> children = profileUtilities.getChildList(sd, ed);
|
||||||
for (ElementDefinition child : children) {
|
for (ElementDefinition child : children) {
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>org.hl7.fhir.core</artifactId>
|
<artifactId>org.hl7.fhir.core</artifactId>
|
||||||
<version>5.6.81-SNAPSHOT</version>
|
<version>5.6.84-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>org.hl7.fhir.core</artifactId>
|
<artifactId>org.hl7.fhir.core</artifactId>
|
||||||
<version>5.6.81-SNAPSHOT</version>
|
<version>5.6.84-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>org.hl7.fhir.core</artifactId>
|
<artifactId>org.hl7.fhir.core</artifactId>
|
||||||
<version>5.6.81-SNAPSHOT</version>
|
<version>5.6.84-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>org.hl7.fhir.core</artifactId>
|
<artifactId>org.hl7.fhir.core</artifactId>
|
||||||
<version>5.6.81-SNAPSHOT</version>
|
<version>5.6.84-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
4
pom.xml
4
pom.xml
|
@ -14,12 +14,12 @@
|
||||||
HAPI FHIR
|
HAPI FHIR
|
||||||
-->
|
-->
|
||||||
<artifactId>org.hl7.fhir.core</artifactId>
|
<artifactId>org.hl7.fhir.core</artifactId>
|
||||||
<version>5.6.81-SNAPSHOT</version>
|
<version>5.6.84-SNAPSHOT</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<hapi_fhir_version>5.4.0</hapi_fhir_version>
|
<hapi_fhir_version>5.4.0</hapi_fhir_version>
|
||||||
<validator_test_case_version>1.1.127-SNAPSHOT</validator_test_case_version>
|
<validator_test_case_version>1.1.127</validator_test_case_version>
|
||||||
<junit_jupiter_version>5.7.1</junit_jupiter_version>
|
<junit_jupiter_version>5.7.1</junit_jupiter_version>
|
||||||
<junit_platform_launcher_version>1.8.2</junit_platform_launcher_version>
|
<junit_platform_launcher_version>1.8.2</junit_platform_launcher_version>
|
||||||
<maven_surefire_version>3.0.0-M5</maven_surefire_version>
|
<maven_surefire_version>3.0.0-M5</maven_surefire_version>
|
||||||
|
|
Loading…
Reference in New Issue