Merge branch '2024-10-gg-tx-server-auth-1' into do-20241021-tx-auth

This commit is contained in:
dotasek 2024-10-23 11:55:58 -04:00
commit ddb0a661dd
19 changed files with 91 additions and 51 deletions

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>6.3.33-SNAPSHOT</version>
<version>6.4.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>6.3.33-SNAPSHOT</version>
<version>6.4.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>6.3.33-SNAPSHOT</version>
<version>6.4.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>6.3.33-SNAPSHOT</version>
<version>6.4.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>6.3.33-SNAPSHOT</version>
<version>6.4.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -60,6 +60,29 @@ import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;
/**
*
* The easiest way to generate code is to use the FHIR Validator, which can generate java classes for profiles
* using this code. Parameters:
*
* -codegen -version r4 -ig hl7.fhir.dk.core#3.2.0 -profiles http://hl7.dk/fhir/core/StructureDefinition/dk-core-gln-identifier,http://hl7.dk/fhir/core/StructureDefinition/dk-core-patient -output /Users/grahamegrieve/temp/codegen -package-name org.hl7.fhir.test
*
* Parameter Documentation:
* -codegen: tells the validator to generate code
* -version {r4|5}: which version to generate for
* -ig {name}: loads an IG (and it's dependencies) - see -ig documentation for the validator
* -profiles {list}: a comma separated list of profile URLs to generate code for
* -output {folder}: the folder where to generate the output java class source code
* -package-name {name}: the name of the java package to generate in
*
* options
* -option {name}: a code generation option, one of:
*
* narrative: generate code for the resource narrative (recommended: don't - leave that for the native resource level)
* meta: generate code the what's in meta
* contained: generate code for contained resources
* all-elements: generate code for all elements, not just the key elements (makes the code verbose)
*/
public class PECodeGenerator {
@ -229,7 +252,7 @@ public class PECodeGenerator {
w(enums, " public enum "+name+" {");
for (int i = 0; i < vse.getValueset().getExpansion().getContains().size(); i++) {
ValueSetExpansionContainsComponent cc = vse.getValueset().getExpansion().getContains().get(i);
String code = Utilities.nmtokenize(cc.getCode()).toUpperCase();
String code = Utilities.javaTokenize(cc.getCode(), true).toUpperCase();
if (cc.getAbstract()) {
code = "_"+code;
}
@ -375,7 +398,12 @@ public class PECodeGenerator {
private void genLoad(boolean isPrim, boolean isAbstract, String name, String sname, String type, String init, String ptype, String ltype, String cname, String csname, boolean isList, boolean isFixed, PEType typeInfo, boolean isEnum) {
if (isList) {
w(load, " for (PEInstance item : src.children(\""+sname+"\")) {");
w(load, " "+name+".add(("+type+") item.asDataType());");
if ("BackboneElement".equals(type)) {
w(load, " "+name+".add(("+type+") item.asElement());");
} else {
w(load, " "+name+".add(("+type+") item.asDataType());");
}
w(load, " }");
} else if (isEnum) {
w(load, " if (src.hasChild(\""+name+"\")) {");
@ -384,7 +412,7 @@ public class PECodeGenerator {
} else if ("Coding".equals(typeInfo.getName())) {
w(load, " "+name+" = "+type+".fromCoding((Coding) src.child(\""+name+"\").asDataType());");
} else {
w(load, " "+name+" = "+type+".fromCode(src.child(\""+name+"\").asDataType()).primitiveValue());");
w(load, " "+name+" = "+type+".fromCode(src.child(\""+name+"\").asDataType().primitiveValue());");
}
w(load, " }");
} else if (isPrim) {
@ -402,7 +430,11 @@ public class PECodeGenerator {
w(load, " }");
} else {
w(load, " if (src.hasChild(\""+name+"\")) {");
w(load, " "+name+" = ("+type+") src.child(\""+name+"\").asDataType();");
if ("BackboneElement".equals(type)) {
w(load, " "+name+" = ("+type+") src.child(\""+name+"\").asElement();");
} else {
w(load, " "+name+" = ("+type+") src.child(\""+name+"\").asDataType();");
}
w(load, " }");
}
}
@ -424,7 +456,7 @@ public class PECodeGenerator {
} else if ("Coding".equals(typeInfo.getName())) {
w(save, " tgt.addChild(\""+sname+"\", "+name+".toCoding());");
} else {
w(save, " tgt.addChild(\""+sname+"\", "+name+").toCode();");
w(save, " tgt.addChild(\""+sname+"\", "+name+".toCode());");
}
w(save, " }");
} else if (isPrim) {
@ -593,7 +625,7 @@ public class PECodeGenerator {
private IWorkerContext workerContext;
private String canonical;
private String pkgName;
private String version;
private String version = "r4";
// options:
private ExtensionPolicy extensionPolicy;

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>6.3.33-SNAPSHOT</version>
<version>6.4.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>6.3.33-SNAPSHOT</version>
<version>6.4.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -3430,7 +3430,7 @@ public class FHIRPathEngine {
case Item : {
checkOrdered(focus, "item", exp);
checkParamTypes(exp, exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, TypeDetails.FP_Integer));
return focus;
return focus.toSingleton();
}
case As : {
checkParamTypes(exp, exp.getFunction().toCode(), paramTypes, new TypeDetails(CollectionStatus.SINGLETON, TypeDetails.FP_String));

View File

@ -1318,18 +1318,14 @@ public class DataRenderer extends Renderer implements CodeResolver {
if (Utilities.noString(s))
s = lookupCode(c.primitiveValue("system"), c.primitiveValue("version"), c.primitiveValue("code"));
CodeSystem cs = context.getWorker().fetchCodeSystem(c.primitiveValue("system"));
String sn = cs != null ? crPresent(cs) : displaySystem(c.primitiveValue("system"));
String sn = displaySystem(c.primitiveValue("system"));
String link = getLinkForCode(c.primitiveValue("system"), c.primitiveValue("version"), c.primitiveValue("code"));
if (link != null) {
x.ah(context.prefixLocalHref(link)).tx(sn);
} else {
x.tx(sn);
}
XhtmlNode xi = link != null ? x.ah(context.prefixLocalHref(link)) : x;
xi.tx(sn);
xi.tx(" ");
xi.tx(c.primitiveValue("code"));
x.tx(" ");
x.tx(c.primitiveValue("code"));
if (!Utilities.noString(s)) {
x.tx(": ");
x.tx(s);

View File

@ -338,16 +338,20 @@ public class Validator {
}
if (isColl) {
if (td.getCollectionStatus() == CollectionStatus.SINGLETON) {
hint(path, column, "collection is true, but the path statement(s) can only return single values for the column '"+columnName+"'");
hint(path, column, "collection is true, but the path statement(s) ('"+expr+"') can only return single values for the column '"+columnName+"'");
}
if (supportsArrays == TrueFalseOrUnknown.UNKNOWN) {
warning(path, expression, "The column '"+columnName+"' is defined as a collection, but collections are not supported in all execution contexts");
} else if (supportsArrays == TrueFalseOrUnknown.FALSE) {
if (td.getCollectionStatus() == CollectionStatus.SINGLETON) {
warning(path, expression, "The column '"+columnName+"' is defined as a collection, but this is not allowed in the current execution context. Note that the path '"+expr+"' can only return a single value");
} else {
warning(path, expression, "The column '"+columnName+"' is defined as a collection, but this is not allowed in the current execution context. Note that the path '"+expr+"' can return a collection of values");
}
}
} else {
if (supportsArrays == TrueFalseOrUnknown.UNKNOWN) {
warning(path, expression, "The column '"+columnName+"' appears to be a collection based on it's path. Collections are not supported in all execution contexts");
} else if (supportsArrays == TrueFalseOrUnknown.FALSE) {
warning(path, expression, "The column '"+columnName+"' appears to be a collection based on it's path, but this is not allowed in the current execution context");
}
if (td.getCollectionStatus() != CollectionStatus.SINGLETON) {
warning(path, column, "collection is not true, but the path statement(s) might return multiple values for the column '"+columnName+"' for some inputs");
warning(path, column, "This column is not defined as a collection, but the path statement '"+expr+"' might return multiple values for the column '"+columnName+"' for some inputs");
}
}
Set<String> types = new HashSet<>();
@ -364,7 +368,7 @@ public class Validator {
if (typeJ instanceof JsonString) {
String type = typeJ.asString();
if (!td.hasType(type)) {
error(path+".type", typeJ, "The path expression does not return a value of the type '"+type+"' - found "+td.describe(), IssueType.VALUE);
error(path+".type", typeJ, "The path expression ('"+expr+"') does not return a value of the type '"+type+"' - found "+td.describe(), IssueType.VALUE);
} else {
types.clear();
types.add(simpleType(type));
@ -381,9 +385,9 @@ public class Validator {
boolean ok = false;
if (!isSimpleType(type) && !"null".equals(type)) {
if (supportsComplexTypes == TrueFalseOrUnknown.UNKNOWN) {
warning(path, expression, "Column is a complex type. This is not supported in some Runners");
warning(path, expression, "Column from path '"+expr+"' is a complex type ('"+type+"'). This is not supported in some Runners");
} else if (supportsComplexTypes == TrueFalseOrUnknown.FALSE) {
error(path, expression, "Column is a complex type but this is not allowed in this context", IssueType.BUSINESSRULE);
error(path, expression, "Column from path '"+expr+"' is a complex type ('"+type+"') but this is not allowed in this context", IssueType.BUSINESSRULE);
} else {
ok = true;
}
@ -411,6 +415,11 @@ public class Validator {
case "integer": return ColumnKind.Integer;
case "decimal": return ColumnKind.Decimal;
case "string": return ColumnKind.String;
case "canonical": return ColumnKind.String;
case "url": return ColumnKind.String;
case "uri": return ColumnKind.String;
case "oid": return ColumnKind.String;
case "uuid": return ColumnKind.String;
case "id": return ColumnKind.String;
case "code": return ColumnKind.String;
case "base64Binary": return ColumnKind.Binary;
@ -420,7 +429,7 @@ public class Validator {
}
private boolean isSimpleType(String type) {
return Utilities.existsInList(type, "dateTime", "boolean", "integer", "decimal", "string", "base64Binary", "id", "code", "date", "time");
return Utilities.existsInList(type, "dateTime", "boolean", "integer", "decimal", "string", "base64Binary", "id", "code", "date", "time", "canonical");
}
private String simpleType(String type) {

View File

@ -101,7 +101,7 @@ public class PETests {
checkElement(children.get(2), "language", "language", 0, 1, false, "http://hl7.org/fhir/StructureDefinition/code", 2, "language");
checkElement(children.get(3), "text", "text", 0, 1, false, "http://hl7.org/fhir/StructureDefinition/Narrative", 3, "text");
checkElement(children.get(4), "contained", "contained", 0, Integer.MAX_VALUE, false, "http://hl7.org/fhir/StructureDefinition/Resource", 4, "contained");
checkElement(children.get(5), "extension", "extension", 0, Integer.MAX_VALUE, false, "http://hl7.org/fhir/StructureDefinition/Extension", 3, "extension.where(((url = 'http://hl7.org/fhir/test/StructureDefinition/pe-extension-simple') or (url = 'http://hl7.org/fhir/test/StructureDefinition/pe-extension-complex')).not())");
checkElement(children.get(5), "extension", "extension", 0, Integer.MAX_VALUE, false, "http://hl7.org/fhir/StructureDefinition/Extension", 2, "extension.where(((url = 'http://hl7.org/fhir/test/StructureDefinition/pe-extension-simple') or (url = 'http://hl7.org/fhir/test/StructureDefinition/pe-extension-complex')).not())");
checkElement(children.get(6), "extension", "simple", 0, 1, false, "http://hl7.org/fhir/StructureDefinition/code", 2, "extension('http://hl7.org/fhir/test/StructureDefinition/pe-extension-simple').value");
checkElement(children.get(7), "extension", "complex", 0, 1, false, "http://hl7.org/fhir/test/StructureDefinition/pe-extension-complex", 4, "extension('http://hl7.org/fhir/test/StructureDefinition/pe-extension-complex')");
checkElement(children.get(8), "identifier", "identifier", 0, 1, false, "http://hl7.org/fhir/StructureDefinition/Identifier", 7, "identifier");
@ -116,7 +116,7 @@ public class PETests {
checkElement(children.get(17), "value[x]", "valueCodeableConcept", 0, 1, false, "http://hl7.org/fhir/test/StructureDefinition/pe-profile2", 4, "value.ofType(CodeableConcept)");
List<PEDefinition> gchildren = children.get(11).children();
checkElement(gchildren.get(0), "extension", "extension", 0, Integer.MAX_VALUE, true, "http://hl7.org/fhir/StructureDefinition/Extension", 3, "extension");
checkElement(gchildren.get(0), "extension", "extension", 0, Integer.MAX_VALUE, true, "http://hl7.org/fhir/StructureDefinition/Extension", 2, "extension");
checkElement(gchildren.get(1), "coding", "coding", 0, Integer.MAX_VALUE, true, "http://hl7.org/fhir/StructureDefinition/Coding", 6, "coding");
checkElement(gchildren.get(2), "text", "text", 0, 1, true, "http://hl7.org/fhir/StructureDefinition/string", 2, "text");
@ -128,17 +128,17 @@ public class PETests {
checkElement(gchildren.get(3), "text", "text", 1, 1, false, "http://hl7.org/fhir/StructureDefinition/string", 2, "text");
List<PEDefinition> ggchildren = gchildren.get(3).children("http://hl7.org/fhir/StructureDefinition/string");
checkElement(ggchildren.get(0), "extension", "extension", 0, Integer.MAX_VALUE, false, "http://hl7.org/fhir/StructureDefinition/Extension", 3, "extension");
checkElement(ggchildren.get(0), "extension", "extension", 0, Integer.MAX_VALUE, false, "http://hl7.org/fhir/StructureDefinition/Extension", 2, "extension");
checkElement(ggchildren.get(1), "value", "value", 1, 1, false, null, 3, "value");
gchildren = children.get(7).children("http://hl7.org/fhir/StructureDefinition/Extension");
checkElement(gchildren.get(0), "extension", "extension", 0, Integer.MAX_VALUE, false, "http://hl7.org/fhir/StructureDefinition/Extension", 3, "extension.where(((url = 'slice1') or (url = 'slice2') or (url = 'slice3')).not())");
checkElement(gchildren.get(0), "extension", "extension", 0, Integer.MAX_VALUE, false, "http://hl7.org/fhir/StructureDefinition/Extension", 2, "extension.where(((url = 'slice1') or (url = 'slice2') or (url = 'slice3')).not())");
checkElement(gchildren.get(1), "extension", "slice1", 0, 2, false, "http://hl7.org/fhir/StructureDefinition/Coding", 6, "extension('slice1').value");
checkElement(gchildren.get(2), "extension", "slice2", 0, Integer.MAX_VALUE, false, "http://hl7.org/fhir/StructureDefinition/string", 2, "extension('slice2').value");
checkElement(gchildren.get(3), "extension", "slice3", 1, 1, false, "http://hl7.org/fhir/StructureDefinition/Extension", 3, "extension('slice3')");
ggchildren = gchildren.get(3).children("http://hl7.org/fhir/StructureDefinition/Extension");
checkElement(ggchildren.get(0), "extension", "extension", 0, Integer.MAX_VALUE, false, "http://hl7.org/fhir/StructureDefinition/Extension", 3, "extension");
checkElement(ggchildren.get(0), "extension", "extension", 0, Integer.MAX_VALUE, false, "http://hl7.org/fhir/StructureDefinition/Extension", 2, "extension");
checkElement(ggchildren.get(1), "extension", "slice3a", 0, 2, false, "http://hl7.org/fhir/StructureDefinition/Coding", 6, "extension('slice3a').value");
checkElement(ggchildren.get(2), "extension", "slice3b", 0, Integer.MAX_VALUE, false, "http://hl7.org/fhir/StructureDefinition/string", 2, "extension('slice3b').value");
}
@ -177,7 +177,7 @@ public class PETests {
Assertions.assertEquals("\\-", pe.documentation());
List<PEDefinition> children = pe.children("Patient");
Assertions.assertEquals(28, children.size());
Assertions.assertEquals(26, children.size());
pe = children.get(9);
Assertions.assertEquals("birthsex", pe.name());
@ -269,7 +269,7 @@ public class PETests {
Assertions.assertEquals("May be used to represent additional information that is not part of the basic definition of the resource. To make the use of extensions safe and managable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", pe.documentation());
iChildren = pe.children("http://hl7.org/fhir/StructureDefinition/Extension");
Assertions.assertEquals(4, iChildren.size());
Assertions.assertEquals(3, iChildren.size());
pe = iChildren.get(1);
Assertions.assertEquals("extension", pe.name());
Assertions.assertEquals("extension", pe.schemaName());
@ -283,7 +283,7 @@ public class PETests {
iChildren = pe.children("http://hl7.org/fhir/StructureDefinition/Extension");
Assertions.assertEquals(4, iChildren.size());
Assertions.assertEquals(3, iChildren.size());
pe = iChildren.get(1);
Assertions.assertEquals("extension", pe.name());
Assertions.assertEquals("extension", pe.schemaName());

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>6.3.33-SNAPSHOT</version>
<version>6.4.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>6.3.33-SNAPSHOT</version>
<version>6.4.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -93,6 +93,9 @@ public class MarkDownProcessor {
*/
// todo: dialect dependency?
public boolean isProbablyMarkdown(String content, boolean mdIfParagrapghs) {
if (content == null) {
return false;
}
if (mdIfParagrapghs && content.contains("\n")) {
return true;
}

View File

@ -1147,7 +1147,7 @@ NO_VALID_DISPLAY_AT_ALL = Cannot validate display Name ''{0}'' for {1}#{2}: No d
SD_BASE_EXPERIMENTAL = The definition builds on ''{0}'' which is experimental, but this definition is not labeled as experimental
SD_ED_EXPERIMENTAL_BINDING = The definition for the element ''{0}'' binds to the value set ''{1}'' which is experimental, but this structure is not labeled as experimental
VALIDATION_NO_EXPERIMENTAL_CONTENT = Experimental content is not allowed in this context
SD_ED_ADDITIONAL_BINDING_USAGE_UNKNOWN = The Usage Context {0}#{1} is not recognised and may not be correct
SD_ED_ADDITIONAL_BINDING_USAGE_UNKNOWN = The Usage Context {0}#{1} is not recognized so cannot be validated
SD_ED_ADDITIONAL_BINDING_USAGE_INVALID_ELEMENT = The Usage Context {0}#{1} is a reference to an element that does not exist
SD_ED_ADDITIONAL_BINDING_USAGE_INVALID_TYPE = The Usage Context value must be of type {1} not {0}
CODESYSTEM_CS_COMPLETE_AND_EMPTY = When a CodeSystem has content = ''complete'', it doesn't make sense for there to be no concepts defined

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>6.3.33-SNAPSHOT</version>
<version>6.4.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.core</artifactId>
<version>6.3.33-SNAPSHOT</version>
<version>6.4.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -1129,7 +1129,7 @@ public class StructureDefinitionValidator extends BaseValidator {
}
}
} else {
warning(errors, "2024-09-17", IssueType.BUSINESSRULE, stack.getLiteralPath(), false, I18nConstants.SD_ED_ADDITIONAL_BINDING_USAGE_UNKNOWN, system, code);
hint(errors, "2024-09-17", IssueType.BUSINESSRULE, stack.getLiteralPath(), false, I18nConstants.SD_ED_ADDITIONAL_BINDING_USAGE_UNKNOWN, system, code);
}
}
return ok;