diff --git a/org.hl7.fhir.convertors/pom.xml b/org.hl7.fhir.convertors/pom.xml index 92190ed66..51932aaab 100644 --- a/org.hl7.fhir.convertors/pom.xml +++ b/org.hl7.fhir.convertors/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 4.1.23-SNAPSHOT + 4.1.24-SNAPSHOT ../pom.xml diff --git a/org.hl7.fhir.dstu2/pom.xml b/org.hl7.fhir.dstu2/pom.xml index 623493f3b..c61670827 100644 --- a/org.hl7.fhir.dstu2/pom.xml +++ b/org.hl7.fhir.dstu2/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 4.1.23-SNAPSHOT + 4.1.24-SNAPSHOT ../pom.xml diff --git a/org.hl7.fhir.dstu2016may/pom.xml b/org.hl7.fhir.dstu2016may/pom.xml index eff110ed5..114697ca2 100644 --- a/org.hl7.fhir.dstu2016may/pom.xml +++ b/org.hl7.fhir.dstu2016may/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 4.1.23-SNAPSHOT + 4.1.24-SNAPSHOT ../pom.xml diff --git a/org.hl7.fhir.dstu3/pom.xml b/org.hl7.fhir.dstu3/pom.xml index 27587bf69..db16f3295 100644 --- a/org.hl7.fhir.dstu3/pom.xml +++ b/org.hl7.fhir.dstu3/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 4.1.23-SNAPSHOT + 4.1.24-SNAPSHOT ../pom.xml diff --git a/org.hl7.fhir.r4/pom.xml b/org.hl7.fhir.r4/pom.xml index 79cbb6edf..8369aa31a 100644 --- a/org.hl7.fhir.r4/pom.xml +++ b/org.hl7.fhir.r4/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 4.1.23-SNAPSHOT + 4.1.24-SNAPSHOT ../pom.xml diff --git a/org.hl7.fhir.r5/pom.xml b/org.hl7.fhir.r5/pom.xml index 967302e9c..b058559da 100644 --- a/org.hl7.fhir.r5/pom.xml +++ b/org.hl7.fhir.r5/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 4.1.23-SNAPSHOT + 4.1.24-SNAPSHOT ../pom.xml @@ -111,12 +111,12 @@ com.atlassian.commonmark commonmark - test + test com.atlassian.commonmark commonmark-ext-gfm-tables - test + test diff --git a/org.hl7.fhir.utilities/pom.xml b/org.hl7.fhir.utilities/pom.xml index 2b7237660..3468e847b 100644 --- a/org.hl7.fhir.utilities/pom.xml +++ b/org.hl7.fhir.utilities/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 4.1.23-SNAPSHOT + 4.1.24-SNAPSHOT ../pom.xml diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/cache/PackageCacheManager.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/cache/PackageCacheManager.java index a9c911f7e..4a8274311 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/cache/PackageCacheManager.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/cache/PackageCacheManager.java @@ -31,9 +31,13 @@ import java.net.HttpURLConnection; import java.net.URL; import java.net.URLConnection; import java.sql.Timestamp; +import java.text.ParseException; +import java.text.SimpleDateFormat; import java.time.Instant; import java.util.ArrayList; import java.util.Collections; +import java.util.Comparator; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -48,6 +52,8 @@ import org.hl7.fhir.utilities.IniFile; import org.hl7.fhir.utilities.TextFile; import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.cache.NpmPackage.NpmPackageFolder; +import org.hl7.fhir.utilities.cache.PackageCacheManager.BuildRecord; +import org.hl7.fhir.utilities.cache.PackageCacheManager.BuildRecordSorter; import org.hl7.fhir.utilities.json.JSONUtil; import com.google.gson.GsonBuilder; @@ -71,6 +77,43 @@ import com.google.gson.JsonObject; */ public class PackageCacheManager { + public class BuildRecordSorter implements Comparator { + + @Override + public int compare(BuildRecord arg0, BuildRecord arg1) { + return arg1.date.compareTo(arg0.date); + } + } + + public class BuildRecord { + + private String url; + private String packageId; + private String repo; + private Date date; + public BuildRecord(String url, String packageId, String repo, Date date) { + super(); + this.url = url; + this.packageId = packageId; + this.repo = repo; + this.date = date; + } + public String getUrl() { + return url; + } + public String getPackageId() { + return packageId; + } + public String getRepo() { + return repo; + } + public Date getDate() { + return date; + } + + + } + /** if you don't provide and implementation of this interface, the PackageCacheManager will use the web directly. * * You can use this interface to @@ -369,7 +412,7 @@ public class PackageCacheManager { return null; } - public JsonArray loadFromBuildServer() throws IOException { + public void loadFromBuildServer() throws IOException, ParseException { buildLoaded = true; // whether it succeeds or not URL url = new URL("https://build.fhir.org/ig/qas.json?nocache=" + System.currentTimeMillis()); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); @@ -377,17 +420,29 @@ public class PackageCacheManager { InputStream json = connection.getInputStream(); buildInfo = (JsonArray) new com.google.gson.JsonParser().parse(TextFile.streamToString(json)); + List builds = new ArrayList<>(); + for (JsonElement n : buildInfo) { JsonObject o = (JsonObject) n; if (o.has("url") && o.has("package-id") && o.get("package-id").getAsString().contains(".")) { String u = o.get("url").getAsString(); if (u.contains("/ImplementationGuide/")) u = u.substring(0, u.indexOf("/ImplementationGuide/")); - recordMap(u, o.get("package-id").getAsString()); - ciList.put(o.get("package-id").getAsString(), "https://build.fhir.org/ig/"+o.get("repo").getAsString()); + builds.add(new BuildRecord(u, o.get("package-id").getAsString(), o.get("repo").getAsString(), readDate(o.get("date").getAsString()))); } } - return buildInfo; + Collections.sort(builds, new BuildRecordSorter()); + for (BuildRecord bld : builds) { + if (!ciList.containsKey(bld.getPackageId())) { + recordMap(bld.getUrl(), bld.getPackageId()); + ciList.put(bld.getPackageId(), "https://build.fhir.org/ig/"+bld.getRepo()); + } + } + } + + private Date readDate(String s) throws ParseException { + SimpleDateFormat sdf = new SimpleDateFormat("EEE, d MMM, yyyy HH:mm:ss Z"); + return sdf.parse(s); } public boolean isBuildLoaded() { @@ -405,7 +460,7 @@ public class PackageCacheManager { return null; } - public boolean checkBuildLoaded() throws IOException { + public boolean checkBuildLoaded() throws IOException, ParseException { if (isBuildLoaded()) return true; loadFromBuildServer(); diff --git a/org.hl7.fhir.validation.cli/pom.xml b/org.hl7.fhir.validation.cli/pom.xml index e559efc41..272d46da1 100644 --- a/org.hl7.fhir.validation.cli/pom.xml +++ b/org.hl7.fhir.validation.cli/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 4.1.23-SNAPSHOT + 4.1.24-SNAPSHOT ../pom.xml diff --git a/org.hl7.fhir.validation/pom.xml b/org.hl7.fhir.validation/pom.xml index ebab94dbc..3ab0e9536 100644 --- a/org.hl7.fhir.validation/pom.xml +++ b/org.hl7.fhir.validation/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 4.1.23-SNAPSHOT + 4.1.24-SNAPSHOT ../pom.xml diff --git a/pom.xml b/pom.xml index ad753014b..158eafff1 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ each other. It is fine to bump the point version of this POM without affecting HAPI FHIR. --> - 4.1.23-SNAPSHOT + 4.1.24-SNAPSHOT 4.1.0 diff --git a/release.bat b/release.bat index e005b2c58..6662a719c 100644 --- a/release.bat +++ b/release.bat @@ -1,7 +1,7 @@ @echo off -set oldver=4.1.22 -set newver=4.1.23 +set oldver=4.1.23 +set newver=4.1.24 echo .. echo =====================================================================