Merge branch 'master' into gg-202105-bugfixes-2

This commit is contained in:
Grahame Grieve 2021-05-07 18:30:26 +10:00 committed by GitHub
commit 154ac5c3ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
59 changed files with 929 additions and 981 deletions

17
.github/stale.yml vendored Normal file
View File

@ -0,0 +1,17 @@
# Six months, minus 5 days, inactivity before an issue becomes stale
daysUntilStale: 175
# 5 days of inactivity before a stale issue is closed
daysUntilClose: 5
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security
# Label to use when marking an issue as stale
staleLabel: wontfix
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed in 5 days if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false

View File

@ -1,10 +1,14 @@
* Update core R5 code to v4.6.0 (breaking changes to questionnaire, concept map, and other resources that are less important to core) * Update core R5 code to v4.6.0 (breaking changes to questionnaire, concept map, and other resources that are less important to core)
* Fix compartment definitions of ListResource.source and subject for R3 and R4 * Fix compartment definitions of ListResource.source and subject for R3 and R4
* Snapshot generator: fix problem checking types on logical models * Snapshot generator: fix problem checking types on logical models
* Do not flag internal references as suspicious * Do not flag internal references as suspicious
* XMLParser allows passing a schema location * XMLParser allows passing a schema location
* Validator: Load code systems from known packages on the fly * XMLParser allows passing a schema location
* Validator: better handle invalid v3 dates * Issue 484 https://github.com/hapifhir/org.hl7.fhir.core/issues/484
* Renderer: Render OperationDefinition.InputProfile and OutputProfile * Adding Kotlin to the build process
* Important: Allow more valid schemas for Utilities.isAbsoluteUrl * random cleaning up in convertors
* Validator: remove notes about extensible bindings if profile extensible binding is valid * Validator: Load code systems from known packages on the fly
* Validator: better handle invalid v3 dates
* Renderer: Render OperationDefinition.InputProfile and OutputProfile
* Important: Allow more valid schemas for Utilities.isAbsoluteUrl
* Validator: remove notes about extensible bindings if profile extensible binding is valid

View File

