Remove resourceType, version, and qualifier from FHIRPath id results (#1357)
* Breaking test * Strip returned IIdType of qualifier, version, and resourceType * Add fix to r4b * Add fix to r5
This commit is contained in:
parent
b73111adf6
commit
b62f9afc5a
|
@ -451,12 +451,19 @@ public class FHIRPathEngine {
|
||||||
if (list != null) {
|
if (list != null) {
|
||||||
for (Base v : list) {
|
for (Base v : list) {
|
||||||
if (v != null && (tn == null || v.fhirType().equalsIgnoreCase(tn))) {
|
if (v != null && (tn == null || v.fhirType().equalsIgnoreCase(tn))) {
|
||||||
result.add(v);
|
result.add(filterIdType(v));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Base filterIdType(Base v) {
|
||||||
|
if (v instanceof IIdType) {
|
||||||
|
return (Base) ((IIdType) v).toUnqualifiedVersionless().withResourceType(null);
|
||||||
|
}
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isLegacyMode() {
|
public boolean isLegacyMode() {
|
||||||
return legacyMode;
|
return legacyMode;
|
||||||
|
|
|
@ -306,5 +306,12 @@ public class FHIRPathTests {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEvaluate_Id() {
|
||||||
|
Patient input = new Patient();
|
||||||
|
input.setId(new IdType("http://base/Patient/123/_history/222"));
|
||||||
|
List<Base> results = fp.evaluate(input, "Patient.id");
|
||||||
|
assertEquals(1, results.size());
|
||||||
|
assertEquals("123", results.get(0).toString());
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -447,13 +447,20 @@ public class FHIRPathEngine {
|
||||||
if (list != null) {
|
if (list != null) {
|
||||||
for (Base v : list) {
|
for (Base v : list) {
|
||||||
if (v != null && (tn == null || v.fhirType().equalsIgnoreCase(tn))) {
|
if (v != null && (tn == null || v.fhirType().equalsIgnoreCase(tn))) {
|
||||||
result.add(v);
|
result.add(filterIdType(v));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private Base filterIdType(Base v) {
|
||||||
|
if (v instanceof IIdType) {
|
||||||
|
return (Base) ((IIdType) v).toUnqualifiedVersionless().withResourceType(null);
|
||||||
|
}
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isLegacyMode() {
|
public boolean isLegacyMode() {
|
||||||
return legacyMode;
|
return legacyMode;
|
||||||
}
|
}
|
||||||
|
|
|
@ -295,4 +295,13 @@ public class FHIRPathTests {
|
||||||
assertEquals(DUMMY_CONSTANT_1, result.get(0).primitiveValue());
|
assertEquals(DUMMY_CONSTANT_1, result.get(0).primitiveValue());
|
||||||
assertEquals(DUMMY_CONSTANT_2, result.get(1).primitiveValue());
|
assertEquals(DUMMY_CONSTANT_2, result.get(1).primitiveValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEvaluate_Id() {
|
||||||
|
Patient input = new Patient();
|
||||||
|
input.setId(new IdType("http://base/Patient/123/_history/222"));
|
||||||
|
List<Base> results = fp.evaluate(input, "Patient.id");
|
||||||
|
assertEquals(1, results.size());
|
||||||
|
assertEquals("123", results.get(0).toString());
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -457,13 +457,18 @@ public class FHIRPathEngine {
|
||||||
if (list != null) {
|
if (list != null) {
|
||||||
for (Base v : list) {
|
for (Base v : list) {
|
||||||
if (v != null && (tn == null || v.fhirType().equalsIgnoreCase(tn))) {
|
if (v != null && (tn == null || v.fhirType().equalsIgnoreCase(tn))) {
|
||||||
result.add(v);
|
result.add(filterIdType(v));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Base filterIdType(Base v) {
|
||||||
|
if (v instanceof IIdType) {
|
||||||
|
return (Base) ((IIdType) v).toUnqualifiedVersionless().withResourceType(null);
|
||||||
|
}
|
||||||
|
return v;
|
||||||
|
}
|
||||||
public boolean isLegacyMode() {
|
public boolean isLegacyMode() {
|
||||||
return legacyMode;
|
return legacyMode;
|
||||||
}
|
}
|
||||||
|
|
|
@ -301,4 +301,13 @@ public class FHIRPathTests {
|
||||||
assertEquals(DUMMY_CONSTANT_1, result.get(0).primitiveValue());
|
assertEquals(DUMMY_CONSTANT_1, result.get(0).primitiveValue());
|
||||||
assertEquals(DUMMY_CONSTANT_2, result.get(1).primitiveValue());
|
assertEquals(DUMMY_CONSTANT_2, result.get(1).primitiveValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEvaluate_Id() {
|
||||||
|
Patient input = new Patient();
|
||||||
|
input.setId(new IdType("http://base/Patient/123/_history/222"));
|
||||||
|
List<Base> results = fp.evaluate(input, "Patient.id");
|
||||||
|
assertEquals(1, results.size());
|
||||||
|
assertEquals("123", results.get(0).toString());
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue