Merge branch 'master' of https://github.com/hapifhir/org.hl7.fhir.core
This commit is contained in:
commit
dc767031e5
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>org.hl7.fhir.core</artifactId>
|
||||
<version>5.3.5-SNAPSHOT</version>
|
||||
<version>5.3.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>org.hl7.fhir.core</artifactId>
|
||||
<version>5.3.5-SNAPSHOT</version>
|
||||
<version>5.3.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>org.hl7.fhir.core</artifactId>
|
||||
<version>5.3.5-SNAPSHOT</version>
|
||||
<version>5.3.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>org.hl7.fhir.core</artifactId>
|
||||
<version>5.3.5-SNAPSHOT</version>
|
||||
<version>5.3.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>org.hl7.fhir.core</artifactId>
|
||||
<version>5.3.5-SNAPSHOT</version>
|
||||
<version>5.3.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>org.hl7.fhir.core</artifactId>
|
||||
<version>5.3.5-SNAPSHOT</version>
|
||||
<version>5.3.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>org.hl7.fhir.core</artifactId>
|
||||
<version>5.3.5-SNAPSHOT</version>
|
||||
<version>5.3.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>org.hl7.fhir.core</artifactId>
|
||||
<version>5.3.5-SNAPSHOT</version>
|
||||
<version>5.3.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ public abstract class BasePackageCacheManager implements IPackageCacheManager {
|
|||
|
||||
private String getPackageUrl(String packageId, String server) throws IOException {
|
||||
PackageClient pc = myClientFactory.apply(server);
|
||||
List<PackageClient.PackageInfo> res = pc.search(packageId, null, null, false);
|
||||
List<PackageInfo> res = pc.search(packageId, null, null, false);
|
||||
if (res.size() == 0) {
|
||||
return null;
|
||||
} else {
|
||||
|
@ -135,12 +135,12 @@ public abstract class BasePackageCacheManager implements IPackageCacheManager {
|
|||
return null;
|
||||
}
|
||||
PackageClient pc = myClientFactory.apply(server);
|
||||
List<PackageClient.PackageInfo> res = pc.search(null, canonical, null, false);
|
||||
List<PackageInfo> res = pc.search(null, canonical, null, false);
|
||||
if (res.size() == 0) {
|
||||
return null;
|
||||
} else {
|
||||
// this is driven by HL7 Australia (http://hl7.org.au/fhir/ is the canonical url for the base package, and the root for all the others)
|
||||
for (PackageClient.PackageInfo pi : res) {
|
||||
for (PackageInfo pi : res) {
|
||||
if (canonical.equals(pi.getCanonical())) {
|
||||
return pi.getId();
|
||||
}
|
||||
|
|
|
@ -53,12 +53,10 @@ import java.io.FileNotFoundException;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.nio.channels.FileLock;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
@ -207,8 +205,8 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
|
|||
|
||||
private void listSpecs(Map<String, String> specList, String server) throws IOException {
|
||||
CachingPackageClient pc = new CachingPackageClient(server);
|
||||
List<PackageClient.PackageInfo> matches = pc.search(null, null, null, false);
|
||||
for (PackageClient.PackageInfo m : matches) {
|
||||
List<PackageInfo> matches = pc.search(null, null, null, false);
|
||||
for (PackageInfo m : matches) {
|
||||
if (!specList.containsKey(m.getId())) {
|
||||
specList.put(m.getId(), m.getUrl());
|
||||
}
|
||||
|
|
|
@ -10,8 +10,6 @@ import org.hl7.fhir.utilities.VersionUtilities;
|
|||
import org.hl7.fhir.utilities.json.JSONUtil;
|
||||
import org.hl7.fhir.utilities.json.JsonTrackingParser;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
@ -25,51 +23,6 @@ import java.util.Set;
|
|||
|
||||
public class PackageClient {
|
||||
|
||||
public class PackageInfo {
|
||||
private String id;
|
||||
private String version;
|
||||
private String fhirVersion;
|
||||
private String description;
|
||||
private String url;
|
||||
private String canonical;
|
||||
|
||||
public PackageInfo(String id, String version, String fhirVersion, String description, String url, String canonical) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.version = version;
|
||||
this.fhirVersion = fhirVersion;
|
||||
this.description = description;
|
||||
this.url = url;
|
||||
if (url == null && id != null && version != null) {
|
||||
url = Utilities.pathURL(address, id, version);
|
||||
}
|
||||
this.canonical = canonical;
|
||||
}
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
public String getFhirVersion() {
|
||||
return fhirVersion;
|
||||
}
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public String getCanonical() {
|
||||
return canonical;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return id+"#"+(version == null ? "?pc-pi?" : version)+(fhirVersion == null ? "": " ("+canonical+") for FHIR "+fhirVersion)+(url == null ? "" : " @"+url)+(description == null ? "" : " '"+description+"'");
|
||||
}
|
||||
}
|
||||
|
||||
private String address;
|
||||
private String cacheFolder;
|
||||
|
||||
|
@ -124,7 +77,13 @@ public class PackageClient {
|
|||
if (versions != null) {
|
||||
for (String v : sorted(versions.keySet())) {
|
||||
JsonObject obj = versions.getAsJsonObject(v);
|
||||
res.add(new PackageInfo(JSONUtil.str(obj, "name"), JSONUtil.str(obj, "version"), JSONUtil.str(obj, "FhirVersion"), JSONUtil.str(obj, "description"), JSONUtil.str(obj, "url"), JSONUtil.str(obj, "canonical")));
|
||||
res.add(new PackageInfo(JSONUtil.str(obj, "name"),
|
||||
JSONUtil.str(obj, "version"),
|
||||
JSONUtil.str(obj, "FhirVersion"),
|
||||
JSONUtil.str(obj, "description"),
|
||||
JSONUtil.str(obj, "url"),
|
||||
JSONUtil.str(obj, "canonical"),
|
||||
address));
|
||||
}
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
|
@ -158,7 +117,13 @@ public class PackageClient {
|
|||
JsonArray json = fetchJsonArray(Utilities.pathURL(address, "catalog?")+params.toString());
|
||||
for (JsonElement e : json) {
|
||||
JsonObject obj = (JsonObject) e;
|
||||
res.add(new PackageInfo(JSONUtil.str(obj, "Name", "name"), JSONUtil.str(obj, "Version", "version"), JSONUtil.str(obj, "FhirVersion", "fhirVersion"), JSONUtil.str(obj, "Description", "description"), JSONUtil.str(obj, "url"), JSONUtil.str(obj, "canonical")));
|
||||
res.add(new PackageInfo(JSONUtil.str(obj, "Name", "name"),
|
||||
JSONUtil.str(obj, "Version", "version"),
|
||||
JSONUtil.str(obj, "FhirVersion", "fhirVersion"),
|
||||
JSONUtil.str(obj, "Description", "description"),
|
||||
JSONUtil.str(obj, "url"),
|
||||
JSONUtil.str(obj, "canonical"),
|
||||
address));
|
||||
}
|
||||
} catch (IOException e1) {
|
||||
}
|
||||
|
@ -199,10 +164,10 @@ public class PackageClient {
|
|||
if (list.isEmpty()) {
|
||||
throw new IOException("Package not found: "+id);
|
||||
} else {
|
||||
String v = list.get(0).version;
|
||||
String v = list.get(0).getVersion();
|
||||
for (PackageInfo p : list) {
|
||||
if (VersionUtilities.isThisOrLater(v, p.version)) {
|
||||
v = p.version;
|
||||
if (VersionUtilities.isThisOrLater(v, p.getVersion())) {
|
||||
v = p.getVersion();
|
||||
}
|
||||
}
|
||||
return v;
|
||||
|
@ -216,8 +181,8 @@ public class PackageClient {
|
|||
} else {
|
||||
String v = majMinVersion;
|
||||
for (PackageInfo p : list) {
|
||||
if (VersionUtilities.isMajMinOrLaterPatch(v, p.version)) {
|
||||
v = p.version;
|
||||
if (VersionUtilities.isMajMinOrLaterPatch(v, p.getVersion())) {
|
||||
v = p.getVersion();
|
||||
}
|
||||
}
|
||||
return v;
|
||||
|
@ -259,7 +224,7 @@ public class PackageClient {
|
|||
}
|
||||
}
|
||||
if (version != null) {
|
||||
result.add(new PackageInfo(id, version, fVersion, description, url, pcanonical));
|
||||
result.add(new PackageInfo(id, version, fVersion, description, url, pcanonical, address));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,8 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.utilities.TextFile;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
|
@ -109,20 +111,29 @@ public class PackageGenerator {
|
|||
object.addProperty("version", value);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public PackageGenerator toolsVersion(int value) {
|
||||
object.addProperty("tools-version", value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public PackageGenerator fhirVersions(List<String> versions) {
|
||||
JsonArray fhirVersionsArray = new JsonArray();
|
||||
for (String version : versions) {
|
||||
fhirVersionsArray.add(version);
|
||||
}
|
||||
object.add("fhirVersions", fhirVersionsArray);
|
||||
return this;
|
||||
}
|
||||
|
||||
public PackageGenerator description(String value) {
|
||||
object.addProperty("description", value);
|
||||
return this;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PackageGenerator license(String value) {
|
||||
object.addProperty("license", value);
|
||||
return this;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PackageGenerator homepage(String value) {
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
package org.hl7.fhir.utilities.npm;
|
||||
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
|
||||
public class PackageInfo {
|
||||
private final String id;
|
||||
private final String version;
|
||||
private final String fhirVersion;
|
||||
private final String description;
|
||||
private final String url;
|
||||
private final String canonical;
|
||||
|
||||
public PackageInfo(String id, String version, String fhirVersion, String description, String url, String canonical) {
|
||||
this(id, version, fhirVersion, description, url, canonical, null);
|
||||
}
|
||||
|
||||
public PackageInfo(String id, String version, String fhirVersion, String description, String url, String canonical, String address) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.version = version;
|
||||
this.fhirVersion = fhirVersion;
|
||||
this.description = description;
|
||||
if (url == null && id != null && version != null) {
|
||||
this.url = Utilities.pathURL(address, id, version);
|
||||
} else {
|
||||
this.url = url;
|
||||
}
|
||||
this.canonical = canonical;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public String getFhirVersion() {
|
||||
return fhirVersion;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public String getCanonical() {
|
||||
return canonical;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return id + "#" + (version == null ? "?pc-pi?" : version) + (fhirVersion == null ? "" : " (" + canonical + ") for FHIR " + fhirVersion) + (url == null ? "" : " @" + url) + (description == null ? "" : " '" + description + "'");
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
package org.hl7.fhir.utilities.tests;
|
||||
|
||||
import org.hl7.fhir.utilities.npm.CachingPackageClient;
|
||||
import org.hl7.fhir.utilities.npm.PackageClient.PackageInfo;
|
||||
import org.hl7.fhir.utilities.npm.PackageInfo;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>org.hl7.fhir.core</artifactId>
|
||||
<version>5.3.5-SNAPSHOT</version>
|
||||
<version>5.3.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>org.hl7.fhir.core</artifactId>
|
||||
<version>5.3.5-SNAPSHOT</version>
|
||||
<version>5.3.6-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@ public class ValidationResponse {
|
|||
@JsonProperty("outcomes")
|
||||
public List<ValidationOutcome> outcomes = new ArrayList<>();
|
||||
|
||||
@JsonProperty("sessionToken")
|
||||
public String sessionToken;
|
||||
@JsonProperty("sessionId")
|
||||
public String sessionId;
|
||||
|
||||
public ValidationResponse() {}
|
||||
|
||||
|
@ -19,9 +19,9 @@ public class ValidationResponse {
|
|||
this(outcomes, null);
|
||||
}
|
||||
|
||||
public ValidationResponse(List<ValidationOutcome> outcomes, String sessionToken) {
|
||||
public ValidationResponse(List<ValidationOutcome> outcomes, String sessionId) {
|
||||
this.outcomes = outcomes;
|
||||
this.sessionToken = sessionToken;
|
||||
this.sessionId = sessionId;
|
||||
}
|
||||
|
||||
@JsonProperty("outcomes")
|
||||
|
@ -35,14 +35,14 @@ public class ValidationResponse {
|
|||
return this;
|
||||
}
|
||||
|
||||
@JsonProperty("sessionToken")
|
||||
public String getSessionToken() {
|
||||
return sessionToken;
|
||||
@JsonProperty("sessionId")
|
||||
public String getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
@JsonProperty("sessionToken")
|
||||
public ValidationResponse setSessionToken(String sessionToken) {
|
||||
this.sessionToken = sessionToken;
|
||||
@JsonProperty("sessionId")
|
||||
public ValidationResponse setSessionId(String sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,8 @@ public class ValidationService {
|
|||
System.out.println(" .. validate " + request.listSourceFiles());
|
||||
}
|
||||
|
||||
ValidationResponse response = new ValidationResponse();
|
||||
ValidationResponse response = new ValidationResponse().setSessionId(sessionId);
|
||||
|
||||
for (FileInfo fp : request.getFilesToValidate()) {
|
||||
List<ValidationMessage> messages = new ArrayList<>();
|
||||
validator.validate(fp.getFileContent().getBytes(), Manager.FhirFormat.getFhirFormat(fp.getFileType()),
|
||||
|
|
|
@ -10,7 +10,7 @@ import org.hl7.fhir.utilities.VersionUtilities;
|
|||
import org.hl7.fhir.utilities.npm.CachingPackageClient;
|
||||
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
|
||||
import org.hl7.fhir.utilities.npm.NpmPackage;
|
||||
import org.hl7.fhir.utilities.npm.PackageClient.PackageInfo;
|
||||
import org.hl7.fhir.utilities.npm.PackageInfo;
|
||||
import org.hl7.fhir.utilities.npm.ToolsVersion;
|
||||
|
||||
public class PackageValidator {
|
||||
|
|
4
pom.xml
4
pom.xml
|
@ -14,12 +14,12 @@
|
|||
HAPI FHIR
|
||||
-->
|
||||
<artifactId>org.hl7.fhir.core</artifactId>
|
||||
<version>5.3.5-SNAPSHOT</version>
|
||||
<version>5.3.6-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<properties>
|
||||
<hapi_fhir_version>5.1.0</hapi_fhir_version>
|
||||
<validator_test_case_version>1.1.57-SNAPSHOT</validator_test_case_version>
|
||||
<validator_test_case_version>1.1.57</validator_test_case_version>
|
||||
<junit_jupiter_version>5.7.1</junit_jupiter_version>
|
||||
<junit_platform_launcher_version>1.7.1</junit_platform_launcher_version>
|
||||
<maven_surefire_version>3.0.0-M4</maven_surefire_version>
|
||||
|
|
Loading…
Reference in New Issue