Merge remote-tracking branch 'origin/master'

This commit is contained in:
Grahame Grieve 2022-11-30 16:34:51 +11:00
commit d79ac9ba66
16 changed files with 73 additions and 32 deletions

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.6.81-SNAPSHOT</version>
<version>5.6.84-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -2,6 +2,7 @@ package org.hl7.fhir.convertors.conv10_40.resources10_40;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import org.hl7.fhir.convertors.SourceElementComponentWrapper;
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.ConceptMap;
import org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent;
import org.hl7.fhir.r4.model.Type;
public class ConceptMap10_40 {
@ -55,10 +57,14 @@ public class ConceptMap10_40 {
tgt.setPurpose(src.getRequirements());
if (src.hasCopyright())
tgt.setCopyright(src.getCopyright());
if (src.hasSource()) {
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);
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);
}
for (org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent t : src.getElement()) {
List<SourceElementComponentWrapper<ConceptMap.SourceElementComponent>> ws = convertSourceElementComponent(t);
for (SourceElementComponentWrapper<ConceptMap.SourceElementComponent> w : ws)
@ -308,7 +314,7 @@ public class ConceptMap10_40 {
static public ConceptMapGroupComponent getGroup(ConceptMap map, String srcs, String tgts) {
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;
}
ConceptMapGroupComponent grp = map.addGroup();

View File

@ -2,6 +2,7 @@ package org.hl7.fhir.convertors.conv10_50.resources10_50;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import org.hl7.fhir.convertors.SourceElementComponentWrapper;
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.ConceptMap;
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.Enumerations;
import org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship;
@ -61,10 +63,14 @@ public class ConceptMap10_50 {
tgt.setPurpose(src.getRequirements());
if (src.hasCopyright())
tgt.setCopyright(src.getCopyright());
if (src.hasSource()) {
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);
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);
}
for (org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent t : src.getElement()) {
List<SourceElementComponentWrapper<ConceptMap.SourceElementComponent>> ws = convertSourceElementComponent(t);
for (SourceElementComponentWrapper<ConceptMap.SourceElementComponent> w : ws)
@ -312,7 +318,7 @@ public class ConceptMap10_50 {
static public ConceptMapGroupComponent getGroup(ConceptMap map, String srcs, String tgts) {
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;
}
ConceptMapGroupComponent grp = map.addGroup();

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.6.81-SNAPSHOT</version>
<version>5.6.84-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.6.81-SNAPSHOT</version>
<version>5.6.84-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.6.81-SNAPSHOT</version>
<version>5.6.84-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.6.81-SNAPSHOT</version>
<version>5.6.84-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.6.81-SNAPSHOT</version>
<version>5.6.84-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.6.81-SNAPSHOT</version>
<version>5.6.84-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -277,8 +277,14 @@ public class GraphQLSchemaGenerator {
private void generateElementBase(Writer writer, EnumSet<FHIROperationType> operations) throws IOException {
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(" id: ID\r\n");
writer.write(" id: String\r\n");
writer.write(" extension: [Extension]\r\n");
writer.write("}\r\n");
writer.write("\r\n");
@ -298,19 +304,25 @@ public class GraphQLSchemaGenerator {
List<StringBuilder> list = new ArrayList<>();
StringBuilder b = new StringBuilder();
list.add(b);
b.append("type ");
b.append(sd.getName());
StructureDefinition sdp = context.fetchResource(StructureDefinition.class, sd.getBaseDefinition());
if (sdp != null) {
b.append(" implements ");
b.append(sdp.getType());
}
b.append("interface ");
b.append("I" + sd.getName());
generateTypeSuperinterfaceDeclaration(sd, b);
b.append(" {\r\n");
ElementDefinition ed = sd.getSnapshot().getElementFirstRep();
generateProperties(existingTypeNames, list, b, sd.getName(), sd, ed, "type", "");
b.append("}");
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) {
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 {
List<ElementDefinition> children = profileUtilities.getChildList(sd, ed);
for (ElementDefinition child : children) {

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.6.81-SNAPSHOT</version>
<version>5.6.84-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.6.81-SNAPSHOT</version>
<version>5.6.84-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.6.81-SNAPSHOT</version>
<version>5.6.84-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.6.81-SNAPSHOT</version>
<version>5.6.84-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -14,12 +14,12 @@
HAPI FHIR
-->
<artifactId>org.hl7.fhir.core</artifactId>
<version>5.6.81-SNAPSHOT</version>
<version>5.6.84-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<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_platform_launcher_version>1.8.2</junit_platform_launcher_version>
<maven_surefire_version>3.0.0-M5</maven_surefire_version>