@ -30,18 +30,9 @@ package org.hl7.fhir.convertors;
*/ */
import java.io.IOException; import com.google.gson.JsonArray;
import java.io.InputStream; import com.google.gson.JsonObject;
import java.text.SimpleDateFormat; import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.TimeZone;
import org.hl7.fhir.convertors.loaders.R2016MayToR4Loader; import org.hl7.fhir.convertors.loaders.R2016MayToR4Loader;
import org.hl7.fhir.convertors.loaders.R2ToR4Loader; import org.hl7.fhir.convertors.loaders.R2ToR4Loader;
import org.hl7.fhir.convertors.loaders.R3ToR4Loader; import org.hl7.fhir.convertors.loaders.R3ToR4Loader;
@ -67,26 +58,16 @@ import org.hl7.fhir.r4.utils.NPMPackageGenerator.Category;
import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager; import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.npm.NpmPackage; import org.hl7.fhir.utilities.npm.NpmPackage;
import org.hl7.fhir.utilities.npm.ToolsVersion;
import org.hl7.fhir.utilities.npm.PackageGenerator.PackageType; import org.hl7.fhir.utilities.npm.PackageGenerator.PackageType;
import org.hl7.fhir.utilities.npm.ToolsVersion;
import com.google.gson.JsonArray; import java.io.IOException;
import com.google.gson.JsonObject; import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.*;
public class ExtensionDefinitionGenerator { public class ExtensionDefinitionGenerator {
public class StringReplacement {
public String source;
public String replacement;
public StringReplacement(String source, String replacement) {
super();
this.source = source;
this.replacement = replacement;
}
}
public static void main(String[] args) throws IOException, FHIRException { public static void main(String[] args) throws IOException, FHIRException {
if (args.length == 0) { if (args.length == 0) {
System.out.println("Extension Generator"); System.out.println("Extension Generator");
@ -107,7 +88,7 @@ public class ExtensionDefinitionGenerator {
self.generate(); self.generate();
} }
} }
private static String getNamedParam(String[] args, String param) { private static String getNamedParam(String[] args, String param) {
boolean found = false; boolean found = false;
@ -118,7 +99,7 @@ public class ExtensionDefinitionGenerator {
found = true; found = true;
} }
} }
throw new Error("Unable to find parameter "+param); throw new Error("Unable to find parameter " + param);
} }
private FHIRVersion sourceVersion; private FHIRVersion sourceVersion;
@ -128,7 +109,7 @@ public class ExtensionDefinitionGenerator {
private ElementDefinition extv; private ElementDefinition extv;
private ProfileUtilities pu; private ProfileUtilities pu;
private BaseWorkerContext context; private BaseWorkerContext context;
public FHIRVersion getSourceVersion() { public FHIRVersion getSourceVersion() {
return sourceVersion; return sourceVersion;
} }
@ -152,7 +133,7 @@ public class ExtensionDefinitionGenerator {
public void setFilename(String filename) { public void setFilename(String filename) {
this.filename = filename; this.filename = filename;
} }
private void generate() throws IOException, FHIRException { private void generate() throws IOException, FHIRException {
List<StructureDefinition> definitions = loadSource(); List<StructureDefinition> definitions = loadSource();
@ -160,7 +141,7 @@ public class ExtensionDefinitionGenerator {
for (StructureDefinition ext : extensions) for (StructureDefinition ext : extensions)
pu.generateSnapshot(extbase, ext, ext.getUrl(), "http://hl7.org/fhir/R4", ext.getName()); pu.generateSnapshot(extbase, ext, ext.getUrl(), "http://hl7.org/fhir/R4", ext.getName());
savePackage(extensions); savePackage(extensions);
} }
private List<StructureDefinition> buildExtensions(List<StructureDefinition> definitions) throws DefinitionException, FHIRException { private List<StructureDefinition> buildExtensions(List<StructureDefinition> definitions) throws DefinitionException, FHIRException {
@ -191,13 +172,13 @@ public class ExtensionDefinitionGenerator {
private StructureDefinition generateExtension(StructureDefinition type, ElementDefinition ed) throws DefinitionException, FHIRException { private StructureDefinition generateExtension(StructureDefinition type, ElementDefinition ed) throws DefinitionException, FHIRException {
StructureDefinition ext = new StructureDefinition(); StructureDefinition ext = new StructureDefinition();
ext.setId("extension-"+ed.getPath().replace("[x]", "")); ext.setId("extension-" + ed.getPath().replace("[x]", ""));
ext.setUrl("http://hl7.org/fhir/"+sourceVersion.toCode(3)+"/StructureDefinition/"+ext.getId()); ext.setUrl("http://hl7.org/fhir/" + sourceVersion.toCode(3) + "/StructureDefinition/" + ext.getId());
if (ext.getId().length() > 64) if (ext.getId().length() > 64)
ext.setId(contract(ext.getId())); ext.setId(contract(ext.getId()));
ext.setVersion(sourceVersion.toCode()); ext.setVersion(sourceVersion.toCode());
ext.setName("ExtensionR"+sourceVersion.toCode(1)+ed.getPath().replace(".", "")); ext.setName("ExtensionR" + sourceVersion.toCode(1) + ed.getPath().replace(".", ""));
ext.setTitle("Extension definition for R"+sourceVersion.toCode(1)+" element " +ed.getPath()); ext.setTitle("Extension definition for R" + sourceVersion.toCode(1) + " element " + ed.getPath());
ext.setStatus(PublicationStatus.ACTIVE); ext.setStatus(PublicationStatus.ACTIVE);
ext.setDate(type.getDate()); ext.setDate(type.getDate());
ext.setFhirVersion(type.getFhirVersion()); ext.setFhirVersion(type.getFhirVersion());
@ -216,20 +197,20 @@ public class ExtensionDefinitionGenerator {
String n = tail(child.getPath()); String n = tail(child.getPath());
if (!Utilities.existsInList(n, "id", "extension", "modifierExtension") && !hasNonValidType(child)) { if (!Utilities.existsInList(n, "id", "extension", "modifierExtension") && !hasNonValidType(child)) {
v = child.copy(); v = child.copy();
v.setId("Extension.extension:"+n); v.setId("Extension.extension:" + n);
v.setPath("Extension.extension"); v.setPath("Extension.extension");
v.setSliceName(n); v.setSliceName(n);
v.getType().clear(); v.getType().clear();
v.setIsSummaryElement(null); v.setIsSummaryElement(null);
v.addType().setCode("Extension").addProfile("http://hl7.org/fhir/"+sourceVersion.toCode(3)+"/StructureDefinition/extension-"+child.getPath().replace("[x]", "")); v.addType().setCode("Extension").addProfile("http://hl7.org/fhir/" + sourceVersion.toCode(3) + "/StructureDefinition/extension-" + child.getPath().replace("[x]", ""));
ext.getDifferential().addElement(v); ext.getDifferential().addElement(v);
} }
} }
ext.getDifferential().addElement(genElement("Extension.url").setFixed(new UriType(ext.getUrl()))); ext.getDifferential().addElement(genElement("Extension.url").setFixed(new UriType(ext.getUrl())));
ext.getDifferential().addElement(genElement("Extension.value[x]").setMax("0")); ext.getDifferential().addElement(genElement("Extension.value[x]").setMax("0"));
} else if (ed.hasType() && Utilities.existsInList(ed.getType().get(0).getCode(), "Resource", "Narrative")) { } else if (ed.hasType() && Utilities.existsInList(ed.getType().get(0).getCode(), "Resource", "Narrative")) {
return null; return null;
} else if (ed.hasType() && !goesInExtension(ed.getType().get(0).getCode())) { } else if (ed.hasType() && !goesInExtension(ed.getType().get(0).getCode())) {
ElementDefinition v = ed.copy(); ElementDefinition v = ed.copy();
v.setPath("Extension"); v.setPath("Extension");
@ -241,12 +222,12 @@ public class ExtensionDefinitionGenerator {
String n = tail(child.getPath()); String n = tail(child.getPath());
if (!Utilities.existsInList(n, "id", "extension", "modifierExtension") && !hasNonValidType(child)) { if (!Utilities.existsInList(n, "id", "extension", "modifierExtension") && !hasNonValidType(child)) {
v = child.copy(); v = child.copy();
v.setId("Extension.extension:"+n); v.setId("Extension.extension:" + n);
v.setPath("Extension.extension"); v.setPath("Extension.extension");
v.setSliceName(n); v.setSliceName(n);
v.getType().clear(); v.getType().clear();
v.setIsSummaryElement(null); v.setIsSummaryElement(null);
v.addType().setCode("Extension").addProfile("http://hl7.org/fhir/"+sourceVersion.toCode(3)+"/StructureDefinition/extension-"+child.getPath().replace("[x]", "")); v.addType().setCode("Extension").addProfile("http://hl7.org/fhir/" + sourceVersion.toCode(3) + "/StructureDefinition/extension-" + child.getPath().replace("[x]", ""));
ext.getDifferential().addElement(v); ext.getDifferential().addElement(v);
} }
} }
@ -288,7 +269,7 @@ public class ExtensionDefinitionGenerator {
private String tail(String path) { private String tail(String path) {
return path.substring(path.lastIndexOf(".")+1); return path.substring(path.lastIndexOf(".") + 1);
} }
@ -315,13 +296,13 @@ public class ExtensionDefinitionGenerator {
abbrevs.add(new StringReplacement("MedicationOrder", "MO")); abbrevs.add(new StringReplacement("MedicationOrder", "MO"));
abbrevs.add(new StringReplacement("MedicationDispense", "MD")); abbrevs.add(new StringReplacement("MedicationDispense", "MD"));
abbrevs.add(new StringReplacement("NutritionOrder", "NO")); abbrevs.add(new StringReplacement("NutritionOrder", "NO"));
abbrevs.add(new StringReplacement("MedicinalProductAuthorization", "MPA")); abbrevs.add(new StringReplacement("MedicinalProductAuthorization", "MPA"));
abbrevs.add(new StringReplacement("MedicinalProductContraindication", "MPC")); abbrevs.add(new StringReplacement("MedicinalProductContraindication", "MPC"));
abbrevs.add(new StringReplacement("MedicinalProductIngredient", "MPI")); abbrevs.add(new StringReplacement("MedicinalProductIngredient", "MPI"));
abbrevs.add(new StringReplacement("MedicinalProductPharmaceutical", "MPP")); abbrevs.add(new StringReplacement("MedicinalProductPharmaceutical", "MPP"));
abbrevs.add(new StringReplacement("MedicinalProduct", "MP")); abbrevs.add(new StringReplacement("MedicinalProduct", "MP"));
abbrevs.add(new StringReplacement("ResearchElementDefinition", "RED")); abbrevs.add(new StringReplacement("ResearchElementDefinition", "RED"));
abbrevs.add(new StringReplacement("RiskEvidenceSynthesis", "RES")); abbrevs.add(new StringReplacement("RiskEvidenceSynthesis", "RES"));
abbrevs.add(new StringReplacement("ObservationDefinition", "OD")); abbrevs.add(new StringReplacement("ObservationDefinition", "OD"));
abbrevs.add(new StringReplacement("SubstanceReferenceInformation", "SRI")); abbrevs.add(new StringReplacement("SubstanceReferenceInformation", "SRI"));
abbrevs.add(new StringReplacement("SubstanceSourceMaterial", "SSM")); abbrevs.add(new StringReplacement("SubstanceSourceMaterial", "SSM"));
@ -333,7 +314,7 @@ public class ExtensionDefinitionGenerator {
abbrevs.add(new StringReplacement("EligibilityResponse", "ERsp")); abbrevs.add(new StringReplacement("EligibilityResponse", "ERsp"));
abbrevs.add(new StringReplacement("ExpansionProfile", "EP")); abbrevs.add(new StringReplacement("ExpansionProfile", "EP"));
abbrevs.add(new StringReplacement("ImagingObjectSelection", "IOS")); abbrevs.add(new StringReplacement("ImagingObjectSelection", "IOS"));
abbrevs.add(new StringReplacement("administrationGuidelines.patientCharacteristics", "ag.pc")); abbrevs.add(new StringReplacement("administrationGuidelines.patientCharacteristics", "ag.pc"));
abbrevs.add(new StringReplacement("manufacturingBusinessOperation", "mbo")); abbrevs.add(new StringReplacement("manufacturingBusinessOperation", "mbo"));
@ -343,18 +324,18 @@ public class ExtensionDefinitionGenerator {
abbrevs.add(new StringReplacement("structuralRepresentation", "sr")); abbrevs.add(new StringReplacement("structuralRepresentation", "sr"));
abbrevs.add(new StringReplacement("compareToSourceExpression", "ctse")); abbrevs.add(new StringReplacement("compareToSourceExpression", "ctse"));
abbrevs.add(new StringReplacement("TestScript.setup.action.assert", "TestScript.s.a.a")); abbrevs.add(new StringReplacement("TestScript.setup.action.assert", "TestScript.s.a.a"));
for (StringReplacement s : abbrevs) for (StringReplacement s : abbrevs)
if (id.contains(s.source)) if (id.contains(s.getSource()))
id = id.replace(s.source,s.replacement); id = id.replace(s.getSource(), s.getReplacement());
if (id.length() > 64) if (id.length() > 64)
throw new Error("Still too long: "+id); throw new Error("Still too long: " + id);
return id; return id;
} }
private String timezone() { private String timezone() {
TimeZone tz = TimeZone.getDefault(); TimeZone tz = TimeZone.getDefault();
Calendar cal = GregorianCalendar.getInstance(tz); Calendar cal = GregorianCalendar.getInstance(tz);
int offsetInMillis = tz.getOffset(cal.getTimeInMillis()); int offsetInMillis = tz.getOffset(cal.getTimeInMillis());
@ -366,15 +347,15 @@ public class ExtensionDefinitionGenerator {
private void savePackage(List<StructureDefinition> extensions) throws FHIRException, IOException { private void savePackage(List<StructureDefinition> extensions) throws FHIRException, IOException {
JsonObject npm = new JsonObject(); JsonObject npm = new JsonObject();
npm.addProperty("name", "hl7.fhir.extensions.r"+sourceVersion.toCode(1)); npm.addProperty("name", "hl7.fhir.extensions.r" + sourceVersion.toCode(1));
npm.addProperty("version", targetVersion.toCode(3)); npm.addProperty("version", targetVersion.toCode(3));
npm.addProperty("tools-version", ToolsVersion.TOOLS_VERSION); npm.addProperty("tools-version", ToolsVersion.TOOLS_VERSION);
npm.addProperty("type", PackageType.IG.getCode()); npm.addProperty("type", PackageType.IG.getCode());
npm.addProperty("license", SPDXLicense.CC01_0.toCode()); npm.addProperty("license", SPDXLicense.CC01_0.toCode());
npm.addProperty("canonical", "http://hl7.org/fhir/"+sourceVersion.toCode(3)+"/extensions/"+targetVersion.toCode(3)); npm.addProperty("canonical", "http://hl7.org/fhir/" + sourceVersion.toCode(3) + "/extensions/" + targetVersion.toCode(3));
npm.addProperty("url", "http://hl7.org/fhir/"+sourceVersion.toCode(3)+"/extensions/"+targetVersion.toCode(3)); npm.addProperty("url", "http://hl7.org/fhir/" + sourceVersion.toCode(3) + "/extensions/" + targetVersion.toCode(3));
npm.addProperty("title", "Extension Definitions for representing elements from "+sourceVersion.toCode()+" in "+targetVersion.toCode()); npm.addProperty("title", "Extension Definitions for representing elements from " + sourceVersion.toCode() + " in " + targetVersion.toCode());
npm.addProperty("description", "Extension Definitions for representing elements from "+sourceVersion.toCode()+" in "+targetVersion.toCode()+" built "+new SimpleDateFormat("EEE, MMM d, yyyy HH:mmZ", new Locale("en", "US")).format(Calendar.getInstance().getTime())+timezone()+")"); npm.addProperty("description", "Extension Definitions for representing elements from " + sourceVersion.toCode() + " in " + targetVersion.toCode() + " built " + new SimpleDateFormat("EEE, MMM d, yyyy HH:mmZ", new Locale("en", "US")).format(Calendar.getInstance().getTime()) + timezone() + ")");
JsonObject dep = new JsonObject(); JsonObject dep = new JsonObject();
npm.add("dependencies", dep); npm.add("dependencies", dep);
dep.addProperty("hl7.fhir.core", targetVersion.toCode()); dep.addProperty("hl7.fhir.core", targetVersion.toCode());
@ -386,8 +367,8 @@ public class ExtensionDefinitionGenerator {
md.addProperty("url", "http://hl7.org/fhir"); md.addProperty("url", "http://hl7.org/fhir");
NPMPackageGenerator pi = new NPMPackageGenerator(filename, npm); NPMPackageGenerator pi = new NPMPackageGenerator(filename, npm);
for (StructureDefinition sd : extensions) { for (StructureDefinition sd : extensions) {
byte[] cnt = saveResource(sd, targetVersion); byte[] cnt = saveResource(sd, targetVersion);
pi.addFile(Category.RESOURCE, "StructureDefinition-"+sd.getId()+".json", cnt); pi.addFile(Category.RESOURCE, "StructureDefinition-" + sd.getId() + ".json", cnt);
} }
pi.finish(); pi.finish();
@ -406,15 +387,15 @@ public class ExtensionDefinitionGenerator {
context = SimpleWorkerContext.fromPackage(npm, new R2016MayToR4Loader()); context = SimpleWorkerContext.fromPackage(npm, new R2016MayToR4Loader());
else if (sourceVersion == FHIRVersion._1_0_2) else if (sourceVersion == FHIRVersion._1_0_2)
context = SimpleWorkerContext.fromPackage(npm, new R2ToR4Loader()); context = SimpleWorkerContext.fromPackage(npm, new R2ToR4Loader());
pu = new ProfileUtilities(context, null, null); pu = new ProfileUtilities(context, null, null);
for (String fn : npm.listResources("StructureDefinition")) { for (String fn : npm.listResources("StructureDefinition")) {
list.add((StructureDefinition) loadResource(npm.load("package", fn), sourceVersion)); list.add((StructureDefinition) loadResource(npm.load("package", fn), sourceVersion));
} }
for (StructureDefinition sd : list) for (StructureDefinition sd : list)
if (sd.getName().equals("Extension")) { if (sd.getName().equals("Extension")) {
extbase = sd; extbase = sd;
extv = extbase.getSnapshot().getElement().get(extbase.getSnapshot().getElement().size() -1); extv = extbase.getSnapshot().getElement().get(extbase.getSnapshot().getElement().size() - 1);
} }
return list; return list;
} }
@ -432,7 +413,7 @@ public class ExtensionDefinitionGenerator {
} else if (v == FHIRVersion._4_0_0) { } else if (v == FHIRVersion._4_0_0) {
return new JsonParser().composeBytes(resource); return new JsonParser().composeBytes(resource);
} else } else
throw new Error("Unsupported version "+v); throw new Error("Unsupported version " + v);
} }
private Resource loadResource(InputStream inputStream, FHIRVersion v) throws IOException, FHIRException { private Resource loadResource(InputStream inputStream, FHIRVersion v) throws IOException, FHIRException {
@ -449,7 +430,7 @@ public class ExtensionDefinitionGenerator {
} else if (v == FHIRVersion._4_0_0) { } else if (v == FHIRVersion._4_0_0) {
return new JsonParser().parse(inputStream); return new JsonParser().parse(inputStream);
} else } else
throw new Error("Unsupported version "+v); throw new Error("Unsupported version " + v);
} }
} }

View File

@ -29,8 +29,6 @@ package org.hl7.fhir.convertors;
*/ */
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
@ -89,26 +87,6 @@ import org.hl7.fhir.utilities.TextFile;
*/ */
public class R2R3ConversionManager implements ITransformerServices { public class R2R3ConversionManager implements ITransformerServices {
public class TransformContext {
private SimpleWorkerContext context;
private String id;
public TransformContext(SimpleWorkerContext context, String id) {
this.context = context;
this.id = id;
}
public SimpleWorkerContext getContext() {
return context;
}
public String getId() {
return id;
}
}
private SimpleWorkerContext contextR2; private SimpleWorkerContext contextR2;
private SimpleWorkerContext contextR3; private SimpleWorkerContext contextR3;
private Map<String, StructureMap> library = new HashMap<String, StructureMap>(); private Map<String, StructureMap> library = new HashMap<String, StructureMap>();
@ -288,7 +266,7 @@ public class R2R3ConversionManager implements ITransformerServices {
throw new FHIRException("No Map Found from R2 to R3 for "+r2.fhirType()); throw new FHIRException("No Map Found from R2 to R3 for "+r2.fhirType());
String tn = smu3.getTargetType(map).getType(); String tn = smu3.getTargetType(map).getType();
Resource r3 = ResourceFactory.createResource(tn); Resource r3 = ResourceFactory.createResource(tn);
smu3.transform(new TransformContext(contextR3, r2.getChildValue("id")), r2, map, r3); smu3.transform(new TransformContextR2R3(contextR3, r2.getChildValue("id")), r2, map, r3);
FormatUtilities.makeParser(format).setOutputStyle(style).compose(dest, r3); FormatUtilities.makeParser(format).setOutputStyle(style).compose(dest, r3);
} }
@ -309,7 +287,7 @@ public class R2R3ConversionManager implements ITransformerServices {
@Override @Override
public Base createType(Object appInfo, String name) throws FHIRException { public Base createType(Object appInfo, String name) throws FHIRException {
SimpleWorkerContext context = ((TransformContext) appInfo).getContext(); SimpleWorkerContext context = ((TransformContextR2R3) appInfo).getContext();
if (context == contextR2) { if (context == contextR2) {
StructureDefinition sd = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/DSTU2/StructureDefinition/"+name); StructureDefinition sd = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/DSTU2/StructureDefinition/"+name);
if (sd == null) if (sd == null)
@ -324,7 +302,7 @@ public class R2R3ConversionManager implements ITransformerServices {
if (res instanceof Resource && (res.fhirType().equals("CodeSystem") || res.fhirType().equals("CareTeam")) || res.fhirType().equals("PractitionerRole")) { if (res instanceof Resource && (res.fhirType().equals("CodeSystem") || res.fhirType().equals("CareTeam")) || res.fhirType().equals("PractitionerRole")) {
Resource r = (Resource) res; Resource r = (Resource) res;
extras.add(r); extras.add(r);
r.setId(((TransformContext) appInfo).getId()+"-"+extras.size()); //todo: get this into appinfo r.setId(((TransformContextR2R3) appInfo).getId()+"-"+extras.size()); //todo: get this into appinfo
} }
return res; return res;
} }

View File

@ -1,5 +1,6 @@
package org.hl7.fhir.convertors; package org.hl7.fhir.convertors;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor30;
import org.hl7.fhir.convertors.conv10_30.*; import org.hl7.fhir.convertors.conv10_30.*;
import org.hl7.fhir.dstu2.model.CodeableConcept; import org.hl7.fhir.dstu2.model.CodeableConcept;
import org.hl7.fhir.dstu2.utils.ToolingExtensions; import org.hl7.fhir.dstu2.utils.ToolingExtensions;
@ -7,7 +8,6 @@ import org.hl7.fhir.dstu3.conformance.ProfileUtilities;
import org.hl7.fhir.dstu3.model.CodeSystem; import org.hl7.fhir.dstu3.model.CodeSystem;
import org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent; import org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent;
import org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent; import org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent;
import org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent;
import org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent; import org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent;
import org.hl7.fhir.dstu3.terminologies.CodeSystemUtilities; import org.hl7.fhir.dstu3.terminologies.CodeSystemUtilities;
import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRException;
@ -2351,19 +2351,6 @@ public class VersionConvertor_10_30 extends VersionConvertor_Base {
return tgt; return tgt;
} }
static public class SourceElementComponentWrapper {
public SourceElementComponentWrapper(SourceElementComponent comp, String source, String target) {
super();
this.source = source;
this.target = target;
this.comp = comp;
}
public String source;
public String target;
public org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent comp;
}
public static org.hl7.fhir.dstu3.model.UsageContext convertCodeableConceptToUsageContext(org.hl7.fhir.dstu2.model.CodeableConcept t) throws FHIRException { public static org.hl7.fhir.dstu3.model.UsageContext convertCodeableConceptToUsageContext(org.hl7.fhir.dstu2.model.CodeableConcept t) throws FHIRException {
org.hl7.fhir.dstu3.model.UsageContext result = new org.hl7.fhir.dstu3.model.UsageContext(); org.hl7.fhir.dstu3.model.UsageContext result = new org.hl7.fhir.dstu3.model.UsageContext();
result.setValue(convertCodeableConcept(t)); result.setValue(convertCodeableConcept(t));

View File

@ -1,5 +1,6 @@
package org.hl7.fhir.convertors; package org.hl7.fhir.convertors;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import org.hl7.fhir.convertors.conv10_40.*; import org.hl7.fhir.convertors.conv10_40.*;
import org.hl7.fhir.dstu2.model.CodeableConcept; import org.hl7.fhir.dstu2.model.CodeableConcept;
import org.hl7.fhir.dstu2.model.Parameters; import org.hl7.fhir.dstu2.model.Parameters;
@ -13,7 +14,6 @@ import org.hl7.fhir.r4.model.CanonicalType;
import org.hl7.fhir.r4.model.CodeSystem; import org.hl7.fhir.r4.model.CodeSystem;
import org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent; import org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent;
import org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent; import org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent;
import org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent;
import org.hl7.fhir.r4.model.Dosage.DosageDoseAndRateComponent; import org.hl7.fhir.r4.model.Dosage.DosageDoseAndRateComponent;
import org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent; import org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent;
import org.hl7.fhir.r4.model.Immunization.ImmunizationPerformerComponent; import org.hl7.fhir.r4.model.Immunization.ImmunizationPerformerComponent;
@ -2451,19 +2451,6 @@ public class VersionConvertor_10_40 extends VersionConvertor_Base {
return tgt; return tgt;
} }
static public class SourceElementComponentWrapper {
public SourceElementComponentWrapper(SourceElementComponent comp, String source, String target) {
super();
this.source = source;
this.target = target;
this.comp = comp;
}
public String source;
public String target;
public org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent comp;
}
public static org.hl7.fhir.r4.model.UsageContext convertCodeableConceptToUsageContext(org.hl7.fhir.dstu2.model.CodeableConcept t) throws FHIRException { public static org.hl7.fhir.r4.model.UsageContext convertCodeableConceptToUsageContext(org.hl7.fhir.dstu2.model.CodeableConcept t) throws FHIRException {
org.hl7.fhir.r4.model.UsageContext result = new org.hl7.fhir.r4.model.UsageContext(); org.hl7.fhir.r4.model.UsageContext result = new org.hl7.fhir.r4.model.UsageContext();
result.setValue(convertCodeableConcept(t)); result.setValue(convertCodeableConcept(t));

View File

@ -1,5 +1,6 @@
package org.hl7.fhir.convertors; package org.hl7.fhir.convertors;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor50;
import org.hl7.fhir.convertors.conv10_50.*; import org.hl7.fhir.convertors.conv10_50.*;
import org.hl7.fhir.dstu2.model.CodeableConcept; import org.hl7.fhir.dstu2.model.CodeableConcept;
import org.hl7.fhir.dstu2.model.Parameters; import org.hl7.fhir.dstu2.model.Parameters;
@ -13,7 +14,6 @@ import org.hl7.fhir.r5.model.CodeSystem;
import org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent; import org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent;
import org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent; import org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent;
import org.hl7.fhir.r5.model.CodeableReference; import org.hl7.fhir.r5.model.CodeableReference;
import org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent;
import org.hl7.fhir.r5.model.Dosage.DosageDoseAndRateComponent; import org.hl7.fhir.r5.model.Dosage.DosageDoseAndRateComponent;
import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent; import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent;
import org.hl7.fhir.r5.model.Immunization.ImmunizationPerformerComponent; import org.hl7.fhir.r5.model.Immunization.ImmunizationPerformerComponent;
@ -2474,19 +2474,6 @@ public class VersionConvertor_10_50 extends VersionConvertor_Base {
return tgt; return tgt;
} }
static public class SourceElementComponentWrapper {
public SourceElementComponentWrapper(SourceElementComponent comp, String source, String target) {
super();
this.source = source;
this.target = target;
this.comp = comp;
}
public String source;
public String target;
public org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent comp;
}
public static org.hl7.fhir.r5.model.UsageContext convertCodeableConceptToUsageContext(org.hl7.fhir.dstu2.model.CodeableConcept t) throws FHIRException { public static org.hl7.fhir.r5.model.UsageContext convertCodeableConceptToUsageContext(org.hl7.fhir.dstu2.model.CodeableConcept t) throws FHIRException {
org.hl7.fhir.r5.model.UsageContext result = new org.hl7.fhir.r5.model.UsageContext(); org.hl7.fhir.r5.model.UsageContext result = new org.hl7.fhir.r5.model.UsageContext();
result.setValue(convertCodeableConcept(t)); result.setValue(convertCodeableConcept(t));

View File

@ -2398,19 +2398,6 @@ public class VersionConvertor_14_30 extends VersionConvertor_Base {
return result; return result;
} }
static public class SourceElementComponentWrapper {
public SourceElementComponentWrapper(SourceElementComponent comp, String source, String target) {
super();
this.source = source;
this.target = target;
this.comp = comp;
}
public String source;
public String target;
public org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent comp;
}
static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Enumerations.SearchParamType> convertSearchParamType(org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType> src) throws FHIRException { static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Enumerations.SearchParamType> convertSearchParamType(org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType> src) throws FHIRException {
if (src == null || src.isEmpty()) return null; if (src == null || src.isEmpty()) return null;
org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Enumerations.SearchParamType> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Enumerations.SearchParamTypeEnumFactory()); org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Enumerations.SearchParamType> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Enumerations.SearchParamTypeEnumFactory());

View File

@ -2513,19 +2513,6 @@ public class VersionConvertor_14_40 extends VersionConvertor_Base {
return result; return result;
} }
static public class SourceElementComponentWrapper {
public SourceElementComponentWrapper(SourceElementComponent comp, String source, String target) {
super();
this.source = source;
this.target = target;
this.comp = comp;
}
public String source;
public String target;
public org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent comp;
}
static public CanonicalType convertReferenceToCanonical(Reference src) throws FHIRException { static public CanonicalType convertReferenceToCanonical(Reference src) throws FHIRException {
CanonicalType dst = new CanonicalType(src.getReference()); CanonicalType dst = new CanonicalType(src.getReference());
copyElement(src, dst); copyElement(src, dst);

View File

@ -2536,19 +2536,6 @@ public class VersionConvertor_14_50 extends VersionConvertor_Base {
return result; return result;
} }
static public class SourceElementComponentWrapper {
public SourceElementComponentWrapper(SourceElementComponent comp, String source, String target) {
super();
this.source = source;
this.target = target;
this.comp = comp;
}
public String source;
public String target;
public org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent comp;
}
static public CanonicalType convertReferenceToCanonical(Reference src) throws FHIRException { static public CanonicalType convertReferenceToCanonical(Reference src) throws FHIRException {
CanonicalType dst = new CanonicalType(src.getReference()); CanonicalType dst = new CanonicalType(src.getReference());
copyElement(src, dst); copyElement(src, dst);

View File

@ -1,36 +1,33 @@
package org.hl7.fhir.convertors; package org.hl7.fhir.convertors.advisors;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRException;
/** /**

View File

@ -1,36 +1,33 @@
package org.hl7.fhir.convertors; package org.hl7.fhir.convertors.advisors;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRException;

View File

@ -1,5 +1,5 @@
package org.hl7.fhir.convertors; package org.hl7.fhir.convertors.advisors;
/* /*
Copyright (c) 2011+, HL7, Inc. Copyright (c) 2011+, HL7, Inc.
All rights reserved. All rights reserved.
@ -28,47 +28,44 @@ package org.hl7.fhir.convertors;
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */
import org.hl7.fhir.exceptions.FHIRException;
public interface VersionConvertorAdvisor50 {
import org.hl7.fhir.exceptions.FHIRException; /**
* when processing a bundle, and converting from R5 to R2 whether to ignore an entry in the bundle.
public interface VersionConvertorAdvisor50 { * typically, return true when it's a resource that isn't handled, and you don't care.
/** *
* when processing a bundle, and converting from R5 to R2 whether to ignore an entry in the bundle. * by default, always return false unless you know why not do this
* typically, return true when it's a resource that isn't handled, and you don't care. *
* * todo: why only R2? generalise this to all targets
* by default, always return false unless you know why not do this *
* * @param src
* todo: why only R2? generalise this to all targets * @return
* */
* @param src boolean ignoreEntry(org.hl7.fhir.r5.model.Bundle.BundleEntryComponent src);
* @return
*/ /**
boolean ignoreEntry(org.hl7.fhir.r5.model.Bundle.BundleEntryComponent src); * In R2, code systems are internal to value sets, but in subsequent versions, they
* exist as separate resources. The convertor will create the code system, and then
/** * call this routine for the host to decide what to do with it
* In R2, code systems are internal to value sets, but in subsequent versions, they *
* exist as separate resources. The convertor will create the code system, and then * It can make it a contained resource, or it can put it somewhere else
* call this routine for the host to decide what to do with it *
* * @param tgtcs
* It can make it a contained resource, or it can put it somewhere else * @param source
* * @throws FHIRException
* @param tgtcs */
* @param source void handleCodeSystem(org.hl7.fhir.r5.model.CodeSystem tgtcs, org.hl7.fhir.r5.model.ValueSet source) throws FHIRException;
* @throws FHIRException
*/ /**
void handleCodeSystem(org.hl7.fhir.r5.model.CodeSystem tgtcs, org.hl7.fhir.r5.model.ValueSet source) throws FHIRException; * when converting from R5 to R2, and converting a value set, the convertor will need
* to find the code system a value set is referring to, so it can include it inline.
/** *
* when converting from R5 to R2, and converting a value set, the convertor will need * This routine should find the actual resource
* to find the code system a value set is referring to, so it can include it inline. *
* * @param src
* This routine should find the actual resource * @return
* * @throws FHIRException
* @param src */
* @return org.hl7.fhir.r5.model.CodeSystem getCodeSystem(org.hl7.fhir.r5.model.ValueSet src) throws FHIRException;
* @throws FHIRException
*/
org.hl7.fhir.r5.model.CodeSystem getCodeSystem(org.hl7.fhir.r5.model.ValueSet src) throws FHIRException;
} }

View File

@ -1,6 +1,6 @@
package org.hl7.fhir.convertors.conv10_30; package org.hl7.fhir.convertors.conv10_30;
import org.hl7.fhir.convertors.VersionConvertorAdvisor30; import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor30;
import org.hl7.fhir.convertors.VersionConvertor_10_30; import org.hl7.fhir.convertors.VersionConvertor_10_30;
import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRException;

View File

@ -2,6 +2,8 @@ package org.hl7.fhir.convertors.conv10_30;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.hl7.fhir.convertors.SourceElementComponentWrapper;
import org.hl7.fhir.convertors.VersionConvertor_10_30; import org.hl7.fhir.convertors.VersionConvertor_10_30;
import org.hl7.fhir.dstu3.model.ConceptMap; import org.hl7.fhir.dstu3.model.ConceptMap;
import org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent; import org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent;
@ -85,8 +87,8 @@ public class ConceptMap10_30 {
if (src.hasTarget()) if (src.hasTarget())
tgt.setTarget(VersionConvertor_10_30.convertType(src.getTarget())); tgt.setTarget(VersionConvertor_10_30.convertType(src.getTarget()));
for (org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent t : src.getElement()) { for (org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent t : src.getElement()) {
List<VersionConvertor_10_30.SourceElementComponentWrapper> ws = convertSourceElementComponent(t); List<SourceElementComponentWrapper<ConceptMap.SourceElementComponent>> ws = convertSourceElementComponent(t);
for (VersionConvertor_10_30.SourceElementComponentWrapper w : ws) getGroup(tgt, w.source, w.target).addElement(w.comp); for (SourceElementComponentWrapper<ConceptMap.SourceElementComponent> w : ws) getGroup(tgt, w.getSource(), w.getTarget()).addElement(w.getComp());
} }
return tgt; return tgt;
} }
@ -221,8 +223,8 @@ public class ConceptMap10_30 {
return tgt; return tgt;
} }
public static List<VersionConvertor_10_30.SourceElementComponentWrapper> convertSourceElementComponent(org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent src) throws FHIRException { public static List<SourceElementComponentWrapper<ConceptMap.SourceElementComponent>> convertSourceElementComponent(org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent src) throws FHIRException {
List<VersionConvertor_10_30.SourceElementComponentWrapper> res = new ArrayList<VersionConvertor_10_30.SourceElementComponentWrapper>(); List<SourceElementComponentWrapper<ConceptMap.SourceElementComponent>> res = new ArrayList<>();
if (src == null || src.isEmpty()) if (src == null || src.isEmpty())
return res; return res;
for (org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent t : src.getTarget()) { for (org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent t : src.getTarget()) {
@ -230,7 +232,7 @@ public class ConceptMap10_30 {
VersionConvertor_10_30.copyElement(src, tgt); VersionConvertor_10_30.copyElement(src, tgt);
tgt.setCode(src.getCode()); tgt.setCode(src.getCode());
tgt.addTarget(convertTargetElementComponent(t)); tgt.addTarget(convertTargetElementComponent(t));
res.add(new VersionConvertor_10_30.SourceElementComponentWrapper(tgt, src.getCodeSystem(), t.getCodeSystem())); res.add(new SourceElementComponentWrapper<>(tgt, src.getCodeSystem(), t.getCodeSystem()));
} }
return res; return res;
} }

View File

@ -1,7 +1,7 @@
package org.hl7.fhir.convertors.conv10_30; package org.hl7.fhir.convertors.conv10_30;
import java.util.List; import java.util.List;
import org.hl7.fhir.convertors.VersionConvertorAdvisor30; import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor30;
import org.hl7.fhir.convertors.VersionConvertor_10_30; import org.hl7.fhir.convertors.VersionConvertor_10_30;
import org.hl7.fhir.dstu2.model.ValueSet; import org.hl7.fhir.dstu2.model.ValueSet;
import org.hl7.fhir.dstu3.model.CodeSystem; import org.hl7.fhir.dstu3.model.CodeSystem;
@ -225,6 +225,7 @@ public class ValueSet10_30 {
tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); tgt.setCompose(convertValueSetComposeComponent(src.getCompose()));
tgt.getCompose().setLockedDate(src.getLockedDate()); tgt.getCompose().setLockedDate(src.getLockedDate());
} }
//TODO
if (src.hasCodeSystem() && advisor != null) { if (src.hasCodeSystem() && advisor != null) {
org.hl7.fhir.dstu3.model.CodeSystem tgtcs = new org.hl7.fhir.dstu3.model.CodeSystem(); org.hl7.fhir.dstu3.model.CodeSystem tgtcs = new org.hl7.fhir.dstu3.model.CodeSystem();
VersionConvertor_10_30.copyDomainResource(src, tgtcs); VersionConvertor_10_30.copyDomainResource(src, tgtcs);

View File

@ -1,6 +1,6 @@
package org.hl7.fhir.convertors.conv10_40; package org.hl7.fhir.convertors.conv10_40;
import org.hl7.fhir.convertors.VersionConvertorAdvisor40; import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import org.hl7.fhir.convertors.VersionConvertor_10_40; import org.hl7.fhir.convertors.VersionConvertor_10_40;
import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRException;

View File

@ -2,6 +2,8 @@ package org.hl7.fhir.convertors.conv10_40;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.hl7.fhir.convertors.SourceElementComponentWrapper;
import org.hl7.fhir.convertors.VersionConvertor_10_40; import org.hl7.fhir.convertors.VersionConvertor_10_40;
import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r4.model.CanonicalType; import org.hl7.fhir.r4.model.CanonicalType;
@ -47,8 +49,8 @@ public class ConceptMap10_40 {
r = VersionConvertor_10_40.convertType(src.getTarget()); r = VersionConvertor_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<VersionConvertor_10_40.SourceElementComponentWrapper> ws = convertSourceElementComponent(t); List<SourceElementComponentWrapper<ConceptMap.SourceElementComponent>> ws = convertSourceElementComponent(t);
for (VersionConvertor_10_40.SourceElementComponentWrapper w : ws) getGroup(tgt, w.source, w.target).addElement(w.comp); for (SourceElementComponentWrapper<ConceptMap.SourceElementComponent> w : ws) getGroup(tgt, w.getSource(), w.getTarget()).addElement(w.getComp());
} }
return tgt; return tgt;
} }
@ -222,8 +224,8 @@ public class ConceptMap10_40 {
return tgt; return tgt;
} }
public static List<VersionConvertor_10_40.SourceElementComponentWrapper> convertSourceElementComponent(org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent src) throws FHIRException { public static List<SourceElementComponentWrapper<ConceptMap.SourceElementComponent>> convertSourceElementComponent(org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent src) throws FHIRException {
List<VersionConvertor_10_40.SourceElementComponentWrapper> res = new ArrayList<VersionConvertor_10_40.SourceElementComponentWrapper>(); List<SourceElementComponentWrapper<ConceptMap.SourceElementComponent>> res = new ArrayList<>();
if (src == null || src.isEmpty()) if (src == null || src.isEmpty())
return res; return res;
for (org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent t : src.getTarget()) { for (org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent t : src.getTarget()) {
@ -231,7 +233,7 @@ public class ConceptMap10_40 {
VersionConvertor_10_40.copyElement(src, tgt); VersionConvertor_10_40.copyElement(src, tgt);
tgt.setCode(src.getCode()); tgt.setCode(src.getCode());
tgt.addTarget(convertTargetElementComponent(t)); tgt.addTarget(convertTargetElementComponent(t));
res.add(new VersionConvertor_10_40.SourceElementComponentWrapper(tgt, src.getCodeSystem(), t.getCodeSystem())); res.add(new SourceElementComponentWrapper<>(tgt, src.getCodeSystem(), t.getCodeSystem()));
} }
return res; return res;
} }

View File

@ -1,7 +1,7 @@
package org.hl7.fhir.convertors.conv10_40; package org.hl7.fhir.convertors.conv10_40;
import java.util.List; import java.util.List;
import org.hl7.fhir.convertors.VersionConvertorAdvisor40; import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import org.hl7.fhir.convertors.VersionConvertor_10_40; import org.hl7.fhir.convertors.VersionConvertor_10_40;
import org.hl7.fhir.dstu2.model.ValueSet; import org.hl7.fhir.dstu2.model.ValueSet;
import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRException;

View File

@ -1,6 +1,6 @@
package org.hl7.fhir.convertors.conv10_50; package org.hl7.fhir.convertors.conv10_50;
import org.hl7.fhir.convertors.VersionConvertorAdvisor50; import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor50;
import org.hl7.fhir.convertors.VersionConvertor_10_50; import org.hl7.fhir.convertors.VersionConvertor_10_50;
import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRException;

View File

@ -2,6 +2,8 @@ package org.hl7.fhir.convertors.conv10_50;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.hl7.fhir.convertors.SourceElementComponentWrapper;
import org.hl7.fhir.convertors.VersionConvertorConstants; import org.hl7.fhir.convertors.VersionConvertorConstants;
import org.hl7.fhir.convertors.VersionConvertor_10_50; import org.hl7.fhir.convertors.VersionConvertor_10_50;
import org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence; import org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence;
@ -53,8 +55,8 @@ public class ConceptMap10_50 {
r = VersionConvertor_10_50.convertType(src.getTarget()); r = VersionConvertor_10_50.convertType(src.getTarget());
tgt.setTarget(r instanceof org.hl7.fhir.r5.model.Reference ? new CanonicalType(((org.hl7.fhir.r5.model.Reference) r).getReference()) : r); tgt.setTarget(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<VersionConvertor_10_50.SourceElementComponentWrapper> ws = convertSourceElementComponent(t); List<SourceElementComponentWrapper<ConceptMap.SourceElementComponent>> ws = convertSourceElementComponent(t);
for (VersionConvertor_10_50.SourceElementComponentWrapper w : ws) getGroup(tgt, w.source, w.target).addElement(w.comp); for (SourceElementComponentWrapper<ConceptMap.SourceElementComponent> w : ws) getGroup(tgt, w.getSource(), w.getTarget()).addElement(w.getComp());
} }
return tgt; return tgt;
} }
@ -236,8 +238,8 @@ public class ConceptMap10_50 {
return tgt; return tgt;
} }
public static List<VersionConvertor_10_50.SourceElementComponentWrapper> convertSourceElementComponent(org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent src) throws FHIRException { public static List<SourceElementComponentWrapper<ConceptMap.SourceElementComponent>> convertSourceElementComponent(org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent src) throws FHIRException {
List<VersionConvertor_10_50.SourceElementComponentWrapper> res = new ArrayList<VersionConvertor_10_50.SourceElementComponentWrapper>(); List<SourceElementComponentWrapper<ConceptMap.SourceElementComponent>> res = new ArrayList<>();
if (src == null || src.isEmpty()) if (src == null || src.isEmpty())
return res; return res;
for (org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent t : src.getTarget()) { for (org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent t : src.getTarget()) {
@ -249,7 +251,7 @@ public class ConceptMap10_50 {
} else { } else {
tgt.addTarget(convertTargetElementComponent(t)); tgt.addTarget(convertTargetElementComponent(t));
} }
res.add(new VersionConvertor_10_50.SourceElementComponentWrapper(tgt, src.getCodeSystem(), t.getCodeSystem())); res.add(new SourceElementComponentWrapper<>(tgt, src.getCodeSystem(), t.getCodeSystem()));
} }
return res; return res;
} }

View File

@ -1,7 +1,7 @@
package org.hl7.fhir.convertors.conv10_50; package org.hl7.fhir.convertors.conv10_50;
import java.util.List; import java.util.List;
import org.hl7.fhir.convertors.VersionConvertorAdvisor50; import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor50;
import org.hl7.fhir.convertors.VersionConvertor_10_50; import org.hl7.fhir.convertors.VersionConvertor_10_50;
import org.hl7.fhir.dstu2.model.ValueSet; import org.hl7.fhir.dstu2.model.ValueSet;
import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRException;

View File

@ -2,6 +2,8 @@ package org.hl7.fhir.convertors.conv14_30;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.hl7.fhir.convertors.SourceElementComponentWrapper;
import org.hl7.fhir.convertors.VersionConvertor_14_30; import org.hl7.fhir.convertors.VersionConvertor_14_30;
import org.hl7.fhir.dstu3.model.ConceptMap; import org.hl7.fhir.dstu3.model.ConceptMap;
import org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent; import org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent;
@ -85,8 +87,8 @@ public class ConceptMap14_30 {
if (src.hasTarget()) if (src.hasTarget())
tgt.setTarget(VersionConvertor_14_30.convertType(src.getTarget())); tgt.setTarget(VersionConvertor_14_30.convertType(src.getTarget()));
for (org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent t : src.getElement()) { for (org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent t : src.getElement()) {
List<VersionConvertor_14_30.SourceElementComponentWrapper> ws = convertSourceElementComponent(t); List<SourceElementComponentWrapper<ConceptMap.SourceElementComponent>> ws = convertSourceElementComponent(t);
for (VersionConvertor_14_30.SourceElementComponentWrapper w : ws) getGroup(tgt, w.source, w.target).addElement(w.comp); for (SourceElementComponentWrapper<ConceptMap.SourceElementComponent> w : ws) getGroup(tgt, w.getSource(), w.getTarget()).addElement(w.getComp());
} }
return tgt; return tgt;
} }
@ -234,8 +236,8 @@ public class ConceptMap14_30 {
return tgt; return tgt;
} }
public static List<VersionConvertor_14_30.SourceElementComponentWrapper> convertSourceElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent src) throws FHIRException { public static List<SourceElementComponentWrapper<ConceptMap.SourceElementComponent>> convertSourceElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent src) throws FHIRException {
List<VersionConvertor_14_30.SourceElementComponentWrapper> res = new ArrayList<VersionConvertor_14_30.SourceElementComponentWrapper>(); List<SourceElementComponentWrapper<ConceptMap.SourceElementComponent>> res = new ArrayList<>();
if (src == null || src.isEmpty()) if (src == null || src.isEmpty())
return res; return res;
for (org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent t : src.getTarget()) { for (org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent t : src.getTarget()) {
@ -244,7 +246,7 @@ public class ConceptMap14_30 {
if (src.hasCode()) if (src.hasCode())
tgt.setCode(src.getCode()); tgt.setCode(src.getCode());
tgt.addTarget(convertTargetElementComponent(t)); tgt.addTarget(convertTargetElementComponent(t));
res.add(new VersionConvertor_14_30.SourceElementComponentWrapper(tgt, src.getSystem(), t.getSystem())); res.add(new SourceElementComponentWrapper<>(tgt, src.getSystem(), t.getSystem()));
} }
return res; return res;
} }

View File

@ -2,6 +2,8 @@ package org.hl7.fhir.convertors.conv14_40;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.hl7.fhir.convertors.SourceElementComponentWrapper;
import org.hl7.fhir.convertors.VersionConvertor_14_40; import org.hl7.fhir.convertors.VersionConvertor_14_40;
import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r4.model.CanonicalType; import org.hl7.fhir.r4.model.CanonicalType;
@ -47,8 +49,8 @@ public class ConceptMap14_40 {
tt = VersionConvertor_14_40.convertType(src.getTarget()); tt = VersionConvertor_14_40.convertType(src.getTarget());
tgt.setTarget(tt instanceof org.hl7.fhir.r4.model.Reference ? new CanonicalType(((org.hl7.fhir.r4.model.Reference) tt).getReference()) : tt); tgt.setTarget(tt instanceof org.hl7.fhir.r4.model.Reference ? new CanonicalType(((org.hl7.fhir.r4.model.Reference) tt).getReference()) : tt);
for (org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent t : src.getElement()) { for (org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent t : src.getElement()) {
List<VersionConvertor_14_40.SourceElementComponentWrapper> ws = convertSourceElementComponent(t); List<SourceElementComponentWrapper<ConceptMap.SourceElementComponent>> ws = convertSourceElementComponent(t);
for (VersionConvertor_14_40.SourceElementComponentWrapper w : ws) getGroup(tgt, w.source, w.target).addElement(w.comp); for (SourceElementComponentWrapper<ConceptMap.SourceElementComponent> w : ws) getGroup(tgt, w.getSource(), w.getTarget()).addElement(w.getComp());
} }
return tgt; return tgt;
} }
@ -230,8 +232,8 @@ public class ConceptMap14_40 {
return tgt; return tgt;
} }
public static List<VersionConvertor_14_40.SourceElementComponentWrapper> convertSourceElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent src) throws FHIRException { public static List<SourceElementComponentWrapper<ConceptMap.SourceElementComponent>> convertSourceElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent src) throws FHIRException {
List<VersionConvertor_14_40.SourceElementComponentWrapper> res = new ArrayList<VersionConvertor_14_40.SourceElementComponentWrapper>(); List<SourceElementComponentWrapper<ConceptMap.SourceElementComponent>> res = new ArrayList<>();
if (src == null || src.isEmpty()) if (src == null || src.isEmpty())
return res; return res;
for (org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent t : src.getTarget()) { for (org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent t : src.getTarget()) {
@ -240,7 +242,7 @@ public class ConceptMap14_40 {
if (src.hasCode()) if (src.hasCode())
tgt.setCode(src.getCode()); tgt.setCode(src.getCode());
tgt.addTarget(convertTargetElementComponent(t)); tgt.addTarget(convertTargetElementComponent(t));
res.add(new VersionConvertor_14_40.SourceElementComponentWrapper(tgt, src.getSystem(), t.getSystem())); res.add(new SourceElementComponentWrapper<>(tgt, src.getSystem(), t.getSystem()));
} }
return res; return res;
} }

