cross-version extensions

This commit is contained in:
Grahame Grieve 2023-09-15 10:15:50 -07:00
parent 71def00e24
commit 34a029d5df
2 changed files with 20 additions and 11 deletions

View File

@ -16,8 +16,9 @@ public class PackageInformation {
private String web; private String web;
private List<String> dependencies = new ArrayList<>(); private List<String> dependencies = new ArrayList<>();
private String fhirVersion;
public PackageInformation(String id, String version, Date date, String name, String canonical, String web) { public PackageInformation(String id, String version, String fhirVersion, Date date, String name, String canonical, String web) {
super(); super();
this.id = id; this.id = id;
this.version = version; this.version = version;
@ -25,12 +26,14 @@ public class PackageInformation {
this.name = name; this.name = name;
this.canonical = canonical; this.canonical = canonical;
this.web = web; this.web = web;
this.fhirVersion = fhirVersion;
} }
public PackageInformation(String src, Date date) { public PackageInformation(String src, String fhirVersion, Date date) {
super(); super();
this.id = src; this.id = src;
this.date = date; this.date = date;
this.fhirVersion = fhirVersion;
} }
public PackageInformation(NpmPackage pi) { public PackageInformation(NpmPackage pi) {
@ -41,13 +44,15 @@ public class PackageInformation {
this.name = pi.title(); this.name = pi.title();
this.canonical = pi.canonical(); this.canonical = pi.canonical();
this.web = pi.getWebLocation(); this.web = pi.getWebLocation();
this.fhirVersion = pi.fhirVersion();
dependencies.addAll(pi.dependencies()); dependencies.addAll(pi.dependencies());
} }
public PackageInformation(String id, String version, Date date) { public PackageInformation(String id, String version, String fhirVersion, Date date) {
super(); super();
this.id = id; this.id = id;
this.version = version; this.version = version;
this.fhirVersion = fhirVersion;
this.date = date; this.date = date;
} }
@ -93,6 +98,10 @@ public class PackageInformation {
return id+"#"+version; return id+"#"+version;
} }
public String getFhirVersion() {
return fhirVersion;
}
public String toString() { public String toString() {
return getVID(); return getVID();
} }

View File

@ -431,12 +431,12 @@ public class CanonicalResourceManagerTests {
vs2.setVersion("2000.0.0"); vs2.setVersion("2000.0.0");
vs2.setName("2"); vs2.setName("2");
mrm.see(vs1, new PackageInformation("hl7.fhir.r4.core", "4.0.1", new Date())); mrm.see(vs1, new PackageInformation("hl7.fhir.r4.core", "4.0.1", "4.0.1", new Date()));
Assertions.assertNotNull(mrm.get("http://terminology.hl7.org/ValueSet/234")); Assertions.assertNotNull(mrm.get("http://terminology.hl7.org/ValueSet/234"));
Assertions.assertNotNull(mrm.get("http://terminology.hl7.org/ValueSet/234", "2.0.0")); Assertions.assertNotNull(mrm.get("http://terminology.hl7.org/ValueSet/234", "2.0.0"));
Assertions.assertTrue(mrm.get("http://terminology.hl7.org/ValueSet/234").getName().equals("1")); Assertions.assertTrue(mrm.get("http://terminology.hl7.org/ValueSet/234").getName().equals("1"));
mrm.see(vs2, new PackageInformation("hl7.terminology.r4", "4.0.1", new Date())); mrm.see(vs2, new PackageInformation("hl7.terminology.r4", "4.0.1", "4.0.1", new Date()));
Assertions.assertNotNull(mrm.get("http://terminology.hl7.org/ValueSet/234")); Assertions.assertNotNull(mrm.get("http://terminology.hl7.org/ValueSet/234"));
Assertions.assertTrue(mrm.get("http://terminology.hl7.org/ValueSet/234").getName().equals("2")); Assertions.assertTrue(mrm.get("http://terminology.hl7.org/ValueSet/234").getName().equals("2"));
Assertions.assertNull(mrm.get("http://terminology.hl7.org/ValueSet/234", "2.0.0")); // this will get dropped completely because of UTG rules Assertions.assertNull(mrm.get("http://terminology.hl7.org/ValueSet/234", "2.0.0")); // this will get dropped completely because of UTG rules
@ -822,14 +822,14 @@ public class CanonicalResourceManagerTests {
vs1.setVersion("4.0.1"); vs1.setVersion("4.0.1");
vs1.setName("1"); vs1.setName("1");
DeferredLoadTestResource vs1d = new DeferredLoadTestResource(vs1); DeferredLoadTestResource vs1d = new DeferredLoadTestResource(vs1);
mrm.see(vs1, new PackageInformation("pid.one", "1.0.0", new Date())); mrm.see(vs1, new PackageInformation("pid.one", "1.0.0", "4.0.1", new Date()));
ValueSet vs2 = new ValueSet(); ValueSet vs2 = new ValueSet();
vs2.setId("2346"); vs2.setId("2346");
vs2.setUrl("http://url/ValueSet/234"); vs2.setUrl("http://url/ValueSet/234");
vs2.setVersion("4.0.1"); vs2.setVersion("4.0.1");
vs2.setName("2"); vs2.setName("2");
mrm.see(vs2, new PackageInformation("pid.two", "1.0.0", new Date())); mrm.see(vs2, new PackageInformation("pid.two", "1.0.0", "4.0.1", new Date()));
List<String> pvl1 = new ArrayList<>(); List<String> pvl1 = new ArrayList<>();
pvl1.add("pid.one#1.0.0"); pvl1.add("pid.one#1.0.0");
@ -862,14 +862,14 @@ public class CanonicalResourceManagerTests {
csb1.setUrl("http://url/CodeSystem/234"); csb1.setUrl("http://url/CodeSystem/234");
csb1.setVersion("4.0.1"); csb1.setVersion("4.0.1");
csb1.setName("1"); csb1.setName("1");
mrm.see(csb1, new PackageInformation("pid.one", "1.0.0", new Date())); mrm.see(csb1, new PackageInformation("pid.one", "1.0.0", "4.0.1", new Date()));
CodeSystem csb2 = new CodeSystem(); CodeSystem csb2 = new CodeSystem();
csb2.setId("2346"); csb2.setId("2346");
csb2.setUrl("http://url/CodeSystem/234"); csb2.setUrl("http://url/CodeSystem/234");
csb2.setVersion("4.0.1"); csb2.setVersion("4.0.1");
csb2.setName("2"); csb2.setName("2");
mrm.see(csb2, new PackageInformation("pid.two", "1.0.0", new Date())); mrm.see(csb2, new PackageInformation("pid.two", "1.0.0", "4.0.1", new Date()));
CodeSystem css1 = new CodeSystem(); CodeSystem css1 = new CodeSystem();
css1.setId("s2345"); css1.setId("s2345");
@ -877,7 +877,7 @@ public class CanonicalResourceManagerTests {
css1.setVersion("4.0.1"); css1.setVersion("4.0.1");
css1.setName("s1"); css1.setName("s1");
css1.setSupplements("http://url/CodeSystem/234"); css1.setSupplements("http://url/CodeSystem/234");
mrm.see(css1, new PackageInformation("pid.one", "1.0.0", new Date())); mrm.see(css1, new PackageInformation("pid.one", "1.0.0", "4.0.1", new Date()));
CodeSystem css2 = new CodeSystem(); CodeSystem css2 = new CodeSystem();
css2.setId("s2346"); css2.setId("s2346");
@ -885,7 +885,7 @@ public class CanonicalResourceManagerTests {
css2.setVersion("4.0.1"); css2.setVersion("4.0.1");
css2.setName("s2"); css2.setName("s2");
css2.setSupplements("http://url/CodeSystem/234"); css2.setSupplements("http://url/CodeSystem/234");
mrm.see(css2, new PackageInformation("pid.two", "1.0.0", new Date())); mrm.see(css2, new PackageInformation("pid.two", "1.0.0", "4.0.1", new Date()));
List<CodeSystem> sl = mrm.getSupplements("http://url/CodeSystem/234"); List<CodeSystem> sl = mrm.getSupplements("http://url/CodeSystem/234");
Assertions.assertEquals(2, sl.size()); Assertions.assertEquals(2, sl.size());