Fix issue rendering resource by name

This commit is contained in:
Grahame Grieve 2022-11-14 18:04:27 +11:00
parent 4d16fe46c0
commit 231aae6043
3 changed files with 27 additions and 6 deletions

View File

@ -223,8 +223,24 @@ public class DirectWrappers {
s = s + " " + family.getValues().get(0).primitiveValue().toUpperCase();
return s;
} else {
// it might be a human name?
throw new Error("What to do? Type is "+b.fhirType());
Property p = b.getChildByName("name");
if (p == null || !p.hasValues()) {
p = b.getChildByName("name");
}
if (p == null || !p.hasValues()) {
p = b.getChildByName("text");
}
if (p == null || !p.hasValues()) {
p = b.getChildByName("value");
}
if (p == null || !p.hasValues()) {
p = b.getChildByName("productName"); // MedicinalProductDefinition
}
if (p == null || !p.hasValues()) {
throw new Error("What to render for 'name'? Type is "+b.fhirType());
} else {
return p.getValues().get(0).primitiveValue();
}
}
}
return null;

View File

@ -559,7 +559,7 @@ public class NpmPackage {
for (JsonElement e : folder.index.getAsJsonArray("files")) {
JsonObject fi = e.getAsJsonObject();
if (Utilities.existsInList(JsonUtilities.str(fi, "resourceType"), types)) {
res.add(new PackageResourceInformation(folder.folder.getAbsolutePath(), fi));
res.add(new PackageResourceInformation(folder.folder == null ? "@"+folder.getName() : folder.folder.getAbsolutePath(), fi));
}
}
}
@ -1159,8 +1159,13 @@ public class NpmPackage {
}
public InputStream load(PackageResourceInformation p) throws FileNotFoundException {
if (p.filename.startsWith("@")) {
String[] pl = p.filename.substring(1).split("\\/");
return new ByteArrayInputStream(folders.get(pl[0]).content.get(pl[1]));
} else {
return new FileInputStream(p.filename);
}
}
public Date dateAsDate() {
try {

View File

@ -550,8 +550,8 @@ SEARCHPARAMETER_EXP_WRONG = The expression ''{2}'' is not compatible with the ex
VALUESET_NO_SYSTEM_WARNING = No System specified, so Concepts and Filters can't be checked
VALUESET_INCLUDE_INVALID_CONCEPT_CODE = The code {1} is not valid in the system {0}
VALUESET_INCLUDE_INVALID_CONCEPT_CODE_VER = The code {2} is not valid in the system {0} version {1}
VALUESET_UNC_SYSTEM_WARNING = Unknown System ''{0}'' specified, so Concepts and Filters can't be checked
VALUESET_UNC_SYSTEM_WARNING_VER = Unknown System/Version ''{0}'' specified, so Concepts and Filters can't be checked
VALUESET_UNC_SYSTEM_WARNING = Unknown System ''{0}'' specified, so Concepts and Filters can''t be checked (Details: {1})
VALUESET_UNC_SYSTEM_WARNING_VER = Unknown System/Version ''{0}'' specified, so Concepts and Filters can''t be checked (Details: {1})
Extension_PROF_Type = The Profile ''{0}'' definition allows for the type {1} but found type {2}
TYPE_CHECKS_PATTERN_CC = The pattern [system {0}, code {1}, and display ''{2}''] defined in the profile {3} not found. Issues: {4}
TYPE_CHECKS_PATTERN_CC_US = The pattern [system {0}, code {1}, display ''{2}'' and userSelected {5}] defined in the profile {3} not found. Issues: {4}