View File

@ -2,6 +2,8 @@ package org.hl7.fhir.convertors.conv14_50;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.hl7.fhir.convertors.SourceElementComponentWrapper;
import org.hl7.fhir.convertors.VersionConvertorConstants; import org.hl7.fhir.convertors.VersionConvertorConstants;
import org.hl7.fhir.convertors.VersionConvertor_14_50; import org.hl7.fhir.convertors.VersionConvertor_14_50;
import org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence; import org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence;
@ -53,8 +55,8 @@ public class ConceptMap14_50 {
tt = VersionConvertor_14_50.convertType(src.getTarget()); tt = VersionConvertor_14_50.convertType(src.getTarget());
tgt.setTarget(tt instanceof org.hl7.fhir.r5.model.Reference ? new CanonicalType(((org.hl7.fhir.r5.model.Reference) tt).getReference()) : tt); tgt.setTarget(tt instanceof org.hl7.fhir.r5.model.Reference ? new CanonicalType(((org.hl7.fhir.r5.model.Reference) tt).getReference()) : tt);
for (org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent t : src.getElement()) { for (org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent t : src.getElement()) {
List<VersionConvertor_14_50.SourceElementComponentWrapper> ws = convertSourceElementComponent(t); List<SourceElementComponentWrapper<ConceptMap.SourceElementComponent>> ws = convertSourceElementComponent(t);
for (VersionConvertor_14_50.SourceElementComponentWrapper w : ws) getGroup(tgt, w.source, w.target).addElement(w.comp); for (SourceElementComponentWrapper<ConceptMap.SourceElementComponent> w : ws) getGroup(tgt, w.getSource(), w.getTarget()).addElement(w.getComp());
} }
return tgt; return tgt;
} }
@ -228,8 +230,8 @@ public class ConceptMap14_50 {
return tgt; return tgt;
} }
public static List<VersionConvertor_14_50.SourceElementComponentWrapper> convertSourceElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent src) throws FHIRException { public static List<SourceElementComponentWrapper<ConceptMap.SourceElementComponent>> convertSourceElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent src) throws FHIRException {
List<VersionConvertor_14_50.SourceElementComponentWrapper> res = new ArrayList<VersionConvertor_14_50.SourceElementComponentWrapper>(); List<SourceElementComponentWrapper<ConceptMap.SourceElementComponent>> res = new ArrayList<>();
if (src == null || src.isEmpty()) if (src == null || src.isEmpty())
return res; return res;
for (org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent t : src.getTarget()) { for (org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent t : src.getTarget()) {
@ -242,7 +244,7 @@ public class ConceptMap14_50 {
} else { } else {
tgt.addTarget(convertTargetElementComponent(t)); tgt.addTarget(convertTargetElementComponent(t));
} }
res.add(new VersionConvertor_14_50.SourceElementComponentWrapper(tgt, src.getSystem(), t.getSystem())); res.add(new SourceElementComponentWrapper<>(tgt, src.getSystem(), t.getSystem()));
} }
return res; return res;
} }

