mirror of
https://github.com/hapifhir/org.hl7.fhir.core.git
synced 2025-03-06 11:29:30 +00:00
Merge branch 'master' into gg-202105-bugfixes-2
This commit is contained in:
commit
154ac5c3ca
17
.github/stale.yml
vendored
Normal file
17
.github/stale.yml
vendored
Normal 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
|
@ -3,6 +3,10 @@
|
|||||||
* 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
|
||||||
|
* XMLParser allows passing a schema location
|
||||||
|
* Issue 484 https://github.com/hapifhir/org.hl7.fhir.core/issues/484
|
||||||
|
* Adding Kotlin to the build process
|
||||||
|
* random cleaning up in convertors
|
||||||
* Validator: Load code systems from known packages on the fly
|
* Validator: Load code systems from known packages on the fly
|
||||||
* Validator: better handle invalid v3 dates
|
* Validator: better handle invalid v3 dates
|
||||||
* Renderer: Render OperationDefinition.InputProfile and OutputProfile
|
* Renderer: Render OperationDefinition.InputProfile and OutputProfile
|
||||||
|
@ -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");
|
||||||
@ -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;
|
||||||
@ -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,12 +197,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -345,10 +326,10 @@ public class ExtensionDefinitionGenerator {
|
|||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -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());
|
||||||
@ -387,7 +368,7 @@ public class ExtensionDefinitionGenerator {
|
|||||||
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();
|
||||||
|
|
||||||
@ -413,7 +394,7 @@ public class ExtensionDefinitionGenerator {
|
|||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -30,18 +30,9 @@ package org.hl7.fhir.convertors;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import com.google.gson.JsonArray;
|
||||||
import java.io.ByteArrayOutputStream;
|
import com.google.gson.JsonObject;
|
||||||
import java.io.FileInputStream;
|
import com.google.gson.JsonPrimitive;
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.hl7.fhir.convertors.conv40_50.StructureDefinition40_50;
|
import org.hl7.fhir.convertors.conv40_50.StructureDefinition40_50;
|
||||||
import org.hl7.fhir.convertors.conv40_50.ValueSet40_50;
|
import org.hl7.fhir.convertors.conv40_50.ValueSet40_50;
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
@ -50,28 +41,15 @@ import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat;
|
|||||||
import org.hl7.fhir.r5.formats.IParser.OutputStyle;
|
import org.hl7.fhir.r5.formats.IParser.OutputStyle;
|
||||||
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.Base;
|
import org.hl7.fhir.r5.model.*;
|
||||||
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.CanonicalType;
|
|
||||||
import org.hl7.fhir.r5.model.DataType;
|
|
||||||
import org.hl7.fhir.r5.model.ElementDefinition;
|
|
||||||
import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent;
|
import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent;
|
||||||
import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent;
|
import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent;
|
||||||
import org.hl7.fhir.r5.model.Enumerations.BindingStrength;
|
import org.hl7.fhir.r5.model.Enumerations.BindingStrength;
|
||||||
import org.hl7.fhir.r5.model.PrimitiveType;
|
|
||||||
import org.hl7.fhir.r5.model.Resource;
|
|
||||||
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.r5.model.UriType;
|
|
||||||
import org.hl7.fhir.r5.model.ValueSet;
|
|
||||||
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent;
|
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent;
|
||||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
import org.hl7.fhir.utilities.*;
|
||||||
import org.hl7.fhir.utilities.IniFile;
|
|
||||||
import org.hl7.fhir.utilities.TextFile;
|
|
||||||
import org.hl7.fhir.utilities.Utilities;
|
|
||||||
import org.hl7.fhir.utilities.ZipGenerator;
|
|
||||||
import org.hl7.fhir.utilities.xhtml.NodeType;
|
import org.hl7.fhir.utilities.xhtml.NodeType;
|
||||||
import org.hl7.fhir.utilities.xhtml.XhtmlComposer;
|
import org.hl7.fhir.utilities.xhtml.XhtmlComposer;
|
||||||
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
|
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
|
||||||
@ -79,55 +57,21 @@ import org.w3c.dom.Document;
|
|||||||
import org.w3c.dom.Element;
|
import org.w3c.dom.Element;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
|
|
||||||
import com.google.gson.JsonArray;
|
import java.io.ByteArrayOutputStream;
|
||||||
import com.google.gson.JsonObject;
|
import java.io.FileInputStream;
|
||||||
import com.google.gson.JsonPrimitive;
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
public class SpecDifferenceEvaluator {
|
public class SpecDifferenceEvaluator {
|
||||||
|
|
||||||
public interface TypeLinkProvider {
|
|
||||||
public String getLink(String typeName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public class SpecPackage {
|
|
||||||
private Map<String, ValueSet> valuesets = new HashMap<String, ValueSet>();
|
|
||||||
private Map<String, ValueSet> expansions = new HashMap<String, ValueSet>();
|
|
||||||
private Map<String, StructureDefinition> types = new HashMap<String, StructureDefinition>();
|
|
||||||
private Map<String, StructureDefinition> resources = new HashMap<String, StructureDefinition>();
|
|
||||||
private Map<String, StructureDefinition> extensions = new HashMap<String, StructureDefinition>();
|
|
||||||
private Map<String, StructureDefinition> profiles = new HashMap<String, StructureDefinition>();
|
|
||||||
public Map<String, StructureDefinition> getTypes() {
|
|
||||||
return types;
|
|
||||||
}
|
|
||||||
public Map<String, StructureDefinition> getResources() {
|
|
||||||
return resources;
|
|
||||||
}
|
|
||||||
public Map<String, ValueSet> getExpansions() {
|
|
||||||
return expansions;
|
|
||||||
}
|
|
||||||
public Map<String, ValueSet> getValuesets() {
|
|
||||||
return valuesets;
|
|
||||||
}
|
|
||||||
public Map<String, StructureDefinition> getExtensions() {
|
|
||||||
return extensions;
|
|
||||||
}
|
|
||||||
public Map<String, StructureDefinition> getProfiles() {
|
|
||||||
return profiles;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private SpecPackage original = new SpecPackage();
|
private SpecPackage original = new SpecPackage();
|
||||||
private SpecPackage revision = new SpecPackage();
|
private SpecPackage revision = new SpecPackage();
|
||||||
private Map<String, String> renames = new HashMap<String, String>();
|
private Map<String, String> renames = new HashMap<String, String>();
|
||||||
private List<String> moves = new ArrayList<String>();
|
private List<String> moves = new ArrayList<String>();
|
||||||
|
|
||||||
private XhtmlNode tbl;
|
private XhtmlNode tbl;
|
||||||
private TypeLinkProvider linker;
|
private TypeLinkProvider linker;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void loadFromIni(IniFile ini) {
|
public void loadFromIni(IniFile ini) {
|
||||||
String[] names = ini.getPropertyNames("r5-renames");
|
String[] names = ini.getPropertyNames("r5-renames");
|
||||||
if (names != null)
|
if (names != null)
|
||||||
@ -139,6 +83,7 @@ public class SpecDifferenceEvaluator {
|
|||||||
public SpecPackage getOriginal() {
|
public SpecPackage getOriginal() {
|
||||||
return original;
|
return original;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SpecPackage getRevision() {
|
public SpecPackage getRevision() {
|
||||||
return revision;
|
return revision;
|
||||||
}
|
}
|
||||||
@ -150,14 +95,14 @@ public class SpecDifferenceEvaluator {
|
|||||||
// loadVS2(self.original.valuesets, "C:\\work\\org.hl7.fhir.dstu2.original\\build\\publish\\valuesets.xml");
|
// loadVS2(self.original.valuesets, "C:\\work\\org.hl7.fhir.dstu2.original\\build\\publish\\valuesets.xml");
|
||||||
// loadVS(self.revision.valuesets, "C:\\work\\org.hl7.fhir.dstu2.original\\build\\publish\\valuesets.xml");
|
// loadVS(self.revision.valuesets, "C:\\work\\org.hl7.fhir.dstu2.original\\build\\publish\\valuesets.xml");
|
||||||
|
|
||||||
loadSD4(self.original.types, "C:\\work\\org.hl7.fhir\\build\\source\\release4\\profiles-types.xml");
|
loadSD4(self.original.getTypes(), "C:\\work\\org.hl7.fhir\\build\\source\\release4\\profiles-types.xml");
|
||||||
loadSD(self.revision.types, "C:\\work\\org.hl7.fhir\\build\\publish\\profiles-types.xml");
|
loadSD(self.revision.getTypes(), "C:\\work\\org.hl7.fhir\\build\\publish\\profiles-types.xml");
|
||||||
loadSD4(self.original.resources, "C:\\work\\org.hl7.fhir\\build\\source\\release4\\profiles-resources.xml");
|
loadSD4(self.original.getResources(), "C:\\work\\org.hl7.fhir\\build\\source\\release4\\profiles-resources.xml");
|
||||||
loadSD(self.revision.resources, "C:\\work\\org.hl7.fhir\\build\\publish\\profiles-resources.xml");
|
loadSD(self.revision.getResources(), "C:\\work\\org.hl7.fhir\\build\\publish\\profiles-resources.xml");
|
||||||
loadVS4(self.original.expansions, "C:\\work\\org.hl7.fhir\\build\\source\\release4\\expansions.xml");
|
loadVS4(self.original.getExpansions(), "C:\\work\\org.hl7.fhir\\build\\source\\release4\\expansions.xml");
|
||||||
loadVS(self.revision.expansions, "C:\\work\\org.hl7.fhir\\build\\publish\\expansions.xml");
|
loadVS(self.revision.getExpansions(), "C:\\work\\org.hl7.fhir\\build\\publish\\expansions.xml");
|
||||||
loadVS4(self.original.valuesets, "C:\\work\\org.hl7.fhir\\build\\source\\release4\\valuesets.xml");
|
loadVS4(self.original.getValuesets(), "C:\\work\\org.hl7.fhir\\build\\source\\release4\\valuesets.xml");
|
||||||
loadVS(self.revision.valuesets, "C:\\work\\org.hl7.fhir\\build\\publish\\valuesets.xml");
|
loadVS(self.revision.getValuesets(), "C:\\work\\org.hl7.fhir\\build\\publish\\valuesets.xml");
|
||||||
StringBuilder b = new StringBuilder();
|
StringBuilder b = new StringBuilder();
|
||||||
b.append("<html>\r\n");
|
b.append("<html>\r\n");
|
||||||
b.append("<head>\r\n");
|
b.append("<head>\r\n");
|
||||||
@ -181,6 +126,7 @@ public class SpecDifferenceEvaluator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void loadSD(Map<String, StructureDefinition> map, String fn) throws FHIRFormatError, FileNotFoundException, IOException {
|
private static void loadSD(Map<String, StructureDefinition> map, String fn) throws FHIRFormatError, FileNotFoundException, IOException {
|
||||||
Bundle bundle = (Bundle) new XmlParser().parse(new FileInputStream(fn));
|
Bundle bundle = (Bundle) new XmlParser().parse(new FileInputStream(fn));
|
||||||
for (BundleEntryComponent be : bundle.getEntry()) {
|
for (BundleEntryComponent be : bundle.getEntry()) {
|
||||||
@ -213,9 +159,9 @@ public class SpecDifferenceEvaluator {
|
|||||||
|
|
||||||
public void getDiffAsJson(JsonObject json, StructureDefinition rev) throws IOException {
|
public void getDiffAsJson(JsonObject json, StructureDefinition rev) throws IOException {
|
||||||
this.linker = null;
|
this.linker = null;
|
||||||
StructureDefinition orig = original.resources.get(checkRename(rev.getName()));
|
StructureDefinition orig = original.getResources().get(checkRename(rev.getName()));
|
||||||
if (orig == null)
|
if (orig == null)
|
||||||
orig = original.types.get(checkRename(rev.getName()));
|
orig = original.getTypes().get(checkRename(rev.getName()));
|
||||||
JsonArray types = new JsonArray();
|
JsonArray types = new JsonArray();
|
||||||
json.add("types", types);
|
json.add("types", types);
|
||||||
types.add(new JsonPrimitive(rev.getName()));
|
types.add(new JsonPrimitive(rev.getName()));
|
||||||
@ -231,9 +177,9 @@ public class SpecDifferenceEvaluator {
|
|||||||
|
|
||||||
public void getDiffAsXml(Document doc, Element xml, StructureDefinition rev) throws IOException {
|
public void getDiffAsXml(Document doc, Element xml, StructureDefinition rev) throws IOException {
|
||||||
this.linker = null;
|
this.linker = null;
|
||||||
StructureDefinition orig = original.resources.get(checkRename(rev.getName()));
|
StructureDefinition orig = original.getResources().get(checkRename(rev.getName()));
|
||||||
if (orig == null)
|
if (orig == null)
|
||||||
orig = original.types.get(checkRename(rev.getName()));
|
orig = original.getTypes().get(checkRename(rev.getName()));
|
||||||
Element type = doc.createElement("type");
|
Element type = doc.createElement("type");
|
||||||
type.setAttribute("name", rev.getName());
|
type.setAttribute("name", rev.getName());
|
||||||
xml.appendChild(type);
|
xml.appendChild(type);
|
||||||
@ -250,9 +196,9 @@ public class SpecDifferenceEvaluator {
|
|||||||
JsonArray types = new JsonArray();
|
JsonArray types = new JsonArray();
|
||||||
json.add("types", types);
|
json.add("types", types);
|
||||||
|
|
||||||
for (String s : sorted(revision.types.keySet())) {
|
for (String s : sorted(revision.getTypes().keySet())) {
|
||||||
StructureDefinition orig = original.types.get(s);
|
StructureDefinition orig = original.getTypes().get(s);
|
||||||
StructureDefinition rev = revision.types.get(s);
|
StructureDefinition rev = revision.getTypes().get(s);
|
||||||
types.add(new JsonPrimitive(rev.getName()));
|
types.add(new JsonPrimitive(rev.getName()));
|
||||||
JsonObject type = new JsonObject();
|
JsonObject type = new JsonObject();
|
||||||
json.add(rev.getName(), type);
|
json.add(rev.getName(), type);
|
||||||
@ -268,9 +214,9 @@ public class SpecDifferenceEvaluator {
|
|||||||
compareJson(type, orig, rev);
|
compareJson(type, orig, rev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (String s : sorted(original.types.keySet())) {
|
for (String s : sorted(original.getTypes().keySet())) {
|
||||||
StructureDefinition orig = original.types.get(s);
|
StructureDefinition orig = original.getTypes().get(s);
|
||||||
StructureDefinition rev = revision.types.get(s);
|
StructureDefinition rev = revision.getTypes().get(s);
|
||||||
if (rev == null) {
|
if (rev == null) {
|
||||||
types.add(new JsonPrimitive(orig.getName()));
|
types.add(new JsonPrimitive(orig.getName()));
|
||||||
JsonObject type = new JsonObject();
|
JsonObject type = new JsonObject();
|
||||||
@ -279,9 +225,9 @@ public class SpecDifferenceEvaluator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String s : sorted(revision.resources.keySet())) {
|
for (String s : sorted(revision.getResources().keySet())) {
|
||||||
StructureDefinition orig = original.resources.get(checkRename(s));
|
StructureDefinition orig = original.getResources().get(checkRename(s));
|
||||||
StructureDefinition rev = revision.resources.get(s);
|
StructureDefinition rev = revision.getResources().get(s);
|
||||||
types.add(new JsonPrimitive(rev.getName()));
|
types.add(new JsonPrimitive(rev.getName()));
|
||||||
JsonObject type = new JsonObject();
|
JsonObject type = new JsonObject();
|
||||||
json.add(rev.getName(), type);
|
json.add(rev.getName(), type);
|
||||||
@ -291,9 +237,9 @@ public class SpecDifferenceEvaluator {
|
|||||||
compareJson(type, orig, rev);
|
compareJson(type, orig, rev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (String s : sorted(original.resources.keySet())) {
|
for (String s : sorted(original.getResources().keySet())) {
|
||||||
StructureDefinition orig = original.resources.get(s);
|
StructureDefinition orig = original.getResources().get(s);
|
||||||
StructureDefinition rev = revision.resources.get(s);
|
StructureDefinition rev = revision.getResources().get(s);
|
||||||
if (rev == null) {
|
if (rev == null) {
|
||||||
types.add(new JsonPrimitive(orig.getName()));
|
types.add(new JsonPrimitive(orig.getName()));
|
||||||
JsonObject type = new JsonObject();
|
JsonObject type = new JsonObject();
|
||||||
@ -306,9 +252,9 @@ public class SpecDifferenceEvaluator {
|
|||||||
public void getDiffAsXml(Document doc, Element xml) throws IOException {
|
public void getDiffAsXml(Document doc, Element xml) throws IOException {
|
||||||
this.linker = null;
|
this.linker = null;
|
||||||
|
|
||||||
for (String s : sorted(revision.types.keySet())) {
|
for (String s : sorted(revision.getTypes().keySet())) {
|
||||||
StructureDefinition orig = original.types.get(s);
|
StructureDefinition orig = original.getTypes().get(s);
|
||||||
StructureDefinition rev = revision.types.get(s);
|
StructureDefinition rev = revision.getTypes().get(s);
|
||||||
Element type = doc.createElement("type");
|
Element type = doc.createElement("type");
|
||||||
type.setAttribute("name", rev.getName());
|
type.setAttribute("name", rev.getName());
|
||||||
xml.appendChild(type);
|
xml.appendChild(type);
|
||||||
@ -324,9 +270,9 @@ public class SpecDifferenceEvaluator {
|
|||||||
compareXml(doc, type, orig, rev);
|
compareXml(doc, type, orig, rev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (String s : sorted(original.types.keySet())) {
|
for (String s : sorted(original.getTypes().keySet())) {
|
||||||
StructureDefinition orig = original.types.get(s);
|
StructureDefinition orig = original.getTypes().get(s);
|
||||||
StructureDefinition rev = revision.types.get(s);
|
StructureDefinition rev = revision.getTypes().get(s);
|
||||||
if (rev == null) {
|
if (rev == null) {
|
||||||
Element type = doc.createElement("type");
|
Element type = doc.createElement("type");
|
||||||
type.setAttribute("name", orig.getName());
|
type.setAttribute("name", orig.getName());
|
||||||
@ -335,9 +281,9 @@ public class SpecDifferenceEvaluator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String s : sorted(revision.resources.keySet())) {
|
for (String s : sorted(revision.getResources().keySet())) {
|
||||||
StructureDefinition orig = original.resources.get(checkRename(s));
|
StructureDefinition orig = original.getResources().get(checkRename(s));
|
||||||
StructureDefinition rev = revision.resources.get(s);
|
StructureDefinition rev = revision.getResources().get(s);
|
||||||
Element type = doc.createElement("type");
|
Element type = doc.createElement("type");
|
||||||
type.setAttribute("name", rev.getName());
|
type.setAttribute("name", rev.getName());
|
||||||
xml.appendChild(type);
|
xml.appendChild(type);
|
||||||
@ -347,9 +293,9 @@ public class SpecDifferenceEvaluator {
|
|||||||
compareXml(doc, type, orig, rev);
|
compareXml(doc, type, orig, rev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (String s : sorted(original.resources.keySet())) {
|
for (String s : sorted(original.getResources().keySet())) {
|
||||||
StructureDefinition orig = original.resources.get(s);
|
StructureDefinition orig = original.getResources().get(s);
|
||||||
StructureDefinition rev = revision.resources.get(s);
|
StructureDefinition rev = revision.getResources().get(s);
|
||||||
if (rev == null) {
|
if (rev == null) {
|
||||||
Element type = doc.createElement("type");
|
Element type = doc.createElement("type");
|
||||||
type.setAttribute("name", orig.getName());
|
type.setAttribute("name", orig.getName());
|
||||||
@ -362,15 +308,15 @@ public class SpecDifferenceEvaluator {
|
|||||||
public String getDiffAsHtml(TypeLinkProvider linker, StructureDefinition rev) throws IOException {
|
public String getDiffAsHtml(TypeLinkProvider linker, StructureDefinition rev) throws IOException {
|
||||||
this.linker = linker;
|
this.linker = linker;
|
||||||
|
|
||||||
StructureDefinition orig = original.resources.get(checkRename(rev.getName()));
|
StructureDefinition orig = original.getResources().get(checkRename(rev.getName()));
|
||||||
if (orig == null)
|
if (orig == null)
|
||||||
orig = original.types.get(checkRename(rev.getName()));
|
orig = original.getTypes().get(checkRename(rev.getName()));
|
||||||
if (orig == null)
|
if (orig == null)
|
||||||
return "<p>This "+rev.getKind().toCode()+" did not exist in Release 2</p>";
|
return "<p>This " + rev.getKind().toCode() + " did not exist in Release 2</p>";
|
||||||
else {
|
else {
|
||||||
start();
|
start();
|
||||||
compare(orig, rev);
|
compare(orig, rev);
|
||||||
return new XhtmlComposer(false, true).compose(tbl)+"\r\n<p>See the <a href=\"diff.html\">Full Difference</a> for further information</p>\r\n";
|
return new XhtmlComposer(false, true).compose(tbl) + "\r\n<p>See the <a href=\"diff.html\">Full Difference</a> for further information</p>\r\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -379,39 +325,39 @@ public class SpecDifferenceEvaluator {
|
|||||||
start();
|
start();
|
||||||
|
|
||||||
header("Types");
|
header("Types");
|
||||||
for (String s : sorted(revision.types.keySet())) {
|
for (String s : sorted(revision.getTypes().keySet())) {
|
||||||
StructureDefinition orig = original.types.get(s);
|
StructureDefinition orig = original.getTypes().get(s);
|
||||||
StructureDefinition rev = revision.types.get(s);
|
StructureDefinition rev = revision.getTypes().get(s);
|
||||||
if (orig == null) {
|
if (orig == null) {
|
||||||
markNew(rev.getName(), true, false, false);
|
markNew(rev.getName(), true, false, false);
|
||||||
} else if (rev.getKind() == StructureDefinitionKind.PRIMITIVETYPE) {
|
} else if (rev.getKind() == StructureDefinitionKind.PRIMITIVETYPE) {
|
||||||
markNoChanges(rev.getName(), true);
|
markNoChanges(rev.getName(), true);
|
||||||
} else if (rev.hasDerivation() && orig.hasDerivation() && rev.getDerivation() != orig.getDerivation()) {
|
} else if (rev.hasDerivation() && orig.hasDerivation() && rev.getDerivation() != orig.getDerivation()) {
|
||||||
markChanged(rev.getName(), "Changed from a "+orig.getDerivation().toCode()+" to a "+rev.getDerivation().toCode(), true);
|
markChanged(rev.getName(), "Changed from a " + orig.getDerivation().toCode() + " to a " + rev.getDerivation().toCode(), true);
|
||||||
} else {
|
} else {
|
||||||
compare(orig, rev);
|
compare(orig, rev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (String s : sorted(original.types.keySet())) {
|
for (String s : sorted(original.getTypes().keySet())) {
|
||||||
StructureDefinition orig = original.types.get(s);
|
StructureDefinition orig = original.getTypes().get(s);
|
||||||
StructureDefinition rev = revision.types.get(s);
|
StructureDefinition rev = revision.getTypes().get(s);
|
||||||
if (rev == null)
|
if (rev == null)
|
||||||
markDeleted(orig.getName(), true);
|
markDeleted(orig.getName(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
header("Resources");
|
header("Resources");
|
||||||
for (String s : sorted(revision.resources.keySet())) {
|
for (String s : sorted(revision.getResources().keySet())) {
|
||||||
StructureDefinition orig = original.resources.get(checkRename(s));
|
StructureDefinition orig = original.getResources().get(checkRename(s));
|
||||||
StructureDefinition rev = revision.resources.get(s);
|
StructureDefinition rev = revision.getResources().get(s);
|
||||||
if (orig == null) {
|
if (orig == null) {
|
||||||
markNew(rev.getName(), true, true, false);
|
markNew(rev.getName(), true, true, false);
|
||||||
} else {
|
} else {
|
||||||
compare(orig, rev);
|
compare(orig, rev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (String s : sorted(original.resources.keySet())) {
|
for (String s : sorted(original.getResources().keySet())) {
|
||||||
StructureDefinition orig = original.resources.get(s);
|
StructureDefinition orig = original.getResources().get(s);
|
||||||
StructureDefinition rev = revision.resources.get(s);
|
StructureDefinition rev = revision.getResources().get(s);
|
||||||
if (rev == null)
|
if (rev == null)
|
||||||
markDeleted(orig.getName(), true);
|
markDeleted(orig.getName(), true);
|
||||||
}
|
}
|
||||||
@ -432,6 +378,7 @@ public class SpecDifferenceEvaluator {
|
|||||||
Collections.sort(list);
|
Collections.sort(list);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void header(String title) {
|
private void header(String title) {
|
||||||
tbl.addTag("tr").setAttribute("class", "diff-title").addTag("td").setAttribute("colspan", "2").addText(title);
|
tbl.addTag("tr").setAttribute("class", "diff-title").addTag("td").setAttribute("colspan", "2").addText(title);
|
||||||
}
|
}
|
||||||
@ -447,7 +394,7 @@ public class SpecDifferenceEvaluator {
|
|||||||
XhtmlNode left = tr.addTag("td").setAttribute("class", "diff-left");
|
XhtmlNode left = tr.addTag("td").setAttribute("class", "diff-left");
|
||||||
XhtmlNode right = tr.addTag("td").setAttribute("class", "diff-right");
|
XhtmlNode right = tr.addTag("td").setAttribute("class", "diff-right");
|
||||||
String link = linker == null ? null : linker.getLink(name);
|
String link = linker == null ? null : linker.getLink(name);
|
||||||
if (link!= null)
|
if (link != null)
|
||||||
left.addTag("a").setAttribute("href", link).addText(name);
|
left.addTag("a").setAttribute("href", link).addText(name);
|
||||||
else
|
else
|
||||||
left.addText(name);
|
left.addText(name);
|
||||||
@ -459,7 +406,7 @@ public class SpecDifferenceEvaluator {
|
|||||||
XhtmlNode left = tr.addTag("td").setAttribute("class", "diff-left");
|
XhtmlNode left = tr.addTag("td").setAttribute("class", "diff-left");
|
||||||
XhtmlNode right = tr.addTag("td").setAttribute("class", "diff-right");
|
XhtmlNode right = tr.addTag("td").setAttribute("class", "diff-right");
|
||||||
String link = linker == null ? null : linker.getLink(name);
|
String link = linker == null ? null : linker.getLink(name);
|
||||||
if (link!= null)
|
if (link != null)
|
||||||
left.addTag("a").setAttribute("href", link).addText(name);
|
left.addTag("a").setAttribute("href", link).addText(name);
|
||||||
else
|
else
|
||||||
left.addText(name);
|
left.addText(name);
|
||||||
@ -479,14 +426,14 @@ public class SpecDifferenceEvaluator {
|
|||||||
XhtmlNode left = tr.addTag("td").setAttribute("class", "diff-left");
|
XhtmlNode left = tr.addTag("td").setAttribute("class", "diff-left");
|
||||||
XhtmlNode right = tr.addTag("td").setAttribute("class", "diff-right");
|
XhtmlNode right = tr.addTag("td").setAttribute("class", "diff-right");
|
||||||
String link = linker == null ? null : linker.getLink(name);
|
String link = linker == null ? null : linker.getLink(name);
|
||||||
if (link!= null)
|
if (link != null)
|
||||||
left.addTag("a").setAttribute("href", link).addText(name);
|
left.addTag("a").setAttribute("href", link).addText(name);
|
||||||
else
|
else
|
||||||
left.addText(name);
|
left.addText(name);
|
||||||
if (!res && mand)
|
if (!res && mand)
|
||||||
right.ul().li().b().addText("Added Mandatory Element");
|
right.ul().li().b().addText("Added Mandatory Element");
|
||||||
else
|
else
|
||||||
right.ul().li().addText(res ? "Added Resource" : !name.contains(".") ? "Added Type" : mand ? "Added Mandatory Element " : "Added Element" );
|
right.ul().li().addText(res ? "Added Resource" : !name.contains(".") ? "Added Type" : mand ? "Added Mandatory Element " : "Added Element");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void compare(StructureDefinition orig, StructureDefinition rev) {
|
private void compare(StructureDefinition orig, StructureDefinition rev) {
|
||||||
@ -494,7 +441,7 @@ public class SpecDifferenceEvaluator {
|
|||||||
XhtmlNode tr = tbl.addTag("tr").setAttribute("class", "diff-item");
|
XhtmlNode tr = tbl.addTag("tr").setAttribute("class", "diff-item");
|
||||||
XhtmlNode left = tr.addTag("td").setAttribute("class", "diff-left");
|
XhtmlNode left = tr.addTag("td").setAttribute("class", "diff-left");
|
||||||
String link = linker == null ? null : linker.getLink(rev.getName());
|
String link = linker == null ? null : linker.getLink(rev.getName());
|
||||||
if (link!= null)
|
if (link != null)
|
||||||
left.addTag("a").setAttribute("href", link).addText(rev.getName());
|
left.addTag("a").setAttribute("href", link).addText(rev.getName());
|
||||||
else
|
else
|
||||||
left.addText(rev.getName());
|
left.addText(rev.getName());
|
||||||
@ -504,7 +451,7 @@ public class SpecDifferenceEvaluator {
|
|||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
if (!orig.getName().equals(rev.getName())) {
|
if (!orig.getName().equals(rev.getName())) {
|
||||||
changed = true;
|
changed = true;
|
||||||
right.ul().li().addText("Name Changed from "+orig.getName()+" to "+rev.getName());
|
right.ul().li().addText("Name Changed from " + orig.getName() + " to " + rev.getName());
|
||||||
}
|
}
|
||||||
for (ElementDefinition ed : rev.getDifferential().getElement()) {
|
for (ElementDefinition ed : rev.getDifferential().getElement()) {
|
||||||
ElementDefinition oed = getMatchingElement(rev.getName(), orig.getDifferential().getElement(), ed);
|
ElementDefinition oed = getMatchingElement(rev.getName(), orig.getDifferential().getElement(), ed);
|
||||||
@ -530,7 +477,7 @@ public class SpecDifferenceEvaluator {
|
|||||||
changed = true;
|
changed = true;
|
||||||
boolean marked = false;
|
boolean marked = false;
|
||||||
for (String s : dels)
|
for (String s : dels)
|
||||||
if (ed.getPath().startsWith(s+"."))
|
if (ed.getPath().startsWith(s + "."))
|
||||||
marked = true;
|
marked = true;
|
||||||
if (!marked) {
|
if (!marked) {
|
||||||
dels.add(ed.getPath());
|
dels.add(ed.getPath());
|
||||||
@ -553,11 +500,11 @@ public class SpecDifferenceEvaluator {
|
|||||||
// now, look for matches by name (ignoring slicing for now)
|
// now, look for matches by name (ignoring slicing for now)
|
||||||
String tp = mapPath(tn, target.getPath());
|
String tp = mapPath(tn, target.getPath());
|
||||||
if (tp.endsWith("[x]"))
|
if (tp.endsWith("[x]"))
|
||||||
tp = tp.substring(0, tp.length()-4);
|
tp = tp.substring(0, tp.length() - 4);
|
||||||
for (ElementDefinition ed : list) {
|
for (ElementDefinition ed : list) {
|
||||||
String p = ed.getPath();
|
String p = ed.getPath();
|
||||||
if (p.endsWith("[x]"))
|
if (p.endsWith("[x]"))
|
||||||
p = p.substring(0, p.length()-4);
|
p = p.substring(0, p.length() - 4);
|
||||||
if (p.equals(tp))
|
if (p.equals(tp))
|
||||||
return ed;
|
return ed;
|
||||||
}
|
}
|
||||||
@ -568,15 +515,14 @@ public class SpecDifferenceEvaluator {
|
|||||||
* change from rev to original. TODO: make this a config file somewhere?
|
* change from rev to original. TODO: make this a config file somewhere?
|
||||||
*
|
*
|
||||||
* @param tn
|
* @param tn
|
||||||
* @param name
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private String mapPath(String tn, String path) {
|
private String mapPath(String tn, String path) {
|
||||||
if (renames.containsKey(path))
|
if (renames.containsKey(path))
|
||||||
return renames.get(path);
|
return renames.get(path);
|
||||||
for (String r : renames.keySet()) {
|
for (String r : renames.keySet()) {
|
||||||
if (path.startsWith(r+"."))
|
if (path.startsWith(r + "."))
|
||||||
return renames.get(r)+"."+path.substring(r.length()+1);
|
return renames.get(r) + "." + path.substring(r.length() + 1);
|
||||||
}
|
}
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
@ -590,24 +536,23 @@ public class SpecDifferenceEvaluator {
|
|||||||
boolean renamed = false;
|
boolean renamed = false;
|
||||||
if (!rn.equals(on) && rev.getPath().contains(".")) {
|
if (!rn.equals(on) && rev.getPath().contains(".")) {
|
||||||
if (rp.equals(op))
|
if (rp.equals(op))
|
||||||
b.append("Renamed from "+on+" to " +rn);
|
b.append("Renamed from " + on + " to " + rn);
|
||||||
else
|
else
|
||||||
b.append("Moved from "+orig.getPath()+" to " +rn);
|
b.append("Moved from " + orig.getPath() + " to " + rn);
|
||||||
renamed = true;
|
renamed = true;
|
||||||
}
|
} else if (!rev.getPath().equals(orig.getPath())) {
|
||||||
else if (!rev.getPath().equals(orig.getPath())) {
|
|
||||||
if (!moveAlreadyNoted(rev.getPath(), orig.getPath())) {
|
if (!moveAlreadyNoted(rev.getPath(), orig.getPath())) {
|
||||||
noteMove(rev.getPath(), orig.getPath());
|
noteMove(rev.getPath(), orig.getPath());
|
||||||
b.append("Moved from "+head(orig.getPath())+" to " +head(rev.getPath()));
|
b.append("Moved from " + head(orig.getPath()) + " to " + head(rev.getPath()));
|
||||||
renamed = true;
|
renamed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rev.getMin() != orig.getMin())
|
if (rev.getMin() != orig.getMin())
|
||||||
b.append("Min Cardinality changed from "+Integer.toString(orig.getMin())+" to " +Integer.toString(rev.getMin()));
|
b.append("Min Cardinality changed from " + Integer.toString(orig.getMin()) + " to " + Integer.toString(rev.getMin()));
|
||||||
|
|
||||||
if (!rev.getMax().equals(orig.getMax()))
|
if (!rev.getMax().equals(orig.getMax()))
|
||||||
b.append("Max Cardinality changed from "+orig.getMax()+" to " +rev.getMax());
|
b.append("Max Cardinality changed from " + orig.getMax() + " to " + rev.getMax());
|
||||||
|
|
||||||
analyseTypes(b, rev, orig);
|
analyseTypes(b, rev, orig);
|
||||||
|
|
||||||
@ -619,15 +564,15 @@ public class SpecDifferenceEvaluator {
|
|||||||
|
|
||||||
if (rev.hasDefaultValue() || orig.hasDefaultValue()) {
|
if (rev.hasDefaultValue() || orig.hasDefaultValue()) {
|
||||||
if (!rev.hasDefaultValue())
|
if (!rev.hasDefaultValue())
|
||||||
b.append("Default Value "+describeValue(orig.getDefaultValue())+" removed");
|
b.append("Default Value " + describeValue(orig.getDefaultValue()) + " removed");
|
||||||
else if (!orig.hasDefaultValue())
|
else if (!orig.hasDefaultValue())
|
||||||
b.append("Default Value "+describeValue(rev.getDefaultValue())+" added");
|
b.append("Default Value " + describeValue(rev.getDefaultValue()) + " added");
|
||||||
else {
|
else {
|
||||||
// do not use Base.compare here, because it is subject to type differences
|
// do not use Base.compare here, because it is subject to type differences
|
||||||
String s1 = describeValue(orig.getDefaultValue());
|
String s1 = describeValue(orig.getDefaultValue());
|
||||||
String s2 = describeValue(rev.getDefaultValue());
|
String s2 = describeValue(rev.getDefaultValue());
|
||||||
if (!s1.equals(s2))
|
if (!s1.equals(s2))
|
||||||
b.append("Default Value changed from "+s1+" to "+s2);
|
b.append("Default Value changed from " + s1 + " to " + s2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -669,11 +614,11 @@ public class SpecDifferenceEvaluator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void noteMove(String revpath, String origpath) {
|
private void noteMove(String revpath, String origpath) {
|
||||||
moves.add(revpath+"="+origpath);
|
moves.add(revpath + "=" + origpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean moveAlreadyNoted(String revpath, String origpath) {
|
private boolean moveAlreadyNoted(String revpath, String origpath) {
|
||||||
if (moves.contains(revpath+"="+origpath))
|
if (moves.contains(revpath + "=" + origpath))
|
||||||
return true;
|
return true;
|
||||||
if (!revpath.contains(".") || !origpath.contains("."))
|
if (!revpath.contains(".") || !origpath.contains("."))
|
||||||
return false;
|
return false;
|
||||||
@ -683,16 +628,16 @@ public class SpecDifferenceEvaluator {
|
|||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
private String describeValue(DataType v) {
|
private String describeValue(DataType v) {
|
||||||
if (v instanceof PrimitiveType) {
|
if (v instanceof PrimitiveType) {
|
||||||
return "\""+((PrimitiveType) v).asStringValue()+"\"";
|
return "\"" + ((PrimitiveType) v).asStringValue() + "\"";
|
||||||
}
|
}
|
||||||
return "{complex}";
|
return "{complex}";
|
||||||
}
|
}
|
||||||
|
|
||||||
private String compareBindings(ElementDefinition rev, ElementDefinition orig) {
|
private String compareBindings(ElementDefinition rev, ElementDefinition orig) {
|
||||||
if (!hasBindingToNote(rev)) {
|
if (!hasBindingToNote(rev)) {
|
||||||
return "Remove Binding "+describeBinding(orig);
|
return "Remove Binding " + describeBinding(orig);
|
||||||
} else if (!hasBindingToNote(orig)) {
|
} else if (!hasBindingToNote(orig)) {
|
||||||
return "Add Binding "+describeBinding(rev);
|
return "Add Binding " + describeBinding(rev);
|
||||||
} else {
|
} else {
|
||||||
return compareBindings(rev.getBinding(), orig.getBinding());
|
return compareBindings(rev.getBinding(), orig.getBinding());
|
||||||
}
|
}
|
||||||
@ -701,14 +646,14 @@ public class SpecDifferenceEvaluator {
|
|||||||
private String compareBindings(ElementDefinitionBindingComponent rev, ElementDefinitionBindingComponent orig) {
|
private String compareBindings(ElementDefinitionBindingComponent rev, ElementDefinitionBindingComponent orig) {
|
||||||
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder("\r\n");
|
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder("\r\n");
|
||||||
if (rev.getStrength() != orig.getStrength())
|
if (rev.getStrength() != orig.getStrength())
|
||||||
b.append("Change binding strength from "+orig.getStrength().toCode()+" to "+rev.getStrength().toCode());
|
b.append("Change binding strength from " + orig.getStrength().toCode() + " to " + rev.getStrength().toCode());
|
||||||
if (!Base.compareDeep(rev.getValueSet(), orig.getValueSet(), false))
|
if (!Base.compareDeep(rev.getValueSet(), orig.getValueSet(), false))
|
||||||
b.append("Change value set from "+describeReference(orig.getValueSet())+" to "+describeReference(rev.getValueSet()));
|
b.append("Change value set from " + describeReference(orig.getValueSet()) + " to " + describeReference(rev.getValueSet()));
|
||||||
if (!maxValueSetsMatch(rev, orig))
|
if (!maxValueSetsMatch(rev, orig))
|
||||||
b.append("Change max value set from "+describeMax(orig)+" to "+describeMax(rev));
|
b.append("Change max value set from " + describeMax(orig) + " to " + describeMax(rev));
|
||||||
if (rev.getStrength() == BindingStrength.REQUIRED && orig.getStrength() == BindingStrength.REQUIRED) {
|
if (rev.getStrength() == BindingStrength.REQUIRED && orig.getStrength() == BindingStrength.REQUIRED) {
|
||||||
ValueSet vrev = getValueSet(rev.getValueSet(), revision.expansions);
|
ValueSet vrev = getValueSet(rev.getValueSet(), revision.getExpansions());
|
||||||
ValueSet vorig = getValueSet(rev.getValueSet(), original.expansions);
|
ValueSet vorig = getValueSet(rev.getValueSet(), original.getExpansions());
|
||||||
CommaSeparatedStringBuilder br = new CommaSeparatedStringBuilder();
|
CommaSeparatedStringBuilder br = new CommaSeparatedStringBuilder();
|
||||||
int ir = 0;
|
int ir = 0;
|
||||||
CommaSeparatedStringBuilder bo = new CommaSeparatedStringBuilder();
|
CommaSeparatedStringBuilder bo = new CommaSeparatedStringBuilder();
|
||||||
@ -717,29 +662,29 @@ public class SpecDifferenceEvaluator {
|
|||||||
for (ValueSetExpansionContainsComponent cc : vorig.getExpansion().getContains()) {
|
for (ValueSetExpansionContainsComponent cc : vorig.getExpansion().getContains()) {
|
||||||
if (!hasCode(vrev, cc)) {
|
if (!hasCode(vrev, cc)) {
|
||||||
io++;
|
io++;
|
||||||
bo.append("`"+Utilities.escapeXml(cc.getCode())+"`");
|
bo.append("`" + Utilities.escapeXml(cc.getCode()) + "`");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (ValueSetExpansionContainsComponent cc : vrev.getExpansion().getContains()) {
|
for (ValueSetExpansionContainsComponent cc : vrev.getExpansion().getContains()) {
|
||||||
if (!hasCode(vorig, cc)) {
|
if (!hasCode(vorig, cc)) {
|
||||||
ir++;
|
ir++;
|
||||||
br.append("`"+Utilities.escapeXml(cc.getCode())+"`");
|
br.append("`" + Utilities.escapeXml(cc.getCode()) + "`");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (io > 0)
|
if (io > 0)
|
||||||
b.append("Remove "+Utilities.pluralize("Code", io)+" "+bo);
|
b.append("Remove " + Utilities.pluralize("Code", io) + " " + bo);
|
||||||
if (ir > 0)
|
if (ir > 0)
|
||||||
b.append("Add "+Utilities.pluralize("Code", ir)+" "+br);
|
b.append("Add " + Utilities.pluralize("Code", ir) + " " + br);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (rev.getStrength() == BindingStrength.EXTENSIBLE && orig.getStrength() == BindingStrength.EXTENSIBLE) {
|
if (rev.getStrength() == BindingStrength.EXTENSIBLE && orig.getStrength() == BindingStrength.EXTENSIBLE) {
|
||||||
ValueSet vrev = getValueSet(rev.getValueSet(), revision.valuesets);
|
ValueSet vrev = getValueSet(rev.getValueSet(), revision.getValuesets());
|
||||||
ValueSet vorig = getValueSet(orig.getValueSet(), original.valuesets);
|
ValueSet vorig = getValueSet(orig.getValueSet(), original.getValuesets());
|
||||||
if (vrev != null && vrev.hasCompose() && vrev.getCompose().getInclude().size() == 1 && vrev.getCompose().getIncludeFirstRep().hasSystem() &&
|
if (vrev != null && vrev.hasCompose() && vrev.getCompose().getInclude().size() == 1 && vrev.getCompose().getIncludeFirstRep().hasSystem() &&
|
||||||
vorig != null && vorig.hasCompose() && vorig.getCompose().getInclude().size() == 1 && vorig.getCompose().getIncludeFirstRep().hasSystem()) {
|
vorig != null && vorig.hasCompose() && vorig.getCompose().getInclude().size() == 1 && vorig.getCompose().getIncludeFirstRep().hasSystem()) {
|
||||||
if (!vorig.getCompose().getIncludeFirstRep().getSystem().equals(vrev.getCompose().getIncludeFirstRep().getSystem())) {
|
if (!vorig.getCompose().getIncludeFirstRep().getSystem().equals(vrev.getCompose().getIncludeFirstRep().getSystem())) {
|
||||||
b.append("Change code system for extensibly bound codes from \""+vorig.getCompose().getIncludeFirstRep().getSystem()+"\" to \""+vrev.getCompose().getIncludeFirstRep().getSystem()+"\"");
|
b.append("Change code system for extensibly bound codes from \"" + vorig.getCompose().getIncludeFirstRep().getSystem() + "\" to \"" + vrev.getCompose().getIncludeFirstRep().getSystem() + "\"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -750,7 +695,7 @@ public class SpecDifferenceEvaluator {
|
|||||||
private String describeMax(ElementDefinitionBindingComponent orig) {
|
private String describeMax(ElementDefinitionBindingComponent orig) {
|
||||||
if (!orig.hasExtension(ToolingExtensions.EXT_MAX_VALUESET))
|
if (!orig.hasExtension(ToolingExtensions.EXT_MAX_VALUESET))
|
||||||
return "n/a";
|
return "n/a";
|
||||||
return "`"+ToolingExtensions.readStringExtension(orig, ToolingExtensions.EXT_MAX_VALUESET)+"`";
|
return "`" + ToolingExtensions.readStringExtension(orig, ToolingExtensions.EXT_MAX_VALUESET) + "`";
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean maxValueSetsMatch(ElementDefinitionBindingComponent rev, ElementDefinitionBindingComponent orig) {
|
private boolean maxValueSetsMatch(ElementDefinitionBindingComponent rev, ElementDefinitionBindingComponent orig) {
|
||||||
@ -766,9 +711,9 @@ public class SpecDifferenceEvaluator {
|
|||||||
|
|
||||||
private String describeBinding(ElementDefinition orig) {
|
private String describeBinding(ElementDefinition orig) {
|
||||||
if (orig.getBinding().hasExtension(ToolingExtensions.EXT_MAX_VALUESET))
|
if (orig.getBinding().hasExtension(ToolingExtensions.EXT_MAX_VALUESET))
|
||||||
return "`"+orig.getBinding().getValueSet()+"` ("+orig.getBinding().getStrength().toCode()+"), max =`"+ ToolingExtensions.readStringExtension(orig.getBinding(), ToolingExtensions.EXT_MAX_VALUESET)+"`";
|
return "`" + orig.getBinding().getValueSet() + "` (" + orig.getBinding().getStrength().toCode() + "), max =`" + ToolingExtensions.readStringExtension(orig.getBinding(), ToolingExtensions.EXT_MAX_VALUESET) + "`";
|
||||||
else
|
else
|
||||||
return "`"+orig.getBinding().getValueSet()+"` ("+orig.getBinding().getStrength().toCode()+")";
|
return "`" + orig.getBinding().getValueSet() + "` (" + orig.getBinding().getStrength().toCode() + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void describeBinding(JsonObject element, String name, ElementDefinition orig) {
|
private void describeBinding(JsonObject element, String name, ElementDefinition orig) {
|
||||||
@ -829,7 +774,7 @@ public class SpecDifferenceEvaluator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String tail(String path) {
|
private String tail(String path) {
|
||||||
return path.contains(".") ? path.substring(path.lastIndexOf(".")+1) : path;
|
return path.contains(".") ? path.substring(path.lastIndexOf(".") + 1) : path;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String head(String path) {
|
private String head(String path) {
|
||||||
@ -845,11 +790,11 @@ public class SpecDifferenceEvaluator {
|
|||||||
r = "uri";
|
r = "uri";
|
||||||
String o = describeType(orig.getType().get(0));
|
String o = describeType(orig.getType().get(0));
|
||||||
if (r == null && o == null)
|
if (r == null && o == null)
|
||||||
System.out.println("null @ "+rev.getPath());
|
System.out.println("null @ " + rev.getPath());
|
||||||
if (r.contains("(") && o.contains("(") && r.startsWith(o.substring(0, o.indexOf("(")+1))) {
|
if (r.contains("(") && o.contains("(") && r.startsWith(o.substring(0, o.indexOf("(") + 1))) {
|
||||||
compareParameters(bp, rev.getType().get(0), orig.getType().get(0));
|
compareParameters(bp, rev.getType().get(0), orig.getType().get(0));
|
||||||
} else if (!r.equals(o))
|
} else if (!r.equals(o))
|
||||||
bp.append("Type changed from "+o+" to "+r);
|
bp.append("Type changed from " + o + " to " + r);
|
||||||
} else {
|
} else {
|
||||||
CommaSeparatedStringBuilder removed = new CommaSeparatedStringBuilder();
|
CommaSeparatedStringBuilder removed = new CommaSeparatedStringBuilder();
|
||||||
CommaSeparatedStringBuilder added = new CommaSeparatedStringBuilder();
|
CommaSeparatedStringBuilder added = new CommaSeparatedStringBuilder();
|
||||||
@ -869,9 +814,9 @@ public class SpecDifferenceEvaluator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (added.length() > 0)
|
if (added.length() > 0)
|
||||||
bp.append("Add "+Utilities.pluralize("Type", added.count())+" "+added.toString());
|
bp.append("Add " + Utilities.pluralize("Type", added.count()) + " " + added.toString());
|
||||||
if (removed.length() > 0)
|
if (removed.length() > 0)
|
||||||
bp.append("Remove "+Utilities.pluralize("Type", removed.count())+" "+removed.toString());
|
bp.append("Remove " + Utilities.pluralize("Type", removed.count()) + " " + removed.toString());
|
||||||
if (retargetted.length() > 0)
|
if (retargetted.length() > 0)
|
||||||
bp.append(retargetted.toString());
|
bp.append(retargetted.toString());
|
||||||
}
|
}
|
||||||
@ -894,9 +839,9 @@ public class SpecDifferenceEvaluator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!added.isEmpty())
|
if (!added.isEmpty())
|
||||||
bp.append("Type " +tr.getWorkingCode()+": Added Target "+Utilities.pluralize("Type", added.size())+" "+csv(added));
|
bp.append("Type " + tr.getWorkingCode() + ": Added Target " + Utilities.pluralize("Type", added.size()) + " " + csv(added));
|
||||||
if (!removed.isEmpty())
|
if (!removed.isEmpty())
|
||||||
bp.append("Type " +tr.getWorkingCode()+": Removed Target "+Utilities.pluralize("Type", removed.size())+" "+csv(removed));
|
bp.append("Type " + tr.getWorkingCode() + ": Removed Target " + Utilities.pluralize("Type", removed.size()) + " " + csv(removed));
|
||||||
}
|
}
|
||||||
|
|
||||||
private String trimNS(String v) {
|
private String trimNS(String v) {
|
||||||
@ -980,17 +925,17 @@ public class SpecDifferenceEvaluator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void saveR4AsR5(ZipGenerator zip, FhirFormat fmt) throws IOException {
|
public void saveR4AsR5(ZipGenerator zip, FhirFormat fmt) throws IOException {
|
||||||
for (StructureDefinition t : original.types.values())
|
for (StructureDefinition t : original.getTypes().values())
|
||||||
saveResource(zip, t, fmt);
|
saveResource(zip, t, fmt);
|
||||||
for (StructureDefinition t : original.resources.values())
|
for (StructureDefinition t : original.getResources().values())
|
||||||
saveResource(zip, t, fmt);
|
saveResource(zip, t, fmt);
|
||||||
for (StructureDefinition t : original.profiles.values())
|
for (StructureDefinition t : original.getProfiles().values())
|
||||||
saveResource(zip, t, fmt);
|
saveResource(zip, t, fmt);
|
||||||
for (StructureDefinition t : original.extensions.values())
|
for (StructureDefinition t : original.getExtensions().values())
|
||||||
saveResource(zip, t, fmt);
|
saveResource(zip, t, fmt);
|
||||||
for (ValueSet t : original.valuesets.values())
|
for (ValueSet t : original.getValuesets().values())
|
||||||
saveResource(zip, t, fmt);
|
saveResource(zip, t, fmt);
|
||||||
for (ValueSet t : original.expansions.values())
|
for (ValueSet t : original.getExpansions().values())
|
||||||
saveResource(zip, t, fmt);
|
saveResource(zip, t, fmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1000,7 +945,7 @@ public class SpecDifferenceEvaluator {
|
|||||||
new JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(bs, t);
|
new JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(bs, t);
|
||||||
else
|
else
|
||||||
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(bs, t);
|
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(bs, t);
|
||||||
zip.addBytes(t.fhirType()+"-"+t.getId()+"."+fmt.getExtension(), bs.toByteArray(), true);
|
zip.addBytes(t.fhirType() + "-" + t.getId() + "." + fmt.getExtension(), bs.toByteArray(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void compareJson(JsonObject type, StructureDefinition orig, StructureDefinition rev) {
|
private void compareJson(JsonObject type, StructureDefinition orig, StructureDefinition rev) {
|
||||||
@ -1037,7 +982,7 @@ public class SpecDifferenceEvaluator {
|
|||||||
changed = true;
|
changed = true;
|
||||||
boolean marked = false;
|
boolean marked = false;
|
||||||
for (String s : dels)
|
for (String s : dels)
|
||||||
if (ed.getPath().startsWith(s+"."))
|
if (ed.getPath().startsWith(s + "."))
|
||||||
marked = true;
|
marked = true;
|
||||||
if (!marked) {
|
if (!marked) {
|
||||||
dels.add(ed.getPath());
|
dels.add(ed.getPath());
|
||||||
@ -1097,7 +1042,7 @@ public class SpecDifferenceEvaluator {
|
|||||||
changed = true;
|
changed = true;
|
||||||
boolean marked = false;
|
boolean marked = false;
|
||||||
for (String s : dels)
|
for (String s : dels)
|
||||||
if (ed.getPath().startsWith(s+"."))
|
if (ed.getPath().startsWith(s + "."))
|
||||||
marked = true;
|
marked = true;
|
||||||
if (!marked) {
|
if (!marked) {
|
||||||
dels.add(ed.getPath());
|
dels.add(ed.getPath());
|
||||||
@ -1301,9 +1246,9 @@ public class SpecDifferenceEvaluator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (added.size() > 0)
|
if (added.size() > 0)
|
||||||
element.add(tr.getWorkingCode()+"-target-added", added);
|
element.add(tr.getWorkingCode() + "-target-added", added);
|
||||||
if (removed.size() > 0)
|
if (removed.size() > 0)
|
||||||
element.add(tr.getWorkingCode()+"-target-removed", removed);
|
element.add(tr.getWorkingCode() + "-target-removed", removed);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void analyseTypes(Document doc, Element element, ElementDefinition rev, ElementDefinition orig) {
|
private void analyseTypes(Document doc, Element element, ElementDefinition rev, ElementDefinition orig) {
|
||||||
@ -1340,13 +1285,13 @@ public class SpecDifferenceEvaluator {
|
|||||||
|
|
||||||
for (CanonicalType p : tr.getTargetProfile()) {
|
for (CanonicalType p : tr.getTargetProfile()) {
|
||||||
if (!hasParam(tm, p.asStringValue())) {
|
if (!hasParam(tm, p.asStringValue())) {
|
||||||
element.appendChild(makeElementWithAttribute(doc, tr.getWorkingCode()+"-target-added", "name", p.asStringValue()));
|
element.appendChild(makeElementWithAttribute(doc, tr.getWorkingCode() + "-target-added", "name", p.asStringValue()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (CanonicalType p : tm.getTargetProfile()) {
|
for (CanonicalType p : tm.getTargetProfile()) {
|
||||||
if (!hasParam(tr, p.asStringValue())) {
|
if (!hasParam(tr, p.asStringValue())) {
|
||||||
element.appendChild(makeElementWithAttribute(doc, tr.getWorkingCode()+"-target-removed", "name", p.asStringValue()));
|
element.appendChild(makeElementWithAttribute(doc, tr.getWorkingCode() + "-target-removed", "name", p.asStringValue()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1389,8 +1334,8 @@ public class SpecDifferenceEvaluator {
|
|||||||
if (rev.getStrength() == BindingStrength.REQUIRED && orig.getStrength() == BindingStrength.REQUIRED) {
|
if (rev.getStrength() == BindingStrength.REQUIRED && orig.getStrength() == BindingStrength.REQUIRED) {
|
||||||
JsonArray oa = new JsonArray();
|
JsonArray oa = new JsonArray();
|
||||||
JsonArray ra = new JsonArray();
|
JsonArray ra = new JsonArray();
|
||||||
ValueSet vrev = getValueSet(rev.getValueSet(), revision.expansions);
|
ValueSet vrev = getValueSet(rev.getValueSet(), revision.getExpansions());
|
||||||
ValueSet vorig = getValueSet(rev.getValueSet(), original.expansions);
|
ValueSet vorig = getValueSet(rev.getValueSet(), original.getExpansions());
|
||||||
if (vrev != null && vorig != null) {
|
if (vrev != null && vorig != null) {
|
||||||
for (ValueSetExpansionContainsComponent cc : vorig.getExpansion().getContains()) {
|
for (ValueSetExpansionContainsComponent cc : vorig.getExpansion().getContains()) {
|
||||||
if (!hasCode(vrev, cc))
|
if (!hasCode(vrev, cc))
|
||||||
@ -1445,13 +1390,13 @@ public class SpecDifferenceEvaluator {
|
|||||||
element.setAttribute("binding-valueset-changed", "true");
|
element.setAttribute("binding-valueset-changed", "true");
|
||||||
res = true;
|
res = true;
|
||||||
}
|
}
|
||||||
if (!maxValueSetsMatch(rev, orig)){
|
if (!maxValueSetsMatch(rev, orig)) {
|
||||||
element.setAttribute("max-valueset-changed", "true");
|
element.setAttribute("max-valueset-changed", "true");
|
||||||
res = true;
|
res = true;
|
||||||
}
|
}
|
||||||
if (rev.getStrength() == BindingStrength.REQUIRED && orig.getStrength() == BindingStrength.REQUIRED) {
|
if (rev.getStrength() == BindingStrength.REQUIRED && orig.getStrength() == BindingStrength.REQUIRED) {
|
||||||
ValueSet vrev = getValueSet(rev.getValueSet(), revision.expansions);
|
ValueSet vrev = getValueSet(rev.getValueSet(), revision.getExpansions());
|
||||||
ValueSet vorig = getValueSet(rev.getValueSet(), original.expansions);
|
ValueSet vorig = getValueSet(rev.getValueSet(), original.getExpansions());
|
||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
if (vrev != null && vorig != null) {
|
if (vrev != null && vorig != null) {
|
||||||
for (ValueSetExpansionContainsComponent cc : vorig.getExpansion().getContains()) {
|
for (ValueSetExpansionContainsComponent cc : vorig.getExpansion().getContains()) {
|
||||||
@ -1474,5 +1419,4 @@ public class SpecDifferenceEvaluator {
|
|||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -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));
|
||||||
|
@ -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));
|
||||||
|
@ -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));
|
||||||
|
@ -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());
|
||||||
|
@ -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);
|
||||||
|
@ -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);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package org.hl7.fhir.convertors;
|
package org.hl7.fhir.convertors.advisors;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2011+, HL7, Inc.
|
Copyright (c) 2011+, HL7, Inc.
|
||||||
@ -28,9 +28,6 @@ package org.hl7.fhir.convertors;
|
|||||||
POSSIBILITY OF SUCH DAMAGE.
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
|
|
||||||
/**
|
/**
|
@ -1,4 +1,4 @@
|
|||||||
package org.hl7.fhir.convertors;
|
package org.hl7.fhir.convertors.advisors;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2011+, HL7, Inc.
|
Copyright (c) 2011+, HL7, Inc.
|
||||||
@ -28,9 +28,6 @@ package org.hl7.fhir.convertors;
|
|||||||
POSSIBILITY OF SUCH DAMAGE.
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package org.hl7.fhir.convertors;
|
package org.hl7.fhir.convertors.advisors;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright (c) 2011+, HL7, Inc.
|
Copyright (c) 2011+, HL7, Inc.
|
||||||
@ -28,9 +28,6 @@ package org.hl7.fhir.convertors;
|
|||||||
POSSIBILITY OF SUCH DAMAGE.
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
|
|
||||||
public interface VersionConvertorAdvisor50 {
|
public interface VersionConvertorAdvisor50 {
|
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
@ -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) {
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
|
@ -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) {
|
||||||
|
@ -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;
|
||||||
|
@ -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) {
|
||||||
|
@ -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) {
|
||||||
|
@ -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) {
|
||||||
|
@ -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;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
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.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
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.
|
||||||
|
@ -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;
|
||||||
@ -89,7 +55,6 @@ public class NpmPackageVersionConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public List<String> getErrors() {
|
public List<String> getErrors() {
|
||||||
return errors;
|
return errors;
|
||||||
}
|
}
|
||||||
@ -99,7 +64,7 @@ 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<>();
|
||||||
|
|
||||||
@ -156,7 +121,7 @@ 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) {
|
||||||
@ -175,7 +140,7 @@ 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);
|
||||||
@ -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();
|
||||||
@ -283,10 +248,10 @@ public class NpmPackageVersionConverter {
|
|||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package org.hl7.fhir.convertors
|
||||||
|
|
||||||
|
data class SourceElementComponentWrapper<A>(
|
||||||
|
var comp: A,
|
||||||
|
var source: String,
|
||||||
|
var target: String
|
||||||
|
)
|
@ -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()
|
||||||
|
)
|
@ -0,0 +1,3 @@
|
|||||||
|
package org.hl7.fhir.convertors
|
||||||
|
|
||||||
|
data class StringReplacement(var source: String, var replacement: String)
|
@ -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)
|
||||||
|
|
@ -0,0 +1,5 @@
|
|||||||
|
package org.hl7.fhir.convertors
|
||||||
|
|
||||||
|
interface TypeLinkProvider {
|
||||||
|
fun getLink(typeName: String?): String?
|
||||||
|
}
|
@ -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 {
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
|
@ -30,10 +30,8 @@ package org.hl7.fhir.r5.model;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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
|
||||||
@ -57,13 +55,18 @@ public class IntegerType extends PrimitiveType<Integer> implements IBaseIntegerD
|
|||||||
setValue(theInteger);
|
setValue(theInteger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
public IntegerType(Integer theInteger) {
|
||||||
|
setValue(theInteger);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param theIntegerAsString
|
* @param theIntegerAsString A string representation of an integer
|
||||||
* A string representation of an integer
|
* @throws IllegalArgumentException If the string is not a valid integer representation
|
||||||
* @throws IllegalArgumentException
|
|
||||||
* If the string is not a valid integer representation
|
|
||||||
*/
|
*/
|
||||||
public IntegerType(String theIntegerAsString) {
|
public IntegerType(String theIntegerAsString) {
|
||||||
setValueAsString(theIntegerAsString);
|
setValueAsString(theIntegerAsString);
|
||||||
@ -80,8 +83,8 @@ public class IntegerType extends PrimitiveType<Integer> implements IBaseIntegerD
|
|||||||
throw new IllegalArgumentException
|
throw new IllegalArgumentException
|
||||||
(theValue + " cannot be cast to int without changing its value.");
|
(theValue + " cannot be cast to int without changing its value.");
|
||||||
}
|
}
|
||||||
if(theValue!=null) {
|
if (theValue != null) {
|
||||||
setValue((int)theValue.longValue());
|
setValue((int) theValue.longValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,6 +104,7 @@ public class IntegerType extends PrimitiveType<Integer> implements IBaseIntegerD
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IntegerType copy() {
|
public IntegerType copy() {
|
||||||
|
// IntegerType ret = getValue() == null ? new IntegerType() : new IntegerType(getValue());
|
||||||
IntegerType ret = new IntegerType(getValue());
|
IntegerType ret = new IntegerType(getValue());
|
||||||
copyValues(ret);
|
copyValues(ret);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -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());
|
||||||
|
}
|
||||||
|
}
|
@ -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>
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
|
@ -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
89
pom.xml
@ -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>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user