Merge remote-tracking branch 'origin/master'

This commit is contained in:
Grahame Grieve 2023-04-14 18:01:18 +10:00
commit c9416e9a56
29 changed files with 247 additions and 103 deletions

View File

@ -90,7 +90,7 @@ steps:
jdkVersionOption: '1.11' jdkVersionOption: '1.11'
jdkArchitectureOption: 'x64' jdkArchitectureOption: 'x64'
options: '--settings $(System.DefaultWorkingDirectory)/settings.xml -pl "!org.hl7.fhir.report, !org.hl7.fhir.validation.cli" -DdeployToSonatype' options: '--settings $(System.DefaultWorkingDirectory)/settings.xml -pl "!org.hl7.fhir.report, !org.hl7.fhir.validation.cli" -DdeployToSonatype'
mavenOptions: '-Xmx768m' mavenOptions: '-Xmx768m -Dmaven.resolver.transport=wagon'
publishJUnitResults: false publishJUnitResults: false
# Deploy the SNAPSHOT artifact to GitHub packages. # Deploy the SNAPSHOT artifact to GitHub packages.
@ -104,5 +104,5 @@ steps:
jdkVersionOption: '1.11' jdkVersionOption: '1.11'
jdkArchitectureOption: 'x64' jdkArchitectureOption: 'x64'
options: '--settings $(System.DefaultWorkingDirectory)/settings.xml -pl "!org.hl7.fhir.report, !org.hl7.fhir.validation.cli" -Dmaven.test.skip -DdeployToGitHub' options: '--settings $(System.DefaultWorkingDirectory)/settings.xml -pl "!org.hl7.fhir.report, !org.hl7.fhir.validation.cli" -Dmaven.test.skip -DdeployToGitHub'
mavenOptions: '-Xmx768m' mavenOptions: '-Xmx768m -Dmaven.resolver.transport=wagon'
publishJUnitResults: false publishJUnitResults: false

View File