View File

@ -37,7 +37,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import org.hl7.fhir.convertors.VersionConvertorAdvisor40; import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import org.hl7.fhir.convertors.VersionConvertor_14_40; import org.hl7.fhir.convertors.VersionConvertor_14_40;
import org.hl7.fhir.dstu2016may.formats.JsonParser; import org.hl7.fhir.dstu2016may.formats.JsonParser;
import org.hl7.fhir.dstu2016may.formats.XmlParser; import org.hl7.fhir.dstu2016may.formats.XmlParser;

View File

@ -37,14 +37,13 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import org.hl7.fhir.convertors.VersionConvertorAdvisor50; import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor50;
import org.hl7.fhir.convertors.VersionConvertor_14_50; import org.hl7.fhir.convertors.VersionConvertor_14_50;
import org.hl7.fhir.dstu2016may.formats.JsonParser; import org.hl7.fhir.dstu2016may.formats.JsonParser;
import org.hl7.fhir.dstu2016may.formats.XmlParser; import org.hl7.fhir.dstu2016may.formats.XmlParser;
import org.hl7.fhir.dstu2016may.model.Resource; import org.hl7.fhir.dstu2016may.model.Resource;
import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.conformance.ProfileUtilities; import org.hl7.fhir.r5.conformance.ProfileUtilities;
import org.hl7.fhir.r5.context.IWorkerContext.IContextResourceLoader;
import org.hl7.fhir.r5.model.Bundle; import org.hl7.fhir.r5.model.Bundle;
import org.hl7.fhir.r5.model.Bundle.BundleEntryComponent; import org.hl7.fhir.r5.model.Bundle.BundleEntryComponent;
import org.hl7.fhir.r5.model.Bundle.BundleType; import org.hl7.fhir.r5.model.Bundle.BundleType;
@ -55,12 +54,9 @@ import org.hl7.fhir.r5.model.CodeSystem;
import org.hl7.fhir.r5.model.ElementDefinition; import org.hl7.fhir.r5.model.ElementDefinition;
import org.hl7.fhir.r5.model.StructureDefinition; import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind; import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind;
import org.hl7.fhir.utilities.npm.NpmPackage;
import org.hl7.fhir.r5.model.UriType; import org.hl7.fhir.r5.model.UriType;
import org.hl7.fhir.r5.model.ValueSet; import org.hl7.fhir.r5.model.ValueSet;
import com.google.gson.JsonSyntaxException;
public class R2016MayToR5Loader extends BaseLoaderR5 implements VersionConvertorAdvisor50 { public class R2016MayToR5Loader extends BaseLoaderR5 implements VersionConvertorAdvisor50 {
public R2016MayToR5Loader(String[] types, ILoaderKnowledgeProvider lkp) { public R2016MayToR5Loader(String[] types, ILoaderKnowledgeProvider lkp) {

View File

@ -36,13 +36,11 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import org.hl7.fhir.convertors.VersionConvertorAdvisor30; import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor30;
import org.hl7.fhir.convertors.VersionConvertor_10_30; import org.hl7.fhir.convertors.VersionConvertor_10_30;
import org.hl7.fhir.convertors.loaders.BaseLoaderR5.NullLoaderKnowledgeProvider;
import org.hl7.fhir.dstu2.formats.JsonParser; import org.hl7.fhir.dstu2.formats.JsonParser;
import org.hl7.fhir.dstu2.formats.XmlParser; import org.hl7.fhir.dstu2.formats.XmlParser;
import org.hl7.fhir.dstu2.model.Resource; import org.hl7.fhir.dstu2.model.Resource;
import org.hl7.fhir.dstu3.context.SimpleWorkerContext.IContextResourceLoader;
import org.hl7.fhir.dstu3.model.Bundle; import org.hl7.fhir.dstu3.model.Bundle;
import org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent; import org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent;
import org.hl7.fhir.dstu3.model.Bundle.BundleType; import org.hl7.fhir.dstu3.model.Bundle.BundleType;

View File

@ -37,14 +37,12 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import org.hl7.fhir.convertors.VersionConvertorAdvisor40; import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import org.hl7.fhir.convertors.VersionConvertor_10_40; import org.hl7.fhir.convertors.VersionConvertor_10_40;
import org.hl7.fhir.convertors.loaders.BaseLoaderR5.NullLoaderKnowledgeProvider;
import org.hl7.fhir.dstu2.formats.JsonParser; import org.hl7.fhir.dstu2.formats.JsonParser;
import org.hl7.fhir.dstu2.formats.XmlParser; import org.hl7.fhir.dstu2.formats.XmlParser;
import org.hl7.fhir.dstu2.model.Resource; import org.hl7.fhir.dstu2.model.Resource;
import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r4.context.SimpleWorkerContext.IContextResourceLoader;
import org.hl7.fhir.r4.model.Bundle; import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.r4.model.Bundle.BundleEntryComponent; import org.hl7.fhir.r4.model.Bundle.BundleEntryComponent;
import org.hl7.fhir.r4.model.Bundle.BundleType; import org.hl7.fhir.r4.model.Bundle.BundleType;

View File

@ -37,10 +37,8 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import org.hl7.fhir.convertors.VersionConvertorAdvisor50; import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor50;
import org.hl7.fhir.convertors.VersionConvertor_10_50; import org.hl7.fhir.convertors.VersionConvertor_10_50;
import org.hl7.fhir.convertors.loaders.BaseLoaderR5.ILoaderKnowledgeProvider;
import org.hl7.fhir.convertors.loaders.BaseLoaderR5.NullLoaderKnowledgeProvider;
import org.hl7.fhir.dstu2.formats.JsonParser; import org.hl7.fhir.dstu2.formats.JsonParser;
import org.hl7.fhir.dstu2.formats.XmlParser; import org.hl7.fhir.dstu2.formats.XmlParser;
import org.hl7.fhir.dstu2.model.Resource; import org.hl7.fhir.dstu2.model.Resource;
@ -56,12 +54,9 @@ import org.hl7.fhir.r5.model.CodeSystem;
import org.hl7.fhir.r5.model.ElementDefinition; import org.hl7.fhir.r5.model.ElementDefinition;
import org.hl7.fhir.r5.model.StructureDefinition; import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind; import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind;
import org.hl7.fhir.utilities.npm.NpmPackage;
import org.hl7.fhir.r5.model.UriType; import org.hl7.fhir.r5.model.UriType;
import org.hl7.fhir.r5.model.ValueSet; import org.hl7.fhir.r5.model.ValueSet;
import com.google.gson.JsonSyntaxException;
public class R2ToR5Loader extends BaseLoaderR5 implements IContextResourceLoader, VersionConvertorAdvisor50 { public class R2ToR5Loader extends BaseLoaderR5 implements IContextResourceLoader, VersionConvertorAdvisor50 {
public R2ToR5Loader(String[] types, ILoaderKnowledgeProvider lkp) { public R2ToR5Loader(String[] types, ILoaderKnowledgeProvider lkp) {

View File

@ -37,9 +37,8 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import org.hl7.fhir.convertors.VersionConvertorAdvisor40; import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import org.hl7.fhir.convertors.VersionConvertor_30_40; import org.hl7.fhir.convertors.VersionConvertor_30_40;
import org.hl7.fhir.convertors.loaders.BaseLoaderR5.NullLoaderKnowledgeProvider;
import org.hl7.fhir.dstu3.formats.JsonParser; import org.hl7.fhir.dstu3.formats.JsonParser;
import org.hl7.fhir.dstu3.formats.XmlParser; import org.hl7.fhir.dstu3.formats.XmlParser;
import org.hl7.fhir.dstu3.model.Resource; import org.hl7.fhir.dstu3.model.Resource;

View File

@ -37,10 +37,8 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import org.hl7.fhir.convertors.VersionConvertorAdvisor50; import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor50;
import org.hl7.fhir.convertors.VersionConvertor_30_50; import org.hl7.fhir.convertors.VersionConvertor_30_50;
import org.hl7.fhir.convertors.loaders.BaseLoaderR5.ILoaderKnowledgeProvider;
import org.hl7.fhir.convertors.loaders.BaseLoaderR5.NullLoaderKnowledgeProvider;
import org.hl7.fhir.dstu3.formats.JsonParser; import org.hl7.fhir.dstu3.formats.JsonParser;
import org.hl7.fhir.dstu3.formats.XmlParser; import org.hl7.fhir.dstu3.formats.XmlParser;
import org.hl7.fhir.dstu3.model.Resource; import org.hl7.fhir.dstu3.model.Resource;
@ -56,12 +54,9 @@ import org.hl7.fhir.r5.model.ElementDefinition;
import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent; import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent;
import org.hl7.fhir.r5.model.StructureDefinition; import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind; import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind;
import org.hl7.fhir.utilities.npm.NpmPackage;
import org.hl7.fhir.r5.model.UriType; import org.hl7.fhir.r5.model.UriType;
import org.hl7.fhir.r5.model.ValueSet; import org.hl7.fhir.r5.model.ValueSet;
import com.google.gson.JsonSyntaxException;
public class R3ToR5Loader extends BaseLoaderR5 implements IContextResourceLoader, VersionConvertorAdvisor50 { public class R3ToR5Loader extends BaseLoaderR5 implements IContextResourceLoader, VersionConvertorAdvisor50 {
public R3ToR5Loader(String[] types, ILoaderKnowledgeProvider lkp) { public R3ToR5Loader(String[] types, ILoaderKnowledgeProvider lkp) {

View File

@ -37,10 +37,8 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import org.hl7.fhir.convertors.VersionConvertorAdvisor50; import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor50;
import org.hl7.fhir.convertors.VersionConvertor_40_50; import org.hl7.fhir.convertors.VersionConvertor_40_50;
import org.hl7.fhir.convertors.loaders.BaseLoaderR5.ILoaderKnowledgeProvider;
import org.hl7.fhir.convertors.loaders.BaseLoaderR5.NullLoaderKnowledgeProvider;
import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r4.formats.JsonParser; import org.hl7.fhir.r4.formats.JsonParser;
import org.hl7.fhir.r4.formats.XmlParser; import org.hl7.fhir.r4.formats.XmlParser;
@ -56,12 +54,9 @@ import org.hl7.fhir.r5.model.ElementDefinition;
import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent; import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent;
import org.hl7.fhir.r5.model.StructureDefinition; import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind; import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind;
import org.hl7.fhir.utilities.npm.NpmPackage;
import org.hl7.fhir.r5.model.UriType; import org.hl7.fhir.r5.model.UriType;
import org.hl7.fhir.r5.model.ValueSet; import org.hl7.fhir.r5.model.ValueSet;
import com.google.gson.JsonSyntaxException;
public class R4ToR5Loader extends BaseLoaderR5 implements IContextResourceLoader, VersionConvertorAdvisor50 { public class R4ToR5Loader extends BaseLoaderR5 implements IContextResourceLoader, VersionConvertorAdvisor50 {
public R4ToR5Loader(String[] types, ILoaderKnowledgeProvider lkp) { public R4ToR5Loader(String[] types, ILoaderKnowledgeProvider lkp) {

View File

@ -37,14 +37,11 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import org.hl7.fhir.convertors.VersionConvertorAdvisor50; import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor50;
import org.hl7.fhir.convertors.loaders.BaseLoaderR5.ILoaderKnowledgeProvider;
import org.hl7.fhir.convertors.loaders.BaseLoaderR5.NullLoaderKnowledgeProvider;
import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.formats.JsonParser; import org.hl7.fhir.r5.formats.JsonParser;
import org.hl7.fhir.r5.formats.XmlParser; import org.hl7.fhir.r5.formats.XmlParser;
import org.hl7.fhir.r5.model.Resource; import org.hl7.fhir.r5.model.Resource;
import org.hl7.fhir.r5.context.IWorkerContext.IContextResourceLoader;
import org.hl7.fhir.r5.model.Bundle; import org.hl7.fhir.r5.model.Bundle;
import org.hl7.fhir.r5.model.Bundle.BundleEntryComponent; import org.hl7.fhir.r5.model.Bundle.BundleEntryComponent;
import org.hl7.fhir.r5.model.Bundle.BundleType; import org.hl7.fhir.r5.model.Bundle.BundleType;
@ -55,12 +52,9 @@ import org.hl7.fhir.r5.model.ElementDefinition;
import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent; import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent;
import org.hl7.fhir.r5.model.StructureDefinition; import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind; import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind;
import org.hl7.fhir.utilities.npm.NpmPackage;
import org.hl7.fhir.r5.model.UriType; import org.hl7.fhir.r5.model.UriType;
import org.hl7.fhir.r5.model.ValueSet; import org.hl7.fhir.r5.model.ValueSet;
import com.google.gson.JsonSyntaxException;
public class R5ToR5Loader extends BaseLoaderR5 implements VersionConvertorAdvisor50 { public class R5ToR5Loader extends BaseLoaderR5 implements VersionConvertorAdvisor50 {
public R5ToR5Loader(String[] types, ILoaderKnowledgeProvider lkp) { public R5ToR5Loader(String[] types, ILoaderKnowledgeProvider lkp) {

View File

@ -1,33 +1,33 @@
package org.hl7.fhir.convertors.misc; package org.hl7.fhir.convertors.misc;
/* /*
Copyright (c) 2011+, HL7, Inc. Copyright (c) 2011+, HL7, Inc.
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met: are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this * Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer. list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, * Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution. and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to * Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific endorse or promote products derived from this software without specific
prior written permission. prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */
@ -38,7 +38,7 @@ import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.util.Date; import java.util.Date;
import org.hl7.fhir.convertors.VersionConvertorAdvisor30; import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor30;
import org.hl7.fhir.convertors.VersionConvertor_10_30; import org.hl7.fhir.convertors.VersionConvertor_10_30;
import org.hl7.fhir.dstu2.model.Resource; import org.hl7.fhir.dstu2.model.Resource;
import org.hl7.fhir.dstu3.formats.IParser.OutputStyle; import org.hl7.fhir.dstu3.formats.IParser.OutputStyle;

View File

@ -1,35 +1,35 @@
package org.hl7.fhir.convertors.misc; package org.hl7.fhir.convertors.misc;
import org.hl7.fhir.convertors.VersionConvertorAdvisor40; import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
/* /*
Copyright (c) 2011+, HL7, Inc. Copyright (c) 2011+, HL7, Inc.
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met: are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this * Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer. list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, * Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution. and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to * Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific endorse or promote products derived from this software without specific
prior written permission. prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */

View File

@ -1,35 +1,35 @@
package org.hl7.fhir.convertors.misc; package org.hl7.fhir.convertors.misc;
import org.hl7.fhir.convertors.VersionConvertorAdvisor50; import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor50;
/* /*
Copyright (c) 2011+, HL7, Inc. Copyright (c) 2011+, HL7, Inc.
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met: are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this * Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer. list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, * Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution. and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to * Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific endorse or promote products derived from this software without specific
prior written permission. prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */

View File

@ -1,5 +1,20 @@
package org.hl7.fhir.convertors.misc; package org.hl7.fhir.convertors.misc;
import com.google.common.base.Charsets;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream;
import org.apache.commons.compress.compressors.gzip.GzipCompressorOutputStream;
import org.hl7.fhir.convertors.*;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.VersionUtilities;
import org.hl7.fhir.utilities.json.JSONUtil;
import org.hl7.fhir.utilities.json.JsonTrackingParser;
import org.hl7.fhir.utilities.npm.NpmPackageIndexBuilder;
import java.io.BufferedOutputStream; import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.FileInputStream; import java.io.FileInputStream;
@ -11,57 +26,8 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream;
import org.apache.commons.compress.compressors.gzip.GzipCompressorOutputStream;
import org.hl7.fhir.convertors.VersionConvertorAdvisor40;
import org.hl7.fhir.convertors.VersionConvertor_10_30;
import org.hl7.fhir.convertors.VersionConvertor_10_40;
import org.hl7.fhir.convertors.VersionConvertor_10_50;
import org.hl7.fhir.convertors.VersionConvertor_14_30;
import org.hl7.fhir.convertors.VersionConvertor_14_40;
import org.hl7.fhir.convertors.VersionConvertor_14_50;
import org.hl7.fhir.convertors.VersionConvertor_30_40;
import org.hl7.fhir.convertors.VersionConvertor_30_50;
import org.hl7.fhir.convertors.VersionConvertor_40_50;
import org.hl7.fhir.dstu2.model.Resource;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r4.model.Bundle.BundleEntryComponent;
import org.hl7.fhir.r4.model.CodeSystem;
import org.hl7.fhir.r4.model.ValueSet;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.VersionUtilities;
import org.hl7.fhir.utilities.json.JSONUtil;
import org.hl7.fhir.utilities.json.JsonTrackingParser;
import org.hl7.fhir.utilities.npm.NpmPackageIndexBuilder;
import com.google.common.base.Charsets;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
public class NpmPackageVersionConverter { public class NpmPackageVersionConverter {
private class PR2Handler implements VersionConvertorAdvisor40 {
@Override
public boolean ignoreEntry(BundleEntryComponent src) {
return false;
}
@Override
public void handleCodeSystem(CodeSystem tgtcs, ValueSet source) throws FHIRException {
throw new Error("Not done yet");
}
@Override
public CodeSystem getCodeSystem(ValueSet src) throws FHIRException {
throw new Error("Not done yet");
}
}
private static final int BUFFER_SIZE = 1024; private static final int BUFFER_SIZE = 1024;
private String source; private String source;
@ -70,7 +36,7 @@ public class NpmPackageVersionConverter {
private String currentVersion; private String currentVersion;
private String vCode; private String vCode;
private List<String> errors = new ArrayList<>(); private List<String> errors = new ArrayList<>();
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
NpmPackageVersionConverter self = new NpmPackageVersionConverter(args[0], args[1], args[2]); NpmPackageVersionConverter self = new NpmPackageVersionConverter(args[0], args[1], args[2]);
self.execute(); self.execute();
@ -87,9 +53,8 @@ public class NpmPackageVersionConverter {
this.vCode = version; this.vCode = version;
this.version = VersionUtilities.versionFromCode(version); this.version = VersionUtilities.versionFromCode(version);
} }
public List<String> getErrors() { public List<String> getErrors() {
return errors; return errors;
} }
@ -99,10 +64,10 @@ public class NpmPackageVersionConverter {
try { try {
gzipIn = new GzipCompressorInputStream(new FileInputStream(source)); gzipIn = new GzipCompressorInputStream(new FileInputStream(source));
} catch (Exception e) { } catch (Exception e) {
throw new IOException("Error reading "+source+": "+e.getMessage(), e); throw new IOException("Error reading " + source + ": " + e.getMessage(), e);
} }
Map<String, byte[]> content = new HashMap<>(); Map<String, byte[]> content = new HashMap<>();
try (TarArchiveInputStream tarIn = new TarArchiveInputStream(gzipIn)) { try (TarArchiveInputStream tarIn = new TarArchiveInputStream(gzipIn)) {
TarArchiveEntry entry; TarArchiveEntry entry;
@ -122,7 +87,7 @@ public class NpmPackageVersionConverter {
} }
} }
} }
Map<String, byte[]> output = new HashMap<>(); Map<String, byte[]> output = new HashMap<>();
output.put("package/package.json", convertPackage(content.get("package/package.json"))); output.put("package/package.json", convertPackage(content.get("package/package.json")));
@ -141,7 +106,7 @@ public class NpmPackageVersionConverter {
} }
} }
} }
TarArchiveOutputStream tar; TarArchiveOutputStream tar;
ByteArrayOutputStream OutputStream; ByteArrayOutputStream OutputStream;
BufferedOutputStream bufferedOutputStream; BufferedOutputStream bufferedOutputStream;
@ -156,13 +121,13 @@ public class NpmPackageVersionConverter {
Map<String, NpmPackageIndexBuilder> indexers = new HashMap<>(); Map<String, NpmPackageIndexBuilder> indexers = new HashMap<>();
for (Entry<String, byte[]> e : output.entrySet()) { for (Entry<String, byte[]> e : output.entrySet()) {
String n = e.getKey().substring(0, e.getKey().lastIndexOf("/")); String n = e.getKey().substring(0, e.getKey().lastIndexOf("/"));
String s = e.getKey().substring(n.length()+1); String s = e.getKey().substring(n.length() + 1);
byte[] b = e.getValue(); byte[] b = e.getValue();
NpmPackageIndexBuilder indexer = indexers.get(n); NpmPackageIndexBuilder indexer = indexers.get(n);
if (indexer == null) { if (indexer == null) {
indexer = new NpmPackageIndexBuilder(); indexer = new NpmPackageIndexBuilder();
indexer.start(); indexer.start();
indexers.put(n, indexer); indexers.put(n, indexer);
} }
indexer.seeFile(s, b); indexer.seeFile(s, b);
if (!s.equals(".index.json") && !s.equals("package.json")) { if (!s.equals(".index.json") && !s.equals("package.json")) {
@ -175,13 +140,13 @@ public class NpmPackageVersionConverter {
} }
for (Entry<String, NpmPackageIndexBuilder> e : indexers.entrySet()) { for (Entry<String, NpmPackageIndexBuilder> e : indexers.entrySet()) {
byte[] cnt = e.getValue().build().getBytes(Charset.forName("UTF-8")); byte[] cnt = e.getValue().build().getBytes(Charset.forName("UTF-8"));
TarArchiveEntry entry = new TarArchiveEntry(e.getKey()+"/.index.json"); TarArchiveEntry entry = new TarArchiveEntry(e.getKey() + "/.index.json");
entry.setSize(cnt.length); entry.setSize(cnt.length);
tar.putArchiveEntry(entry); tar.putArchiveEntry(entry);
tar.write(cnt); tar.write(cnt);
tar.closeArchiveEntry(); tar.closeArchiveEntry();
} }
byte[] cnt = output.get("package/package.json"); byte[] cnt = output.get("package/package.json");
TarArchiveEntry entry = new TarArchiveEntry("package/package.json"); TarArchiveEntry entry = new TarArchiveEntry("package/package.json");
entry.setSize(cnt.length); entry.setSize(cnt.length);
@ -203,7 +168,7 @@ public class NpmPackageVersionConverter {
currentVersion = json.getAsJsonArray("fhirVersions").get(0).getAsString(); currentVersion = json.getAsJsonArray("fhirVersions").get(0).getAsString();
String name = JSONUtil.str(json, "name"); String name = JSONUtil.str(json, "name");
json.remove("name"); json.remove("name");
json.addProperty("name", name+"."+vCode); json.addProperty("name", name + "." + vCode);
json.remove("fhirVersions"); json.remove("fhirVersions");
json.remove("dependencies"); json.remove("dependencies");
JsonArray fv = new JsonArray(); JsonArray fv = new JsonArray();
@ -213,7 +178,7 @@ public class NpmPackageVersionConverter {
json.add("dependencies", dep); json.add("dependencies", dep);
dep.addProperty(VersionUtilities.packageForVersion(version), version); dep.addProperty(VersionUtilities.packageForVersion(version), version);
return JsonTrackingParser.write(json).getBytes(Charsets.UTF_8); return JsonTrackingParser.write(json).getBytes(Charsets.UTF_8);
} }
private byte[] convertResource(String n, byte[] cnt) { private byte[] convertResource(String n, byte[] cnt) {
try { try {
@ -226,9 +191,9 @@ public class NpmPackageVersionConverter {
} else if (VersionUtilities.isR3Ver(version)) { } else if (VersionUtilities.isR3Ver(version)) {
return new org.hl7.fhir.dstu3.formats.JsonParser().composeBytes(VersionConvertor_10_30.convertResource(res)); return new org.hl7.fhir.dstu3.formats.JsonParser().composeBytes(VersionConvertor_10_30.convertResource(res));
} else if (VersionUtilities.isR4Ver(version)) { } else if (VersionUtilities.isR4Ver(version)) {
return new org.hl7.fhir.r4.formats.JsonParser().composeBytes(VersionConvertor_10_40.convertResource(res)); return new org.hl7.fhir.r4.formats.JsonParser().composeBytes(VersionConvertor_10_40.convertResource(res));
} else if (VersionUtilities.isR5Ver(version)) { } else if (VersionUtilities.isR5Ver(version)) {
return new org.hl7.fhir.r5.formats.JsonParser().composeBytes(VersionConvertor_10_50.convertResource(res)); return new org.hl7.fhir.r5.formats.JsonParser().composeBytes(VersionConvertor_10_50.convertResource(res));
} }
} else if (VersionUtilities.isR2BVer(currentVersion)) { } else if (VersionUtilities.isR2BVer(currentVersion)) {
org.hl7.fhir.dstu2016may.model.Resource res = new org.hl7.fhir.dstu2016may.formats.JsonParser().parse(cnt); org.hl7.fhir.dstu2016may.model.Resource res = new org.hl7.fhir.dstu2016may.formats.JsonParser().parse(cnt);
@ -241,7 +206,7 @@ public class NpmPackageVersionConverter {
} else if (VersionUtilities.isR4Ver(version)) { } else if (VersionUtilities.isR4Ver(version)) {
return new org.hl7.fhir.r4.formats.JsonParser().composeBytes(VersionConvertor_14_40.convertResource(res)); return new org.hl7.fhir.r4.formats.JsonParser().composeBytes(VersionConvertor_14_40.convertResource(res));
} else if (VersionUtilities.isR5Ver(version)) { } else if (VersionUtilities.isR5Ver(version)) {
return new org.hl7.fhir.r5.formats.JsonParser().composeBytes(VersionConvertor_14_50.convertResource(res)); return new org.hl7.fhir.r5.formats.JsonParser().composeBytes(VersionConvertor_14_50.convertResource(res));
} }
} else if (VersionUtilities.isR3Ver(currentVersion)) { } else if (VersionUtilities.isR3Ver(currentVersion)) {
org.hl7.fhir.dstu3.model.Resource res = new org.hl7.fhir.dstu3.formats.JsonParser().parse(cnt); org.hl7.fhir.dstu3.model.Resource res = new org.hl7.fhir.dstu3.formats.JsonParser().parse(cnt);
@ -265,7 +230,7 @@ public class NpmPackageVersionConverter {
} else if (VersionUtilities.isR3Ver(version)) { } else if (VersionUtilities.isR3Ver(version)) {
return new org.hl7.fhir.dstu3.formats.JsonParser().composeBytes(VersionConvertor_30_40.convertResource(res, true)); return new org.hl7.fhir.dstu3.formats.JsonParser().composeBytes(VersionConvertor_30_40.convertResource(res, true));
} else if (VersionUtilities.isR4Ver(version)) { } else if (VersionUtilities.isR4Ver(version)) {
return new org.hl7.fhir.r4.formats.JsonParser().composeBytes(res); return new org.hl7.fhir.r4.formats.JsonParser().composeBytes(res);
} else if (VersionUtilities.isR5Ver(version)) { } else if (VersionUtilities.isR5Ver(version)) {
return new org.hl7.fhir.r5.formats.JsonParser().composeBytes(VersionConvertor_40_50.convertResource(res)); return new org.hl7.fhir.r5.formats.JsonParser().composeBytes(VersionConvertor_40_50.convertResource(res));
} }
@ -280,13 +245,13 @@ public class NpmPackageVersionConverter {
} else if (VersionUtilities.isR4Ver(version)) { } else if (VersionUtilities.isR4Ver(version)) {
return new org.hl7.fhir.r4.formats.JsonParser().composeBytes(VersionConvertor_40_50.convertResource(res)); return new org.hl7.fhir.r4.formats.JsonParser().composeBytes(VersionConvertor_40_50.convertResource(res));
} else if (VersionUtilities.isR5Ver(version)) { } else if (VersionUtilities.isR5Ver(version)) {
return new org.hl7.fhir.r5.formats.JsonParser().composeBytes(res); return new org.hl7.fhir.r5.formats.JsonParser().composeBytes(res);
} }
} }
throw new Error("Unknown version "+currentVersion+" -> "+version); throw new Error("Unknown version " + currentVersion + " -> " + version);
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
errors.add("Error converting "+n+": "+ex.getMessage()); errors.add("Error converting " + n + ": " + ex.getMessage());
return null; return null;
} }
} }

View File

@ -0,0 +1,26 @@
package org.hl7.fhir.convertors.misc;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.r4.model.CodeSystem;
import org.hl7.fhir.r4.model.ValueSet;
class PR2Handler implements VersionConvertorAdvisor40 {
@Override
public boolean ignoreEntry(Bundle.BundleEntryComponent src) {
return false;
}
@Override
public void handleCodeSystem(CodeSystem tgtcs, ValueSet source) throws FHIRException {
throw new Error("Not done yet");
}
@Override
public CodeSystem getCodeSystem(ValueSet src) throws FHIRException {
throw new Error("Not done yet");
}
}

View File

@ -0,0 +1,7 @@
package org.hl7.fhir.convertors
data class SourceElementComponentWrapper<A>(
var comp: A,
var source: String,
var target: String
)

View File

@ -0,0 +1,14 @@
package org.hl7.fhir.convertors
import org.hl7.fhir.r5.model.StructureDefinition
import org.hl7.fhir.r5.model.ValueSet
import java.util.HashMap
data class SpecPackage (
var valuesets: Map<String, ValueSet> = HashMap(),
var expansions: Map<String, ValueSet> = HashMap(),
var types: Map<String, StructureDefinition> = HashMap(),
var resources: Map<String, StructureDefinition> = HashMap(),
var extensions: Map<String, StructureDefinition> = HashMap(),
var profiles: Map<String, StructureDefinition> = HashMap()
)

View File

@ -0,0 +1,3 @@
package org.hl7.fhir.convertors
data class StringReplacement(var source: String, var replacement: String)

View File

@ -0,0 +1,6 @@
package org.hl7.fhir.convertors
import org.hl7.fhir.dstu3.context.SimpleWorkerContext
data class TransformContextR2R3(val context: SimpleWorkerContext, val id: String)

View File

@ -0,0 +1,5 @@
package org.hl7.fhir.convertors
interface TypeLinkProvider {
fun getLink(typeName: String?): String?
}

View File

@ -1,18 +1,13 @@
package org.hl7.fhir.convertors.conv10_30; package org.hl7.fhir.convertors.conv10_30;
import org.hl7.fhir.convertors.VersionConvertorAdvisor30; import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor30;
import org.hl7.fhir.convertors.VersionConvertor_10_30; import org.hl7.fhir.convertors.VersionConvertor_10_30;
import org.hl7.fhir.convertors.loaders.R2ToR3Loader; import org.hl7.fhir.convertors.loaders.R2ToR3Loader;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.stream.Stream;
public class AdministrativeGender10_30Test { public class AdministrativeGender10_30Test {

View File

@ -1,11 +1,10 @@
package org.hl7.fhir.convertors.conv10_30; package org.hl7.fhir.convertors.conv10_30;
import org.hl7.fhir.convertors.VersionConvertorAdvisor30; import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor30;
import org.hl7.fhir.convertors.VersionConvertor_10_30; import org.hl7.fhir.convertors.VersionConvertor_10_30;
import org.hl7.fhir.convertors.loaders.R2ToR3Loader; import org.hl7.fhir.convertors.loaders.R2ToR3Loader;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource; import org.junit.jupiter.params.provider.MethodSource;

View File

@ -1,11 +1,10 @@
package org.hl7.fhir.convertors.conv10_40; package org.hl7.fhir.convertors.conv10_40;
import org.hl7.fhir.convertors.VersionConvertorAdvisor40; import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import org.hl7.fhir.convertors.VersionConvertor_10_40; import org.hl7.fhir.convertors.VersionConvertor_10_40;
import org.hl7.fhir.convertors.misc.IGR2ConvertorAdvisor; import org.hl7.fhir.convertors.misc.IGR2ConvertorAdvisor;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource; import org.junit.jupiter.params.provider.MethodSource;

View File

@ -1,6 +1,6 @@
package org.hl7.fhir.convertors.conv10_40; package org.hl7.fhir.convertors.conv10_40;
import org.hl7.fhir.convertors.VersionConvertorAdvisor40; import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import org.hl7.fhir.convertors.VersionConvertor_10_40; import org.hl7.fhir.convertors.VersionConvertor_10_40;
import org.hl7.fhir.convertors.misc.IGR2ConvertorAdvisor; import org.hl7.fhir.convertors.misc.IGR2ConvertorAdvisor;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;

View File

@ -1,11 +1,10 @@
package org.hl7.fhir.convertors.conv10_40; package org.hl7.fhir.convertors.conv10_40;
import org.hl7.fhir.convertors.VersionConvertorAdvisor40; import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import org.hl7.fhir.convertors.VersionConvertor_10_40; import org.hl7.fhir.convertors.VersionConvertor_10_40;
import org.hl7.fhir.convertors.misc.IGR2ConvertorAdvisor; import org.hl7.fhir.convertors.misc.IGR2ConvertorAdvisor;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource; import org.junit.jupiter.params.provider.MethodSource;

View File

@ -1,6 +1,6 @@
package org.hl7.fhir.convertors.conv10_40; package org.hl7.fhir.convertors.conv10_40;
import org.hl7.fhir.convertors.VersionConvertorAdvisor40; import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import org.hl7.fhir.convertors.VersionConvertor_10_40; import org.hl7.fhir.convertors.VersionConvertor_10_40;
import org.hl7.fhir.convertors.misc.IGR2ConvertorAdvisor; import org.hl7.fhir.convertors.misc.IGR2ConvertorAdvisor;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;

View File

@ -1,6 +1,6 @@
package org.hl7.fhir.convertors.conv10_40; package org.hl7.fhir.convertors.conv10_40;
import org.hl7.fhir.convertors.VersionConvertorAdvisor40; import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import org.hl7.fhir.convertors.VersionConvertor_10_40; import org.hl7.fhir.convertors.VersionConvertor_10_40;
import org.hl7.fhir.convertors.misc.IGR2ConvertorAdvisor; import org.hl7.fhir.convertors.misc.IGR2ConvertorAdvisor;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;

View File

@ -1,39 +1,37 @@
package org.hl7.fhir.r5.model; package org.hl7.fhir.r5.model;
/* /*
Copyright (c) 2011+, HL7, Inc. Copyright (c) 2011+, HL7, Inc.
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met: are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this * Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer. list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, * Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution. and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to * Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific endorse or promote products derived from this software without specific
prior written permission. prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */
import org.hl7.fhir.instance.model.api.IBaseIntegerDatatype;
import ca.uhn.fhir.model.api.annotation.DatatypeDef; import ca.uhn.fhir.model.api.annotation.DatatypeDef;
import org.hl7.fhir.instance.model.api.IBaseIntegerDatatype;
/** /**
* Primitive type "integer" in FHIR: A signed 32-bit integer * Primitive type "integer" in FHIR: A signed 32-bit integer
@ -41,72 +39,78 @@ import ca.uhn.fhir.model.api.annotation.DatatypeDef;
@DatatypeDef(name = "integer") @DatatypeDef(name = "integer")
public class IntegerType extends PrimitiveType<Integer> implements IBaseIntegerDatatype { public class IntegerType extends PrimitiveType<Integer> implements IBaseIntegerDatatype {
private static final long serialVersionUID = 3L; private static final long serialVersionUID = 3L;
/** /**
* Constructor * Constructor
*/ */
public IntegerType() { public IntegerType() {
// nothing // nothing
} }
/** /**
* Constructor * Constructor
*/ */
public IntegerType(int theInteger) { public IntegerType(int theInteger) {
setValue(theInteger); setValue(theInteger);
} }
/** /**
* Constructor * Constructor
* */
* @param theIntegerAsString public IntegerType(Integer theInteger) {
* A string representation of an integer setValue(theInteger);
* @throws IllegalArgumentException }
* If the string is not a valid integer representation
*/
public IntegerType(String theIntegerAsString) {
setValueAsString(theIntegerAsString);
}
/** /**
* Constructor * Constructor
* *
* @param theValue The value * @param theIntegerAsString A string representation of an integer
* @throws IllegalArgumentException If the value is too large to fit in a signed integer * @throws IllegalArgumentException If the string is not a valid integer representation
*/ */
public IntegerType(Long theValue) { public IntegerType(String theIntegerAsString) {
if (theValue < java.lang.Integer.MIN_VALUE || theValue > java.lang.Integer.MAX_VALUE) { setValueAsString(theIntegerAsString);
throw new IllegalArgumentException }
(theValue + " cannot be cast to int without changing its value.");
}
if(theValue!=null) {
setValue((int)theValue.longValue());
}
}
@Override /**
protected Integer parse(String theValue) { * Constructor
try { *
return Integer.parseInt(theValue); * @param theValue The value
} catch (NumberFormatException e) { * @throws IllegalArgumentException If the value is too large to fit in a signed integer
throw new IllegalArgumentException(e); */
} public IntegerType(Long theValue) {
} if (theValue < java.lang.Integer.MIN_VALUE || theValue > java.lang.Integer.MAX_VALUE) {
throw new IllegalArgumentException
(theValue + " cannot be cast to int without changing its value.");
}
if (theValue != null) {
setValue((int) theValue.longValue());
}
}
@Override @Override
protected String encode(Integer theValue) { protected Integer parse(String theValue) {
return Integer.toString(theValue); try {
} return Integer.parseInt(theValue);
} catch (NumberFormatException e) {
throw new IllegalArgumentException(e);
}
}
@Override @Override
public IntegerType copy() { protected String encode(Integer theValue) {
IntegerType ret = new IntegerType(getValue()); return Integer.toString(theValue);
}
@Override
public IntegerType copy() {
// IntegerType ret = getValue() == null ? new IntegerType() : new IntegerType(getValue());
IntegerType ret = new IntegerType(getValue());
copyValues(ret); copyValues(ret);
return ret; return ret;
} }
public String fhirType() { public String fhirType() {
return "integer"; return "integer";
} }
} }

View File

@ -0,0 +1,24 @@
package org.hl7.fhir.r5.model;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
class IntegerTypeTest {
@Test
@DisplayName("Test that non-initialized Integer value doesn't cause crash on copy()")
public void testNullIntegerType() {
IntegerType intType = new IntegerType();
IntegerType intType2 = intType.copy();
Assertions.assertNull(intType2.getValue());
}
@Test
@DisplayName("Test that initialized with null Integer value doesn't cause crash on copy()")
public void testNullIntegerTypeString() {
IntegerType intType = new IntegerType((String) null);
IntegerType intType2 = intType.copy();
Assertions.assertNull(intType2.getValue());
}
}

View File

@ -183,7 +183,7 @@
<dependency> <dependency>
<groupId>com.fasterxml.jackson.core</groupId> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId> <artifactId>jackson-databind</artifactId>
<version>2.10.3</version> <version>2.10.5.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.thymeleaf</groupId> <groupId>org.thymeleaf</groupId>

View File

@ -3,6 +3,7 @@ package org.hl7.fhir.validation;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import lombok.Getter; import lombok.Getter;
import org.hl7.fhir.convertors.*; import org.hl7.fhir.convertors.*;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor50;
import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.context.SimpleWorkerContext; import org.hl7.fhir.r5.context.SimpleWorkerContext;
import org.hl7.fhir.r5.elementmodel.Manager; import org.hl7.fhir.r5.elementmodel.Manager;

View File

@ -34,7 +34,7 @@ package org.hl7.fhir.validation;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import org.hl7.fhir.convertors.VersionConvertorAdvisor50; import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor50;
import org.hl7.fhir.convertors.VersionConvertor_10_50; import org.hl7.fhir.convertors.VersionConvertor_10_50;
import org.hl7.fhir.convertors.VersionConvertor_14_50; import org.hl7.fhir.convertors.VersionConvertor_14_50;
import org.hl7.fhir.convertors.VersionConvertor_30_50; import org.hl7.fhir.convertors.VersionConvertor_30_50;

View File

@ -1,10 +1,10 @@
package org.hl7.fhir.validation; package org.hl7.fhir.validation;
import com.google.gson.JsonObject;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.hl7.fhir.convertors.*; import org.hl7.fhir.convertors.*;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor50;
import org.hl7.fhir.convertors.txClient.TerminologyClientFactory; import org.hl7.fhir.convertors.txClient.TerminologyClientFactory;
import org.hl7.fhir.exceptions.DefinitionException; import org.hl7.fhir.exceptions.DefinitionException;
import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRException;
@ -31,20 +31,16 @@ import org.hl7.fhir.r5.utils.ToolingExtensions;
import org.hl7.fhir.r5.utils.structuremap.StructureMapUtilities; import org.hl7.fhir.r5.utils.structuremap.StructureMapUtilities;
import org.hl7.fhir.utilities.TimeTracker; import org.hl7.fhir.utilities.TimeTracker;
import org.hl7.fhir.utilities.*; import org.hl7.fhir.utilities.*;
import org.hl7.fhir.utilities.json.JSONUtil;
import org.hl7.fhir.utilities.json.JsonTrackingParser;
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager; import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.npm.NpmPackage; import org.hl7.fhir.utilities.npm.NpmPackage;
import org.hl7.fhir.utilities.npm.ToolsVersion; import org.hl7.fhir.utilities.npm.ToolsVersion;
import org.hl7.fhir.utilities.validation.ValidationMessage; import org.hl7.fhir.utilities.validation.ValidationMessage;
import org.hl7.fhir.utilities.xhtml.XhtmlComposer; import org.hl7.fhir.utilities.xhtml.XhtmlComposer;
import org.hl7.fhir.utilities.xml.XMLUtil;
import org.hl7.fhir.validation.BaseValidator.ValidationControl; import org.hl7.fhir.validation.BaseValidator.ValidationControl;
import org.hl7.fhir.validation.cli.services.IPackageInstaller; import org.hl7.fhir.validation.cli.services.IPackageInstaller;
import org.hl7.fhir.validation.cli.utils.*; import org.hl7.fhir.validation.cli.utils.*;
import org.hl7.fhir.validation.instance.InstanceValidator; import org.hl7.fhir.validation.instance.InstanceValidator;
import org.hl7.fhir.validation.instance.utils.ValidatorHostContext; import org.hl7.fhir.validation.instance.utils.ValidatorHostContext;
import org.w3c.dom.Document;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import java.io.*; import java.io.*;

89
pom.xml
View File

@ -25,6 +25,7 @@
<maven_surefire_version>3.0.0-M4</maven_surefire_version> <maven_surefire_version>3.0.0-M4</maven_surefire_version>
<jacoco_version>0.8.5</jacoco_version> <jacoco_version>0.8.5</jacoco_version>
<info_cqframework_version>1.5.1</info_cqframework_version> <info_cqframework_version>1.5.1</info_cqframework_version>
<kotlin.version>1.5.0</kotlin.version>
</properties> </properties>
<name>HL7 Core Artifacts</name> <name>HL7 Core Artifacts</name>
@ -81,6 +82,17 @@
<version>1.2.3</version> <version>1.2.3</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test</artifactId>
<version>${kotlin.version}</version>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
<dependencyManagement> <dependencyManagement>
@ -156,6 +168,35 @@
<skip>true</skip> <skip>true</skip>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>1.5.0</version>
<executions>
<execution>
<id>compile</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<sourceDirs>
<sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
<sourceDir>${project.basedir}/src/main/java</sourceDir>
</sourceDirs>
</configuration>
</execution>
<execution>
<id>test-compile</id>
<goals> <goal>test-compile</goal> </goals>
<configuration>
<sourceDirs>
<sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
<sourceDir>${project.basedir}/src/test/java</sourceDir>
</sourceDirs>
</configuration>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
@ -172,8 +213,28 @@
<maxmem>4000m</maxmem> <maxmem>4000m</maxmem>
<debug>true</debug> <debug>true</debug>
</configuration> </configuration>
<dependencies> <executions>
</dependencies> <!-- Replacing default-compile as it is treated specially by maven -->
<execution>
<id>default-compile</id>
<phase>none</phase>
</execution>
<!-- Replacing default-testCompile as it is treated specially by maven -->
<execution>
<id>default-testCompile</id>
<phase>none</phase>
</execution>
<execution>
<id>java-compile</id>
<phase>compile</phase>
<goals> <goal>compile</goal> </goals>
</execution>
<execution>
<id>java-test-compile</id>
<phase>test-compile</phase>
<goals> <goal>testCompile</goal> </goals>
</execution>
</executions>
</plugin> </plugin>
<plugin> <plugin>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
@ -344,6 +405,30 @@
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId> <artifactId>maven-deploy-plugin</artifactId>
</plugin> </plugin>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<configuration>
<jvmTarget>1.8</jvmTarget>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>