@ -102,13 +102,11 @@
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId> <artifactId>junit-jupiter-api</artifactId>
<version>${junit_jupiter_version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId> <artifactId>junit-jupiter-params</artifactId>
<version>${junit_jupiter_version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -107,13 +107,11 @@
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId> <artifactId>junit-jupiter-api</artifactId>
<version>${junit_jupiter_version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId> <artifactId>junit-jupiter-params</artifactId>
<version>${junit_jupiter_version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -121,13 +121,11 @@
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId> <artifactId>junit-jupiter-api</artifactId>
<version>${junit_jupiter_version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId> <artifactId>junit-jupiter-params</artifactId>
<version>${junit_jupiter_version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -112,7 +112,7 @@ public class HumanName extends Type implements ICompositeType {
case ANONYMOUS: return "anonymous"; case ANONYMOUS: return "anonymous";
case OLD: return "old"; case OLD: return "old";
case MAIDEN: return "maiden"; case MAIDEN: return "maiden";
case NULL: return null; case NULL: return null;
default: return "?"; default: return "?";
} }
} }
@ -125,7 +125,7 @@ public class HumanName extends Type implements ICompositeType {
case ANONYMOUS: return "http://hl7.org/fhir/name-use"; case ANONYMOUS: return "http://hl7.org/fhir/name-use";
case OLD: return "http://hl7.org/fhir/name-use"; case OLD: return "http://hl7.org/fhir/name-use";
case MAIDEN: return "http://hl7.org/fhir/name-use"; case MAIDEN: return "http://hl7.org/fhir/name-use";
case NULL: return null; case NULL: return null;
default: return "?"; default: return "?";
} }
} }
@ -138,7 +138,7 @@ public class HumanName extends Type implements ICompositeType {
case ANONYMOUS: return "Anonymous assigned name, alias, or pseudonym (used to protect a person's identity for privacy reasons)"; case ANONYMOUS: return "Anonymous assigned name, alias, or pseudonym (used to protect a person's identity for privacy reasons)";
case OLD: return "This name is no longer in use (or was never correct, but retained for records)"; case OLD: return "This name is no longer in use (or was never correct, but retained for records)";
case MAIDEN: return "A name used prior to marriage. Marriage naming customs vary greatly around the world. This name use is for use by applications that collect and store \"maiden\" names. Though the concept of maiden name is often gender specific, the use of this term is not gender specific. The use of this term does not imply any particular history for a person's name, nor should the maiden name be determined algorithmically."; case MAIDEN: return "A name used prior to marriage. Marriage naming customs vary greatly around the world. This name use is for use by applications that collect and store \"maiden\" names. Though the concept of maiden name is often gender specific, the use of this term is not gender specific. The use of this term does not imply any particular history for a person's name, nor should the maiden name be determined algorithmically.";
case NULL: return null; case NULL: return null;
default: return "?"; default: return "?";
} }
} }
@ -151,7 +151,7 @@ public class HumanName extends Type implements ICompositeType {
case ANONYMOUS: return "Anonymous"; case ANONYMOUS: return "Anonymous";
case OLD: return "Old"; case OLD: return "Old";
case MAIDEN: return "Maiden"; case MAIDEN: return "Maiden";
case NULL: return null; case NULL: return null;
default: return "?"; default: return "?";
} }
} }
@ -680,17 +680,17 @@ public class HumanName extends Type implements ICompositeType {
* TODO: replace with call to ca.uhn.fhir.util.DatatypeUtil.joinStringsSpaceSeparated when HAPI upgrades to 1.4 * TODO: replace with call to ca.uhn.fhir.util.DatatypeUtil.joinStringsSpaceSeparated when HAPI upgrades to 1.4
*/ */
private static String joinStringsSpaceSeparated(List<? extends IPrimitiveType<String>> theStrings) { private static String joinStringsSpaceSeparated(List<? extends IPrimitiveType<String>> theStrings) {
StringBuilder b = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
for (IPrimitiveType<String> next : theStrings) { for (IPrimitiveType<String> string : theStrings) {
if (next.isEmpty()) { if (string.isEmpty()) {
continue; continue;
} }
if (b.length() > 0) { if (stringBuilder.length() > 0) {
b.append(' '); stringBuilder.append(' ');
} }
b.append(next.getValue()); stringBuilder.append(string.getValue());
} }
return b.toString(); return stringBuilder.toString();
} }
protected void listChildren(List<Property> childrenList) { protected void listChildren(List<Property> childrenList) {
super.listChildren(childrenList); super.listChildren(childrenList);

View File

@ -0,0 +1,28 @@
package org.hl7.fhir.dstu2016may.model;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class HumanNameTest {
@Test
public void getNameAsSingleStringWithoutFamilyElement() {
final String expected = "dummy value";
HumanName humanName = new HumanName()
.setTextElement(new StringType(expected));
String actual = humanName.getNameAsSingleString();
assertEquals(expected, actual);
}
@Test
public void getNameAsSingleStringWithFamilyElement() {
final String expected = "good value";
HumanName humanName = new HumanName()
.addFamily(expected);
String actual = humanName.getNameAsSingleString();
assertEquals(expected, actual);
}
}

View File

@ -115,13 +115,11 @@
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId> <artifactId>junit-jupiter-api</artifactId>
<version>${junit_jupiter_version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId> <artifactId>junit-jupiter-params</artifactId>
<version>${junit_jupiter_version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -114,7 +114,7 @@ public class HumanName extends Type implements ICompositeType {
case ANONYMOUS: return "anonymous"; case ANONYMOUS: return "anonymous";
case OLD: return "old"; case OLD: return "old";
case MAIDEN: return "maiden"; case MAIDEN: return "maiden";
case NULL: return null; case NULL: return null;
default: return "?"; default: return "?";
} }
} }
@ -127,7 +127,7 @@ public class HumanName extends Type implements ICompositeType {
case ANONYMOUS: return "http://hl7.org/fhir/name-use"; case ANONYMOUS: return "http://hl7.org/fhir/name-use";
case OLD: return "http://hl7.org/fhir/name-use"; case OLD: return "http://hl7.org/fhir/name-use";
case MAIDEN: return "http://hl7.org/fhir/name-use"; case MAIDEN: return "http://hl7.org/fhir/name-use";
case NULL: return null; case NULL: return null;
default: return "?"; default: return "?";
} }
} }
@ -140,7 +140,7 @@ public class HumanName extends Type implements ICompositeType {
case ANONYMOUS: return "Anonymous assigned name, alias, or pseudonym (used to protect a person's identity for privacy reasons)"; case ANONYMOUS: return "Anonymous assigned name, alias, or pseudonym (used to protect a person's identity for privacy reasons)";
case OLD: return "This name is no longer in use (or was never correct, but retained for records)"; case OLD: return "This name is no longer in use (or was never correct, but retained for records)";
case MAIDEN: return "A name used prior to changing name because of marriage. This name use is for use by applications that collect and store names that were used prior to a marriage. Marriage naming customs vary greatly around the world, and are constantly changing. This term is not gender specific. The use of this term does not imply any particular history for a person's name"; case MAIDEN: return "A name used prior to changing name because of marriage. This name use is for use by applications that collect and store names that were used prior to a marriage. Marriage naming customs vary greatly around the world, and are constantly changing. This term is not gender specific. The use of this term does not imply any particular history for a person's name";
case NULL: return null; case NULL: return null;
default: return "?"; default: return "?";
} }
} }
@ -153,7 +153,7 @@ public class HumanName extends Type implements ICompositeType {
case ANONYMOUS: return "Anonymous"; case ANONYMOUS: return "Anonymous";
case OLD: return "Old"; case OLD: return "Old";
case MAIDEN: return "Name changed for Marriage"; case MAIDEN: return "Name changed for Marriage";
case NULL: return null; case NULL: return null;
default: return "?"; default: return "?";
} }
} }
@ -678,7 +678,9 @@ public class HumanName extends Type implements ICompositeType {
List<StringType> nameParts = new ArrayList<StringType>(); List<StringType> nameParts = new ArrayList<StringType>();
nameParts.addAll(getPrefix()); nameParts.addAll(getPrefix());
nameParts.addAll(getGiven()); nameParts.addAll(getGiven());
nameParts.add(getFamilyElement()); if (hasFamilyElement()) {
nameParts.add(getFamilyElement());
}
nameParts.addAll(getSuffix()); nameParts.addAll(getSuffix());
if (nameParts.size() > 0) { if (nameParts.size() > 0) {
return joinStringsSpaceSeparated(nameParts); return joinStringsSpaceSeparated(nameParts);
@ -693,17 +695,17 @@ public class HumanName extends Type implements ICompositeType {
* TODO: replace with call to ca.uhn.fhir.util.DatatypeUtil.joinStringsSpaceSeparated when HAPI upgrades to 1.4 * TODO: replace with call to ca.uhn.fhir.util.DatatypeUtil.joinStringsSpaceSeparated when HAPI upgrades to 1.4
*/ */
private static String joinStringsSpaceSeparated(List<? extends IPrimitiveType<String>> theStrings) { private static String joinStringsSpaceSeparated(List<? extends IPrimitiveType<String>> theStrings) {
StringBuilder b = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
for (IPrimitiveType<String> next : theStrings) { for (IPrimitiveType<String> string : theStrings) {
if (next.isEmpty()) { if (string.isEmpty()) {
continue; continue;
} }
if (b.length() > 0) { if (stringBuilder.length() > 0) {
b.append(' '); stringBuilder.append(' ');
} }
b.append(next.getValue()); stringBuilder.append(string.getValue());
} }
return b.toString(); return stringBuilder.toString();
} }
protected void listChildren(List<Property> children) { protected void listChildren(List<Property> children) {
super.listChildren(children); super.listChildren(children);

View File

@ -0,0 +1,28 @@
package org.hl7.fhir.dstu3.model;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class HumanNameTest {
@Test
public void getNameAsSingleStringWithoutFamilyElement() {
final String expected = "dummy value";
HumanName humanName = new HumanName()
.setTextElement(new StringType(expected));
String actual = humanName.getNameAsSingleString();
assertEquals(expected, actual);
}
@Test
public void getNameAsSingleStringWithFamilyElement() {
final String expected = "good value";
HumanName humanName = new HumanName()
.setFamily(expected);
String actual = humanName.getNameAsSingleString();
assertEquals(expected, actual);
}
}

View File

@ -125,13 +125,11 @@
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId> <artifactId>junit-jupiter-api</artifactId>
<version>${junit_jupiter_version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId> <artifactId>junit-jupiter-params</artifactId>
<version>${junit_jupiter_version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -678,7 +678,9 @@ public class HumanName extends Type implements ICompositeType {
List<StringType> nameParts = new ArrayList<StringType>(); List<StringType> nameParts = new ArrayList<StringType>();
nameParts.addAll(getPrefix()); nameParts.addAll(getPrefix());
nameParts.addAll(getGiven()); nameParts.addAll(getGiven());
nameParts.add(getFamilyElement()); if (hasFamilyElement()) {
nameParts.add(getFamilyElement());
}
nameParts.addAll(getSuffix()); nameParts.addAll(getSuffix());
if (nameParts.size() > 0) { if (nameParts.size() > 0) {
return joinStringsSpaceSeparated(nameParts); return joinStringsSpaceSeparated(nameParts);
@ -693,17 +695,17 @@ public class HumanName extends Type implements ICompositeType {
* TODO: replace with call to ca.uhn.fhir.util.DatatypeUtil.joinStringsSpaceSeparated when HAPI upgrades to 1.4 * TODO: replace with call to ca.uhn.fhir.util.DatatypeUtil.joinStringsSpaceSeparated when HAPI upgrades to 1.4
*/ */
private static String joinStringsSpaceSeparated(List<? extends IPrimitiveType<String>> theStrings) { private static String joinStringsSpaceSeparated(List<? extends IPrimitiveType<String>> theStrings) {
StringBuilder b = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
for (IPrimitiveType<String> next : theStrings) { for (IPrimitiveType<String> string : theStrings) {
if (next.isEmpty()) { if (string.isEmpty()) {
continue; continue;
} }
if (b.length() > 0) { if (stringBuilder.length() > 0) {
b.append(' '); stringBuilder.append(' ');
} }
b.append(next.getValue()); stringBuilder.append(string.getValue());
} }
return b.toString(); return stringBuilder.toString();
} }
protected void listChildren(List<Property> children) { protected void listChildren(List<Property> children) {
super.listChildren(children); super.listChildren(children);

View File

@ -0,0 +1,30 @@
package org.hl7.fhir.r4.model;
import org.junit.jupiter.api.Test;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class HumanNameTest {
@Test
public void getNameAsSingleStringWithoutFamilyElement() {
final String expected = "dummy value";
HumanName humanName = new HumanName()
.setTextElement(new StringType(expected));
String actual = humanName.getNameAsSingleString();
assertEquals(expected, actual);
}
@Test
public void getNameAsSingleStringWithFamilyElement() {
final String expected = "good value";
HumanName humanName = new HumanName()
.setFamily(expected);
String actual = humanName.getNameAsSingleString();
assertEquals(expected, actual);
}
}

View File

@ -145,13 +145,11 @@
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId> <artifactId>junit-jupiter-api</artifactId>
<version>${junit_jupiter_version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId> <artifactId>junit-jupiter-params</artifactId>
<version>${junit_jupiter_version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -899,8 +899,10 @@ public class HumanName extends DataType implements ICompositeType {
public String getNameAsSingleString() { public String getNameAsSingleString() {
List<StringType> nameParts = new ArrayList<StringType>(); List<StringType> nameParts = new ArrayList<StringType>();
nameParts.addAll(getPrefix()); nameParts.addAll(getPrefix());
nameParts.addAll(getGiven()); nameParts.addAll(getGiven());
nameParts.add(getFamilyElement()); if (hasFamilyElement()) {
nameParts.add(getFamilyElement());
}
nameParts.addAll(getSuffix()); nameParts.addAll(getSuffix());
if (nameParts.size() > 0) { if (nameParts.size() > 0) {
return joinStringsSpaceSeparated(nameParts); return joinStringsSpaceSeparated(nameParts);
@ -915,17 +917,17 @@ public class HumanName extends DataType implements ICompositeType {
* TODO: replace with call to ca.uhn.fhir.util.DatatypeUtil.joinStringsSpaceSeparated when HAPI upgrades to 1.4 * TODO: replace with call to ca.uhn.fhir.util.DatatypeUtil.joinStringsSpaceSeparated when HAPI upgrades to 1.4
*/ */
private static String joinStringsSpaceSeparated(List<? extends IPrimitiveType<String>> theStrings) { private static String joinStringsSpaceSeparated(List<? extends IPrimitiveType<String>> theStrings) {
StringBuilder b = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
for (IPrimitiveType<String> next : theStrings) { for (IPrimitiveType<String> string : theStrings) {
if (next.isEmpty()) { if (string.isEmpty()) {
continue; continue;
} }
if (b.length() > 0) { if (stringBuilder.length() > 0) {
b.append(' '); stringBuilder.append(' ');
} }
b.append(next.getValue()); stringBuilder.append(string.getValue());
} }
return b.toString(); return stringBuilder.toString();
} }
// end addition // end addition

View File

@ -0,0 +1,28 @@
package org.hl7.fhir.r4b.model;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class HumanNameTest {
@Test
public void getNameAsSingleStringWithoutFamilyElement() {
final String expected = "dummy value";
HumanName humanName = new HumanName()
.setTextElement(new StringType(expected));
String actual = humanName.getNameAsSingleString();
assertEquals(expected, actual);
}
@Test
public void getNameAsSingleStringWithFamilyElement() {
final String expected = "good value";
HumanName humanName = new HumanName()
.setFamily(expected);
String actual = humanName.getNameAsSingleString();
assertEquals(expected, actual);
}
}

View File

@ -169,13 +169,11 @@
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId> <artifactId>junit-jupiter-api</artifactId>
<version>${junit_jupiter_version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId> <artifactId>junit-jupiter-params</artifactId>
<version>${junit_jupiter_version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -900,7 +900,9 @@ public class HumanName extends DataType implements ICompositeType {
List<StringType> nameParts = new ArrayList<StringType>(); List<StringType> nameParts = new ArrayList<StringType>();
nameParts.addAll(getPrefix()); nameParts.addAll(getPrefix());
nameParts.addAll(getGiven()); nameParts.addAll(getGiven());
nameParts.add(getFamilyElement()); if (hasFamilyElement()) {
nameParts.add(getFamilyElement());
}
nameParts.addAll(getSuffix()); nameParts.addAll(getSuffix());
if (nameParts.size() > 0) { if (nameParts.size() > 0) {
return joinStringsSpaceSeparated(nameParts); return joinStringsSpaceSeparated(nameParts);
@ -915,17 +917,17 @@ public class HumanName extends DataType implements ICompositeType {
* TODO: replace with call to ca.uhn.fhir.util.DatatypeUtil.joinStringsSpaceSeparated when HAPI upgrades to 1.4 * TODO: replace with call to ca.uhn.fhir.util.DatatypeUtil.joinStringsSpaceSeparated when HAPI upgrades to 1.4
*/ */
private static String joinStringsSpaceSeparated(List<? extends IPrimitiveType<String>> theStrings) { private static String joinStringsSpaceSeparated(List<? extends IPrimitiveType<String>> theStrings) {
StringBuilder b = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
for (IPrimitiveType<String> next : theStrings) { for (IPrimitiveType<String> string : theStrings) {
if (next.isEmpty()) { if (string.isEmpty()) {
continue; continue;
} }
if (b.length() > 0) { if (stringBuilder.length() > 0) {
b.append(' '); stringBuilder.append(' ');
} }
b.append(next.getValue()); stringBuilder.append(string.getValue());
} }
return b.toString(); return stringBuilder.toString();
} }
// end addition // end addition

View File

@ -69,18 +69,11 @@ import org.hl7.fhir.r5.utils.FHIRLexer.FHIRLexerException;
import org.hl7.fhir.r5.utils.FHIRPathEngine; import org.hl7.fhir.r5.utils.FHIRPathEngine;
import org.hl7.fhir.r5.utils.ToolingExtensions; import org.hl7.fhir.r5.utils.ToolingExtensions;
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder; import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
import org.hl7.fhir.utilities.SourceLocation;
import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.VersionUtilities;
import org.hl7.fhir.utilities.validation.ValidationMessage;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType;
import org.hl7.fhir.utilities.validation.ValidationMessage.Source;
import org.hl7.fhir.utilities.validation.ValidationOptions; import org.hl7.fhir.utilities.validation.ValidationOptions;
import org.hl7.fhir.utilities.xhtml.NodeType; import org.hl7.fhir.utilities.xhtml.NodeType;
import org.hl7.fhir.utilities.xhtml.XhtmlNode; import org.hl7.fhir.utilities.xhtml.XhtmlNode;
import java.io.ByteArrayInputStream;
import java.io.IOException; import java.io.IOException;
import java.util.*; import java.util.*;
@ -1047,7 +1040,7 @@ public class StructureMapUtilities {
lexer.token(")"); lexer.token(")");
} else if (lexer.hasToken(".")) { } else if (lexer.hasToken(".")) {
lexer.token("."); lexer.token(".");
source.setElement(lexer.take()); source.setElement(readAsStringOrProcessedConstant(lexer.take(), lexer));
} }
if (lexer.hasToken(":")) { if (lexer.hasToken(":")) {
// type and cardinality // type and cardinality
@ -1090,6 +1083,12 @@ public class StructureMapUtilities {
} }
} }
private String readAsStringOrProcessedConstant(String s, FHIRLexer lexer) throws FHIRLexerException {
if (s.startsWith("\"") || s.startsWith("`"))
return lexer.processConstant(s);
else
return s;
}
private void parseTarget(StructureMapGroupRuleComponent rule, FHIRLexer lexer) throws FHIRException { private void parseTarget(StructureMapGroupRuleComponent rule, FHIRLexer lexer) throws FHIRException {
StructureMapGroupRuleTargetComponent target = rule.addTarget(); StructureMapGroupRuleTargetComponent target = rule.addTarget();

View File

@ -0,0 +1,30 @@
package org.hl7.fhir.r5.model;
import org.junit.jupiter.api.Test;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class HumanNameTest {
@Test
public void getNameAsSingleStringWithoutFamilyElement() {
final String expected = "dummy value";
HumanName humanName = new HumanName()
.setTextElement(new StringType(expected));
String actual = humanName.getNameAsSingleString();
assertEquals(expected, actual);
}
@Test
public void getNameAsSingleStringWithFamilyElement() {
final String expected = "good value";
HumanName humanName = new HumanName()
.setFamily(expected);
String actual = humanName.getNameAsSingleString();
assertEquals(expected, actual);
}
}

View File

@ -90,6 +90,25 @@ public class StructureMapUtilitiesTest implements ITransformerServices {
assertSerializeDeserialize(map); assertSerializeDeserialize(map);
} }
@Test
public void testSourceElementDelimiter() throws IOException, FHIRException {
StructureMapUtilities scu = new StructureMapUtilities(context, this);
String fileMap = "map \"http://github.com/FHIR/testSourceElementDelimiter\" = \"testSourceElementDelimiter\"\r\n"
+ "uses \"http://hl7.org/fhir/StructureDefinition/Patient\" alias Patient as source\r\n"
+ "uses \"http://hl7.org/fhir/StructureDefinition/Basic\" alias Basic as target\r\n"
+ "group Patient(source src : Patient, target tgt : Basic) {\r\n"
+ " src.identifier -> tgt.identifier;\r\n"
+ " src.\"-quote\" -> tgt.quote;\r\n"
+ " src.`-backtick` -> tgt.backtick;\r\n"
+ "}";
System.out.println(fileMap);
StructureMap structureMap = scu.parse(fileMap, "testSourceElementDelimiter");
Assertions.assertEquals("identifier", structureMap.getGroup().get(0).getRule().get(0).getSourceFirstRep().getElement());
Assertions.assertEquals("-quote", structureMap.getGroup().get(0).getRule().get(1).getSourceFirstRep().getElement());
Assertions.assertEquals("-backtick", structureMap.getGroup().get(0).getRule().get(2).getSourceFirstRep().getElement());
}
@Override @Override
public void log(String message) { public void log(String message) {
} }

View File

@ -16,7 +16,6 @@
<properties> <properties>
<maven.deploy.skip>true</maven.deploy.skip> <maven.deploy.skip>true</maven.deploy.skip>
<jacoco_version>0.8.5</jacoco_version>
</properties> </properties>
<dependencies> <dependencies>

View File

@ -109,7 +109,6 @@
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId> <artifactId>junit-jupiter-engine</artifactId>
<version>${junit_jupiter_version}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
@ -123,7 +122,6 @@
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId> <artifactId>junit-jupiter-params</artifactId>
<version>${junit_jupiter_version}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>

View File

@ -36,7 +36,6 @@
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId> <artifactId>junit-jupiter-engine</artifactId>
<version>${junit_jupiter_version}</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<!-- shoo! <!-- shoo!
@ -51,7 +50,6 @@
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId> <artifactId>junit-jupiter-params</artifactId>
<version>${junit_jupiter_version}</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>

View File

@ -213,7 +213,6 @@
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId> <artifactId>junit-jupiter-api</artifactId>
<version>${junit_jupiter_version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
@ -233,14 +232,12 @@
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId> <artifactId>junit-jupiter-engine</artifactId>
<version>${junit_jupiter_version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId> <artifactId>junit-jupiter-params</artifactId>
<version>${junit_jupiter_version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>

View File

@ -101,7 +101,7 @@ public class SearchParameterValidator extends BaseValidator {
pass.get(i).setOperation(Operation.Union); pass.get(i).setOperation(Operation.Union);
pass.get(i).setOpNext(pass.get(i+1)); pass.get(i).setOpNext(pass.get(i+1));
} }
return pass.size() == 0 ? "" : pass.get(0).toString(); return pass.size() > 0 ? pass.get(0).toString() : null;
} }
} }

15
pom.xml
View File

@ -20,12 +20,12 @@
<properties> <properties>
<hapi_fhir_version>6.2.1</hapi_fhir_version> <hapi_fhir_version>6.2.1</hapi_fhir_version>
<validator_test_case_version>1.2.26-SNAPSHOT</validator_test_case_version> <validator_test_case_version>1.2.26-SNAPSHOT</validator_test_case_version>
<junit_jupiter_version>5.7.1</junit_jupiter_version> <junit_jupiter_version>5.9.2</junit_jupiter_version>
<junit_platform_launcher_version>1.8.2</junit_platform_launcher_version> <junit_platform_launcher_version>1.8.2</junit_platform_launcher_version>
<maven_surefire_version>3.0.0-M5</maven_surefire_version> <maven_surefire_version>3.0.0-M5</maven_surefire_version>
<maven_clean_version>3.1.0</maven_clean_version> <maven_clean_version>3.1.0</maven_clean_version>
<okhttp.version>4.9.3</okhttp.version> <okhttp.version>4.9.3</okhttp.version>
<jacoco_version>0.8.8</jacoco_version> <jacoco_version>0.8.9</jacoco_version>
<info_cqframework_version>1.5.1</info_cqframework_version> <info_cqframework_version>1.5.1</info_cqframework_version>
<lombok_version>1.18.22</lombok_version> <lombok_version>1.18.22</lombok_version>
<byte_buddy_version>1.12.14</byte_buddy_version> <byte_buddy_version>1.12.14</byte_buddy_version>
@ -146,15 +146,10 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.junit.jupiter</groupId> <groupId>org.junit</groupId>
<artifactId>junit-jupiter-engine</artifactId> <artifactId>junit-bom</artifactId>
<version>${junit_jupiter_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>${junit_jupiter_version}</version> <version>${junit_jupiter_version}</version>
<type>pom</type>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -13,6 +13,7 @@ jobs:
codecov: $(CODECOV_TOKEN) codecov: $(CODECOV_TOKEN)
VERSION: VERSION:
JAVA_TOOL_OPTIONS: ${{image.javaToolOptions}} JAVA_TOOL_OPTIONS: ${{image.javaToolOptions}}
skipJaCoCo: $[not(eq(variables['currentName'], 'ubuntu-latest-java-11'))]
steps: steps:
- task: Cache@2 - task: Cache@2
@ -23,8 +24,8 @@ jobs:
- task: Maven@3 - task: Maven@3
inputs: inputs:
mavenPomFile: 'pom.xml' mavenPomFile: 'pom.xml'
options: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)' options: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER) -Djacoco.skip=$(skipJaCoCo)'
mavenOptions: '-Xmx768m' mavenOptions: '-Xmx768m -Dmaven.resolver.transport=wagon'
javaHomeOption: 'JDKVersion' javaHomeOption: 'JDKVersion'
jdkVersionOption: '${{image.jdkVersion}}' jdkVersionOption: '${{image.jdkVersion}}'
jdkArchitectureOption: 'x64' jdkArchitectureOption: 'x64'
@ -35,7 +36,7 @@ jobs:
- task: Maven@3 - task: Maven@3
inputs: inputs:
mavenPomFile: 'pom.xml' mavenPomFile: 'pom.xml'
mavenOptions: '-Xmx768m' mavenOptions: '-Xmx768m -Dmaven.resolver.transport=wagon'
javaHomeOption: 'JDKVersion' javaHomeOption: 'JDKVersion'
jdkVersionOption: '${{image.jdkVersion}}' jdkVersionOption: '${{image.jdkVersion}}'
jdkArchitectureOption: 'x64' jdkArchitectureOption: 'x64'
@ -47,12 +48,12 @@ jobs:
# Upload test results to codecov # Upload test results to codecov
- script: bash <(curl https://codecov.io/bash) -t $(codecov) - script: bash <(curl https://codecov.io/bash) -t $(codecov)
displayName: 'codecov Bash Uploader' displayName: 'codecov Bash Uploader'
condition: eq(variables.currentName, 'ubuntu-latest-java-11') condition: eq(variables.skipJaCoCo, false)
# Publishes the test results to build artifacts. # Publishes the test results to build artifacts.
- task: PublishCodeCoverageResults@1 - task: PublishCodeCoverageResults@1
displayName: 'Publish JaCoCo test results' displayName: 'Publish JaCoCo test results'
condition: eq(variables.currentName, 'ubuntu-latest-java-11') condition: eq(variables.skipJaCoCo, false)
inputs: inputs:
codeCoverageTool: 'JaCoCo' codeCoverageTool: 'JaCoCo'
summaryFileLocation: '$(System.DefaultWorkingDirectory)/org.hl7.fhir.report/target/site/jacoco-aggregate/jacoco.xml' summaryFileLocation: '$(System.DefaultWorkingDirectory)/org.hl7.fhir.report/target/site/jacoco-aggregate/jacoco.xml'

View File

@ -29,7 +29,7 @@ jobs:
inputs: inputs:
mavenPomFile: 'pom.xml' mavenPomFile: 'pom.xml'
options: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)' options: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)'
mavenOptions: '-Xmx768m' mavenOptions: '-Xmx768m -Dmaven.resolver.transport=wagon'
javaHomeOption: 'JDKVersion' javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.11' jdkVersionOption: '1.11'
jdkArchitectureOption: 'x64' jdkArchitectureOption: 'x64'
@ -39,7 +39,7 @@ jobs:
inputs: inputs:
mavenPomFile: 'pom.xml' mavenPomFile: 'pom.xml'
options: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)' options: '-Dmaven.repo.local=$(MAVEN_CACHE_FOLDER)'
mavenOptions: '-Xmx4096m' mavenOptions: '-Xmx4096m -Dmaven.resolver.transport=wagon'
javaHomeOption: 'JDKVersion' javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.11' jdkVersionOption: '1.11'
jdkArchitectureOption: 'x64' jdkArchitectureOption: 'x64'

View File

@ -127,7 +127,7 @@ jobs:
- task: Maven@3 - task: Maven@3
inputs: inputs:
mavenPomFile: 'pom.xml' mavenPomFile: 'pom.xml'
mavenOptions: '-Xmx768m' mavenOptions: '-Xmx768m -Dmaven.resolver.transport=wagon'
javaHomeOption: 'JDKVersion' javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.11' jdkVersionOption: '1.11'
jdkArchitectureOption: 'x64' jdkArchitectureOption: 'x64'