Bump fhir.core to latest version (#3593)

* adding version.yaml, updating version in pom.xml

* It is possible to write to a resource in a partition the user is not authorized to. (#3397)

* fixed

* remove sout

* add msg.code

* fix failed tests

* fix equal sign

* update msg code

* extract method

* Fix up code numbers

* Clean changelog

Co-authored-by: Tadgh <garygrantgraham@gmail.com>

* Revert final artifact version

* add graphql test (#3585)

* added graphql birthdate test

* fix variable name

* typo

* 3506 mdm log enhancement (#3543)

* Providing Fixme's to be reworked at a later time.

* Adding // FIXME Anna to assist our Austrian friend.

* Adding logging test as a first step in addressing issue #2822.

* hapifhir#3506 part 2: enhance logging for (un)successful MDM matching

hapifhir#3506 part 2: enhance logging for (un)successful MDM matching

* Update MdmMatchLinkSvc.java

#3506 move "narrowed down" log to different place

* #3506 added scores and tests

#3506 added scores and tests

* #3506 formatting

#3506 formatting

* #3506 create changelog file

#3506 create changelog file

* #3506 fix typo

#3506 fix typo

* #3506 fix part 3, minor formatting

#3506 fix part 3, minor formatting

* #3506 fix tests

#3506 fix tests

Co-authored-by: Etienne Poirier <etienne.poirier@smilecdr.com>
Co-authored-by: Anna <anna@MacBook-Pro.local>

* mdm matching (#3579)

* Added fix for https://github.com/hapifhir/hapi-fhir-jpaserver-starter… (#3551)

* Added fix for https://github.com/hapifhir/hapi-fhir-jpaserver-starter/issues/328

* Update HapiFhirJpaMigrationTasks.java

Corrected ordering

* Update HapiFhirJpaMigrationTasks.java

Moving index status to be last operation

* Revert "Update HapiFhirJpaMigrationTasks.java"

This reverts commit 37bfd3e66e.

* Moved to bottom

Co-authored-by: Jens Kristian Villadsen <jvi@trifork.com>

* begin with failing test

* fixed

* changelog

* add jira tag

* Update to 6 1 (#3582)

* added changelog folder, upped version

* version enum

* add a few more unit tests to assert proper NO_MATCH exclusion

* revert merge master doh! bad reflexes

* revert merge origin master

* unrevert revert.  ugh what a pain

* merge recovery.  fix poms.

* merge recovery.  more reverting

* merge recovery.  more reverting

* merge recovery.  more reverting

* Revert "merge recovery.  fix poms."

This reverts commit ae6e0ddb06.

* more revert revert reversions

* more revert revert reversions

* pre-review cleanup

Co-authored-by: Jens Kristian Villadsen <jenskristianvilladsen@gmail.com>
Co-authored-by: Jens Kristian Villadsen <jvi@trifork.com>
Co-authored-by: Mark Iantorno <markiantorno@gmail.com>

* Fix regression of 3411 - _lastUpdated gets clobbered during $reindex job (#3586)

* When chunking for the reindex job, don't clobber the lastUpdated if provided by the caller.

* License

* added support for OO.issue.details from Java RI Validator

* remove duplicated Msg.code

* Ks 20220508 log colour (#3592)

* don't use colours when output is redirected to a file

* change log

* Added fix for https://github.com/hapifhir/hapi-fhir-jpaserver-starter… (#3551) (#3594)

* Added fix for https://github.com/hapifhir/hapi-fhir-jpaserver-starter/issues/328

* Update HapiFhirJpaMigrationTasks.java

Corrected ordering

* Update HapiFhirJpaMigrationTasks.java

Moving index status to be last operation

* Revert "Update HapiFhirJpaMigrationTasks.java"

This reverts commit 37bfd3e66e.

* Moved to bottom

Co-authored-by: Jens Kristian Villadsen <jvi@trifork.com>

Co-authored-by: Jens Kristian Villadsen <jenskristianvilladsen@gmail.com>
Co-authored-by: Jens Kristian Villadsen <jvi@trifork.com>

* 3584 case sensitive string elasticsearch (#3596)

* Fix for case-sensitive search with newer elasticsearch

* Test and fix ascii normalization too

* more test cases

* comments

* Docs update empi usecase (#3598)

* Update diagram for use case 5

* Add new page for database support

* Licnese

* Mb norm fix (#3604)

* Normalize query since wildcard searches aren't normalized in elastic

* removed duplicated dependency with wrong version

* fixed test file(added a Base64 string)

* fixed tests

* fixed test:
history?_since is an instant

* removing time from date-strings in examples

* fixed more instant strings

* changed filtering of messages to messageId

* fixed messageId filter on missing profiles

* changed messageID system string to Grahames preferred String

* updated MsgIds of unsupported methods

* removed fixed commons-codec version as fhir.core uses commons-codec:1.15
This will introduce issues with the android built.

* fixed GraphQL Test

* fixing test issue caused by different message string, switch to details code assertion

* fixing test issue caused by different message string, switch to details code assertion

* updated Msg.codes

* updated Msg.codes

* fixed duplicated Msg.codes

* setErrorOnInvalidValue set to false in test

* reverted date precision test changes

* updated r5 resources to latest build version

* updated to latest snapshot, https://github.com/hapifhir/org.hl7.fhir.core/issues/884 causes test failures.

* Try to fix message codes

* Test fixes

* Checkstyle fix

* Test fix

* Try to avoid CME

Co-authored-by: markiantorno <markiantorno@gmail.com>
Co-authored-by: katiesmilecdr <88786813+katiesmilecdr@users.noreply.github.com>
Co-authored-by: Tadgh <garygrantgraham@gmail.com>
Co-authored-by: Ken Stevens <khstevens@gmail.com>
Co-authored-by: alackerbauer <33912849+alackerbauer@users.noreply.github.com>
Co-authored-by: Etienne Poirier <etienne.poirier@smilecdr.com>
Co-authored-by: Anna <anna@MacBook-Pro.local>
Co-authored-by: Jens Kristian Villadsen <jenskristianvilladsen@gmail.com>
Co-authored-by: Jens Kristian Villadsen <jvi@trifork.com>
Co-authored-by: michaelabuckley <michael.buckley@smilecdr.com>
Co-authored-by: James Agnew <jamesagnew@gmail.com>
This commit is contained in:
Patrick Werner 2022-08-03 22:12:59 +02:00 committed by GitHub
parent a6c2e58c2c
commit b026ac10e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
371 changed files with 483049 additions and 1771223 deletions

View File

@ -25,7 +25,7 @@ public final class Msg {
/**
* IMPORTANT: Please update the following comment after you add a new code
* Last code value: 2124
* Last code value: 2129
*/
private Msg() {}

View File

@ -249,6 +249,7 @@ public class Constants {
public static final String POWERED_BY_HEADER = "X-Powered-By";
public static final Charset CHARSET_US_ASCII;
public static final String PARAM_PAGEID = "_pageId";
public static final String JAVA_VALIDATOR_DETAILS_SYSTEM = "http://hl7.org/fhir/java-core-messageId";
/**
* This is provided for testing only! Use with caution as this property may change.
*/

View File

@ -26,10 +26,12 @@ import ca.uhn.fhir.context.BaseRuntimeElementDefinition;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import org.hl7.fhir.instance.model.api.IBase;
import org.hl7.fhir.instance.model.api.IBaseOperationOutcome;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.ICompositeType;
import org.hl7.fhir.instance.model.api.IPrimitiveType;
import java.util.List;
@ -158,4 +160,26 @@ public class OperationOutcomeUtil {
locationChild.getMutator().addValue(theIssue, locationElem);
}
}
public static IBase addIssueWithMessageId(FhirContext myCtx, IBaseOperationOutcome theOperationOutcome, String severity, String message, String messageId, String location, String theCode) {
IBase issue = addIssue(myCtx, theOperationOutcome, severity, message, location, theCode);
BaseRuntimeElementCompositeDefinition<?> issueElement = (BaseRuntimeElementCompositeDefinition<?>) myCtx.getElementDefinition(issue.getClass());
BaseRuntimeChildDefinition detailsChildDef = issueElement.getChildByName("details");
IPrimitiveType<?> system = (IPrimitiveType<?>) myCtx.getElementDefinition("uri").newInstance();
system.setValueAsString(Constants.JAVA_VALIDATOR_DETAILS_SYSTEM);
IPrimitiveType<?> code = (IPrimitiveType<?>) myCtx.getElementDefinition("code").newInstance();
code.setValueAsString(messageId);
BaseRuntimeElementCompositeDefinition<?> codingDef = (BaseRuntimeElementCompositeDefinition<?>) myCtx.getElementDefinition("Coding");
ICompositeType coding = (ICompositeType) codingDef.newInstance();
codingDef.getChildByName("system").getMutator().addValue(coding, system);
codingDef.getChildByName("code").getMutator().addValue(coding, code);
BaseRuntimeElementCompositeDefinition<?> ccDef = (BaseRuntimeElementCompositeDefinition<?>) myCtx.getElementDefinition("CodeableConcept");
ICompositeType codeableConcept = (ICompositeType) ccDef.newInstance();
ccDef.getChildByName("coding").getMutator().addValue(codeableConcept, coding);
detailsChildDef.getMutator().addValue(issue, codeableConcept);
return issue;
}
}

View File

@ -31,6 +31,7 @@ public class SingleValidationMessage {
private Integer myLocationLine;
private String myLocationString;
private String myMessage;
private String myMessageId;
private ResultSeverityEnum mySeverity;
@Override
@ -70,6 +71,10 @@ public class SingleValidationMessage {
return myMessage;
}
public String getMessageId() {
return myMessageId;
}
public ResultSeverityEnum getSeverity() {
return mySeverity;
}
@ -101,6 +106,10 @@ public class SingleValidationMessage {
myMessage = theMessage;
}
public void setMessageId(String messageId) {
myMessageId = messageId;
}
public void setSeverity(ResultSeverityEnum theSeverity) {
mySeverity = theSeverity;
}
@ -116,6 +125,9 @@ public class SingleValidationMessage {
b.append("locationString", myLocationString);
}
b.append("message", myMessage);
if (myMessageId != null) {
b.append(myMessageId);
}
if (mySeverity != null) {
b.append("severity", mySeverity.getCode());
}

View File

@ -138,7 +138,7 @@ public class ValidationResult {
location = null;
}
String severity = next.getSeverity() != null ? next.getSeverity().getCode() : null;
IBase issue = OperationOutcomeUtil.addIssue(myCtx, theOperationOutcome, severity, next.getMessage(), location, Constants.OO_INFOSTATUS_PROCESSING);
IBase issue = OperationOutcomeUtil.addIssueWithMessageId(myCtx, theOperationOutcome, severity, next.getMessage(), next.getMessageId(), location, Constants.OO_INFOSTATUS_PROCESSING);
if (next.getLocationLine() != null || next.getLocationCol() != null) {
String unknown = "(unknown)";

View File

@ -21,13 +21,10 @@ package org.hl7.fhir.converter;
*/
import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_30;
import org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent;
import org.hl7.fhir.dstu3.model.CodeSystem;
import org.hl7.fhir.dstu3.model.ValueSet;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.model.FhirPublication;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class NullVersionConverterAdvisor10_30 extends BaseAdvisor_10_30 {
@ -43,9 +40,4 @@ public class NullVersionConverterAdvisor10_30 extends BaseAdvisor_10_30 {
public void handleCodeSystem(@Nullable CodeSystem theCodeSystem, @Nullable ValueSet theValueSet) throws FHIRException {
// nothing
}
@Override
public boolean ignoreEntry(@Nullable BundleEntryComponent theBundleEntryComponent, @Nonnull FhirPublication theFhirPublication) {
return false;
}
}

View File

@ -22,12 +22,9 @@ package org.hl7.fhir.converter;
import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_40;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r4.model.Bundle.BundleEntryComponent;
import org.hl7.fhir.r4.model.CodeSystem;
import org.hl7.fhir.r4.model.ValueSet;
import org.hl7.fhir.r5.model.FhirPublication;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class NullVersionConverterAdvisor10_40 extends BaseAdvisor_10_40 {
@ -43,9 +40,4 @@ public class NullVersionConverterAdvisor10_40 extends BaseAdvisor_10_40 {
public void handleCodeSystem(@Nullable CodeSystem theCodeSystem, @Nullable ValueSet theValueSet) throws FHIRException {
// nothing
}
@Override
public boolean ignoreEntry(@Nullable BundleEntryComponent theBundleEntryComponent, @Nonnull FhirPublication theFhirPublication) {
return false;
}
}

View File

@ -21,15 +21,10 @@ package org.hl7.fhir.converter;
*/
import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_50;
import org.hl7.fhir.convertors.conv10_50.VersionConvertor_10_50;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.model.Bundle;
import org.hl7.fhir.r5.model.CodeSystem;
import org.hl7.fhir.r5.model.FhirPublication;
import org.hl7.fhir.r5.model.ValueSet;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.IdentityHashMap;
public class NullVersionConverterAdvisor10_50 extends BaseAdvisor_10_50 {
@ -45,9 +40,4 @@ public class NullVersionConverterAdvisor10_50 extends BaseAdvisor_10_50 {
public CodeSystem getCodeSystem(ValueSet src) throws FHIRException {
return myCodeSystems.get(src);
}
@Override
public boolean ignoreEntry(@Nullable Bundle.BundleEntryComponent theBundleEntryComponent, @Nonnull FhirPublication theFhirPublication) {
return false;
}
}

View File

@ -0,0 +1,5 @@
---
type: fix
issue: 3689
title: "hapi now populates issue.detail with the messageID from the core validator, org.hl7.fhir.core was updated to the latest version (5.6.48)
Thanks to Patrick Werner for the feature request and pull request!"

View File

@ -249,7 +249,7 @@ public class TermDeferredStorageSvcImpl implements ITermDeferredStorageSvc {
}
private void clearJobExecutions() {
for (String id : myJobExecutions) {
for (String id : new ArrayList<>(myJobExecutions)) {
myJobCoordinator.cancelInstance(id);
}
myJobExecutions.clear();

View File

@ -10,6 +10,7 @@ import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao;
import ca.uhn.fhir.jpa.subscription.match.config.SubscriptionProcessorConfig;
import ca.uhn.fhir.jpa.test.BaseJpaR4Test;
import ca.uhn.fhir.parser.IParser;
import ca.uhn.fhir.parser.LenientErrorHandler;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.test.utilities.RequestDetailsHelper;
@ -101,7 +102,11 @@ public class BaseCqlR4Test extends BaseJpaR4Test implements CqlProviderTestBase
protected Bundle parseBundle(String theLocation) throws IOException {
String json = stringFromResource(theLocation);
Bundle bundle = (Bundle) myFhirContext.newJsonParser().parseResource(json);
IParser jsonParser = myFhirContext.newJsonParser();
LenientErrorHandler lenientErrorHandler = new LenientErrorHandler();
lenientErrorHandler.setErrorOnInvalidValue(false);
jsonParser.setParserErrorHandler(lenientErrorHandler);
Bundle bundle = (Bundle) jsonParser.parseResource(json);
return bundle;
}

View File

@ -70,6 +70,7 @@ import org.hl7.fhir.r4.model.UriType;
import org.hl7.fhir.r4.model.ValueSet;
import org.hl7.fhir.r5.utils.validation.constants.BestPracticeWarningLevel;
import org.hl7.fhir.r5.utils.validation.constants.ReferenceValidationPolicy;
import org.hl7.fhir.utilities.i18n.I18nConstants;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
@ -81,6 +82,7 @@ import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.stream.Collectors;
import static ca.uhn.fhir.rest.api.Constants.JAVA_VALIDATOR_DETAILS_SYSTEM;
import static org.awaitility.Awaitility.await;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
@ -752,7 +754,10 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test {
obs.setSubject(new Reference("Group/123"));
oo = validateAndReturnOutcome(obs);
ourLog.info(myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(oo));
assertEquals("Unable to resolve resource 'Group/123'", oo.getIssueFirstRep().getDiagnostics(), encode(oo));
Coding expectedIssueCode = new Coding();
expectedIssueCode.setSystem(JAVA_VALIDATOR_DETAILS_SYSTEM).setCode(I18nConstants.REFERENCE_REF_CANTRESOLVE);
assertTrue(expectedIssueCode.equalsDeep(oo.getIssueFirstRep().getDetails().getCodingFirstRep()), encode(oo));
assertThat(oo.getIssueFirstRep().getDiagnostics(), containsString(obs.getSubject().getReference()));
// Target of wrong type
obs.setSubject(new Reference("Group/ABC"));
@ -819,7 +824,10 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test {
obs.setSubject(new Reference("Group/123"));
oo = validateAndReturnOutcome(obs);
ourLog.info(myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(oo));
assertEquals("Unable to resolve resource 'Group/123'", oo.getIssueFirstRep().getDiagnostics(), encode(oo));
Coding expectedIssueCode = new Coding();
expectedIssueCode.setSystem(JAVA_VALIDATOR_DETAILS_SYSTEM).setCode(I18nConstants.REFERENCE_REF_CANTRESOLVE);
assertTrue(expectedIssueCode.equalsDeep(oo.getIssueFirstRep().getDetails().getCodingFirstRep()), encode(oo));
assertThat(oo.getIssueFirstRep().getDiagnostics(), containsString(obs.getSubject().getReference()));
// Target of wrong type
obs.setSubject(new Reference("Group/ABC"));
@ -885,7 +893,10 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test {
obs.setSubject(new Reference("Group/123"));
OperationOutcome oo = validateAndReturnOutcome(obs);
ourLog.info(myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(oo));
assertEquals("Unable to resolve resource 'Group/123'", oo.getIssueFirstRep().getDiagnostics(), encode(oo));
Coding expectedIssueCode = new Coding();
expectedIssueCode.setSystem(JAVA_VALIDATOR_DETAILS_SYSTEM).setCode(I18nConstants.REFERENCE_REF_CANTRESOLVE);
assertTrue(expectedIssueCode.equalsDeep(oo.getIssueFirstRep().getDetails().getCodingFirstRep()), encode(oo));
assertThat(oo.getIssueFirstRep().getDiagnostics(), containsString(obs.getSubject().getReference()));
// Target of wrong type
obs.setSubject(new Reference("Group/ABC"));

View File

@ -578,8 +578,8 @@ public abstract class BaseJpaR5Test extends BaseJpaTest implements ITestDataBuil
ConceptMap conceptMap = new ConceptMap();
conceptMap.setUrl(CM_URL);
conceptMap.setSource(new UriType(VS_URL));
conceptMap.setTarget(new UriType(VS_URL_2));
conceptMap.setSourceScope(new UriType(VS_URL));
conceptMap.setTargetScope(new UriType(VS_URL_2));
ConceptMapGroupComponent group = conceptMap.addGroup();
group.setSource(CS_URL + "|" + "Version 1");

View File

@ -1,9 +1,5 @@
package ca.uhn.fhir.jpa.provider.r5;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.r5.model.BooleanType;
import org.hl7.fhir.r5.model.CodeType;
@ -21,6 +17,10 @@ import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class ResourceProviderR5ConceptMapTest extends BaseResourceProviderR5Test {
private static final Logger ourLog = LoggerFactory.getLogger(ResourceProviderR5ConceptMapTest.class);
@ -28,7 +28,7 @@ public class ResourceProviderR5ConceptMapTest extends BaseResourceProviderR5Test
public void testTranslateWithConceptMapUrlAndVersion() {
//- conceptMap1 v1
ConceptMap conceptMap1 = new ConceptMap();
conceptMap1.setUrl(CM_URL).setVersion("v1").setSource(new UriType(VS_URL)).setTarget(new UriType(VS_URL_2));
conceptMap1.setUrl(CM_URL).setVersion("v1").setSourceScope(new UriType(VS_URL)).setTargetScope(new UriType(VS_URL_2));
ConceptMapGroupComponent group1 = conceptMap1.addGroup();
group1.setSource(CS_URL + "|" + "Version 1").setTarget(CS_URL_2 + "|" + "Version 2");
@ -46,7 +46,7 @@ public class ResourceProviderR5ConceptMapTest extends BaseResourceProviderR5Test
//- conceptMap1 v2
ConceptMap conceptMap2 = new ConceptMap();
conceptMap2.setUrl(CM_URL).setVersion("v2").setSource(new UriType(VS_URL)).setTarget(new UriType(VS_URL_2));
conceptMap2.setUrl(CM_URL).setVersion("v2").setSourceScope(new UriType(VS_URL)).setTargetScope(new UriType(VS_URL_2));
ConceptMapGroupComponent group2 = conceptMap2.addGroup();
group2.setSource(CS_URL + "|" + "Version 1").setTarget(CS_URL_2 + "|" + "Version 2");
@ -111,7 +111,7 @@ public class ResourceProviderR5ConceptMapTest extends BaseResourceProviderR5Test
//- conceptMap1 v1
ConceptMap conceptMap1 = new ConceptMap();
conceptMap1.setUrl(CM_URL).setVersion("v1").setSource(new UriType(VS_URL)).setTarget(new UriType(VS_URL_2));
conceptMap1.setUrl(CM_URL).setVersion("v1").setSourceScope(new UriType(VS_URL)).setTargetScope(new UriType(VS_URL_2));
ConceptMapGroupComponent group1 = conceptMap1.addGroup();
group1.setSource(CS_URL + "|" + "Version 1").setTarget(CS_URL_2 + "|" + "Version 2");
@ -129,7 +129,7 @@ public class ResourceProviderR5ConceptMapTest extends BaseResourceProviderR5Test
//- conceptMap1 v2
ConceptMap conceptMap2 = new ConceptMap();
conceptMap2.setUrl(CM_URL).setVersion("v2").setSource(new UriType(VS_URL)).setTarget(new UriType(VS_URL_2));
conceptMap2.setUrl(CM_URL).setVersion("v2").setSourceScope(new UriType(VS_URL)).setTargetScope(new UriType(VS_URL_2));
ConceptMapGroupComponent group2 = conceptMap2.addGroup();
group2.setSource(CS_URL + "|" + "Version 1").setTarget(CS_URL_2 + "|" + "Version 2");

View File

@ -239,7 +239,7 @@ public class ResourceProviderR5Test extends BaseResourceProviderR5Test {
// test will fail and the line above should be restored
OperationOutcome oo = myFhirCtx.newJsonParser().parseResource(OperationOutcome.class, respString);
assertEquals(1, oo.getIssue().size());
assertEquals("The value provided ('5.0.0-snapshot1') is not in the value set 'FHIRVersion' (http://hl7.org/fhir/ValueSet/FHIR-version|4.6.0), and a code is required from this value set) (error message = Unknown code '5.0.0-snapshot1' for in-memory expansion of ValueSet 'http://hl7.org/fhir/ValueSet/FHIR-version')", oo.getIssue().get(0).getDiagnostics());
assertThat(oo.getIssue().get(0).getDiagnostics(), containsString("is not in the value set 'FHIRVersion'"));
}
}

View File

@ -136,7 +136,7 @@ public abstract class BaseSubscriptionsR5Test extends BaseResourceProviderR5Test
subscription.getContained().add(topic);
subscription.setTopic("#1");
subscription.setReason("Monitor new neonatal function (note, age will be determined by the monitor)");
subscription.setStatus(Enumerations.SubscriptionState.REQUESTED);
subscription.setStatus(Enumerations.SubscriptionStatusCodes.REQUESTED);
subscription.getChannelType()
.setSystem(CanonicalSubscriptionChannelType.RESTHOOK.getSystem())

View File

@ -816,7 +816,7 @@ public class RestHookTestR5Test extends BaseSubscriptionsR5Test {
subscription.addHeader("X-Foo: FOO");
subscription.addHeader("X-Bar: BAR");
subscription.setStatus(Enumerations.SubscriptionState.REQUESTED);
subscription.setStatus(Enumerations.SubscriptionStatusCodes.REQUESTED);
myClient.update().resource(subscription).execute();
waitForQueueToDrain();
@ -849,7 +849,7 @@ public class RestHookTestR5Test extends BaseSubscriptionsR5Test {
waitForSize(1, ourUpdatedObservations);
// Disable
subscription.setStatus(Enumerations.SubscriptionState.OFF);
subscription.setStatus(Enumerations.SubscriptionStatusCodes.OFF);
myClient.update().resource(subscription).execute();
waitForQueueToDrain();

View File

@ -43,6 +43,7 @@ import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IPrimitiveType;
import org.hl7.fhir.r4.model.BooleanType;
import org.hl7.fhir.r4.model.Extension;
import org.hl7.fhir.r5.model.Enumerations;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -311,7 +312,7 @@ public class SubscriptionCanonicalizer {
org.hl7.fhir.r5.model.Subscription subscription = (org.hl7.fhir.r5.model.Subscription) theSubscription;
CanonicalSubscription retVal = new CanonicalSubscription();
org.hl7.fhir.r5.model.Enumerations.SubscriptionState status = subscription.getStatus();
Enumerations.SubscriptionStatusCodes status = subscription.getStatus();
if (status != null) {
retVal.setStatus(org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.fromCode(status.toCode()));
}

View File

@ -175,17 +175,6 @@
<optional>true</optional>
</dependency>
<!--
Android includes an old version of commons-codec, so
we compile against the old version to make sure we can compile
against it
-->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.1</version>
</dependency>
<!--
Gson is needed for some utility classes in org.hl7.fhir.dstu3, so
this is necessary for the JavaDocs to build

View File

@ -44,12 +44,12 @@ public class DateTypeTest {
try {
new DateType(1974, 2, 0);
} catch (IllegalArgumentException e) {
assertEquals("theMonth must be between 0 and 11", e.getMessage());
assertEquals("theDay must be between 1 and 31", e.getMessage());
}
try {
new DateType(1974, 2, 32);
} catch (IllegalArgumentException e) {
assertEquals("theMonth must be between 0 and 11", e.getMessage());
assertEquals("theDay must be between 1 and 31", e.getMessage());
}
new DateType(1974, 1, 31);
}

View File

@ -4,7 +4,6 @@ import ca.uhn.fhir.context.BaseRuntimeDeclaredChildDefinition;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.parser.DataFormatException;
import ca.uhn.fhir.util.FhirTerser;
import ca.uhn.fhir.util.TestUtil;
import org.hl7.fhir.dstu3.model.Appointment;
@ -162,7 +161,7 @@ public class ModelDstu3Test {
try {
new InstantType("2019-01-01T00:00Z");
fail();
} catch (DataFormatException e) {
} catch (IllegalArgumentException e) {
// good
}
}

View File

@ -10,6 +10,7 @@ import org.hamcrest.Matchers;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import java.text.SimpleDateFormat;
@ -67,6 +68,7 @@ public class BaseDateTimeTypeDstu3Test {
assertFalse(new DateTimeType("2011-01-01T12:12:12Z").before(new DateTimeType("2011-01-01T12:12:12Z")));
}
@Disabled
@Test
public void testParseMinuteShouldFail() throws DataFormatException {
DateTimeType dt = new DateTimeType();
@ -78,6 +80,7 @@ public class BaseDateTimeTypeDstu3Test {
}
}
@Disabled
@Test
public void testParseMinuteZuluShouldFail() throws DataFormatException {
DateTimeType dt = new DateTimeType();
@ -141,13 +144,13 @@ public class BaseDateTimeTypeDstu3Test {
try {
new DateType("2001-01-02T11:13:33");
fail();
} catch (DataFormatException e) {
} catch (IllegalArgumentException e) {
assertThat(e.getMessage(), containsString("precision"));
}
try {
new InstantType("2001-01-02");
fail();
} catch (DataFormatException e) {
} catch (IllegalArgumentException e) {
assertThat(e.getMessage(), containsString("precision"));
}
}

View File

@ -125,7 +125,7 @@
{
"contentAttachment": {
"contentType": "image/gif",
"data": ""
"data": "dGVzdA=="
}
},
{
@ -143,4 +143,4 @@
"subject": {
"reference": "#Patient1"
}
}
}

View File

@ -5,7 +5,10 @@ import org.hl7.fhir.instance.model.api.IBase;
import org.hl7.fhir.r4.model.OperationOutcome;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
public class OperationOutcomeUtilTest {
@ -34,4 +37,11 @@ public class OperationOutcomeUtilTest {
assertEquals("{\"resourceType\":\"OperationOutcome\",\"issue\":[{\"severity\":\"error\",\"code\":\"throttled\",\"diagnostics\":\"Help i'm a bug\",\"location\":[\"/Patient\",\"line 3\"]}]}", myCtx.newJsonParser().encodeResourceToString(oo));
}
@Test
public void testAddIssueWithMessageId() {
OperationOutcome oo = (OperationOutcome) OperationOutcomeUtil.newInstance(myCtx);
OperationOutcomeUtil.addIssueWithMessageId(myCtx, oo, "error", "message", "messageID", "location", "processing");
assertNotNull(oo.getIssueFirstRep().getDetails(), "OO.issue.details is empty");
}
}

View File

@ -1,10 +1,10 @@
package org.hl7.fhir.r5.hapi.ctx;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.support.ConceptValidationOptions;
import ca.uhn.fhir.context.support.IValidationSupport;
import ca.uhn.fhir.context.support.ValidationSupportContext;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.util.CoverageIgnore;
import com.github.benmanes.caffeine.cache.Cache;
@ -24,6 +24,7 @@ import org.hl7.fhir.r5.model.CodeableConcept;
import org.hl7.fhir.r5.model.Coding;
import org.hl7.fhir.r5.model.ConceptMap;
import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent;
import org.hl7.fhir.r5.model.NamingSystem;
import org.hl7.fhir.r5.model.Parameters;
import org.hl7.fhir.r5.model.Resource;
import org.hl7.fhir.r5.model.ResourceType;
@ -154,6 +155,11 @@ public final class HapiWorkerContext extends I18nBase implements IWorkerContext
throw new UnsupportedOperationException(Msg.code(208));
}
@Override
public Map<String, NamingSystem> getNSUrlMap() {
throw new UnsupportedOperationException(Msg.code(2107));
}
@Override
public boolean supportsSystem(String theSystem) {
if (myValidationSupport == null) {
@ -277,7 +283,7 @@ public final class HapiWorkerContext extends I18nBase implements IWorkerContext
@Override
public ValueSetExpander.ValueSetExpansionOutcome expandVS(ValueSet theSource, boolean theCacheOk, boolean theHierarchical) {
throw new UnsupportedOperationException(Msg.code(212));
throw new UnsupportedOperationException(Msg.code(2128));
}
@Override
@ -439,6 +445,11 @@ public final class HapiWorkerContext extends I18nBase implements IWorkerContext
return myCtx.getResourceTypes();
}
@Override
public List<String> getCanonicalResourceNames() {
throw new UnsupportedOperationException(Msg.code(2113));
}
@Override
public ValueSetExpander.ValueSetExpansionOutcome expandVS(ElementDefinitionBindingComponent theBinding, boolean theCacheOk, boolean theHierarchical) throws FHIRException {
throw new UnsupportedOperationException(Msg.code(230));
@ -451,8 +462,18 @@ public final class HapiWorkerContext extends I18nBase implements IWorkerContext
}
@Override
public Map<String, byte[]> getBinaries() {
throw new UnsupportedOperationException(Msg.code(232));
public Set<String> getBinaryKeysAsSet() {
throw new UnsupportedOperationException(Msg.code(2115));
}
@Override
public boolean hasBinaryKey(String s) {
throw new UnsupportedOperationException(Msg.code(2129));
}
@Override
public byte[] getBinaryForKey(String s) {
throw new UnsupportedOperationException(Msg.code(2125));
}
@Override
@ -500,6 +521,17 @@ public final class HapiWorkerContext extends I18nBase implements IWorkerContext
return null;
}
@Override
public IPackageLoadingTracker getPackageTracker() {
throw new UnsupportedOperationException(Msg.code(2112));
}
@Override
public IWorkerContext setPackageTracker(
IPackageLoadingTracker packageTracker) {
return null;
}
@Override
public PackageVersion getPackageForUrl(String s) {
return null;

View File

@ -26,14 +26,12 @@ resource.Claim=org.hl7.fhir.r5.model.Claim
resource.ClaimResponse=org.hl7.fhir.r5.model.ClaimResponse
resource.ClinicalImpression=org.hl7.fhir.r5.model.ClinicalImpression
resource.ClinicalUseDefinition=org.hl7.fhir.r5.model.ClinicalUseDefinition
resource.ClinicalUseIssue=org.hl7.fhir.r5.model.ClinicalUseIssue
resource.CodeSystem=org.hl7.fhir.r5.model.CodeSystem
resource.Communication=org.hl7.fhir.r5.model.Communication
resource.CommunicationRequest=org.hl7.fhir.r5.model.CommunicationRequest
resource.CompartmentDefinition=org.hl7.fhir.r5.model.CompartmentDefinition
resource.Composition=org.hl7.fhir.r5.model.Composition
resource.ConceptMap=org.hl7.fhir.r5.model.ConceptMap
resource.ConceptMap2=org.hl7.fhir.r5.model.ConceptMap2
resource.Condition=org.hl7.fhir.r5.model.Condition
resource.ConditionDefinition=org.hl7.fhir.r5.model.ConditionDefinition
resource.Consent=org.hl7.fhir.r5.model.Consent

View File

@ -108,7 +108,7 @@ public class GraphQLEngineTest {
output.write(outputBuilder, 0, "\n");
String expected = "{\n" +
" \"id\":\"http://foo.com/Patient/PATA\"\n" +
" \"id\":\"PATA\"\n" +
"}";
assertEquals(TestUtil.stripReturns(expected), TestUtil.stripReturns(outputBuilder.toString()));
}
@ -130,7 +130,7 @@ public class GraphQLEngineTest {
output.write(outputBuilder, 0, "\n");
String expected = "{\n" +
" \"id\":\"http://foo.com/Patient/PATA\",\n" +
" \"id\":\"PATA\",\n" +
" \"effectiveDateTime\":\"2022-01-01T12:12:12Z\"\n" +
"}";
assertEquals(TestUtil.stripReturns(expected), TestUtil.stripReturns(outputBuilder.toString()));
@ -163,7 +163,7 @@ public class GraphQLEngineTest {
output.write(outputBuilder, 0, "\n");
String expected = "{\n" +
" \"id\":\"http://foo.com/Patient/PATA\",\n" +
" \"id\":\"PATA\",\n" +
" \"subject\":{\n" +
" \"reference\":\"Patient/123\",\n" +
" \"resource\":{\n" +

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -34,6 +34,9 @@ abstract class BaseValidatorBridge implements IValidatorModule {
if (riMessage.getLevel() != null) {
hapiMessage.setSeverity(ResultSeverityEnum.fromCode(riMessage.getLevel().toCode()));
}
if (riMessage.getMessageId() != null) {
hapiMessage.setMessageId(riMessage.getMessageId());
}
theCtx.addValidationMessage(hapiMessage);
}
}

View File

@ -1,7 +1,7 @@
package org.hl7.fhir.common.hapi.validation.validator;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.rest.api.EncodingEnum;
import ca.uhn.fhir.util.XmlUtil;
import ca.uhn.fhir.validation.IValidationContext;
@ -22,6 +22,7 @@ import org.hl7.fhir.r5.utils.validation.IValidationPolicyAdvisor;
import org.hl7.fhir.r5.utils.validation.IValidatorResourceFetcher;
import org.hl7.fhir.r5.utils.validation.constants.BestPracticeWarningLevel;
import org.hl7.fhir.r5.utils.validation.constants.IdStatus;
import org.hl7.fhir.utilities.i18n.I18nConstants;
import org.hl7.fhir.utilities.validation.ValidationMessage;
import org.hl7.fhir.validation.instance.InstanceValidator;
import org.slf4j.Logger;
@ -34,6 +35,7 @@ import java.io.StringReader;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
class ValidatorWrapper {
@ -193,29 +195,19 @@ class ValidatorWrapper {
} else {
throw new IllegalArgumentException(Msg.code(649) + "Unknown encoding: " + encoding);
}
// TODO: are these still needed?
messages = messages.stream()
.filter(m -> m.getMessageId() == null
|| !(m.getMessageId().equals(I18nConstants.TERMINOLOGY_TX_BINDING_NOSOURCE)
|| m.getMessageId().equals(I18nConstants.TERMINOLOGY_TX_BINDING_NOSOURCE2)
|| (m.getMessageId().equals(I18nConstants.TERMINOLOGY_TX_VALUESET_NOTFOUND) && m.getMessage().contains("http://hl7.org/fhir/ValueSet/mimetypes"))))
.collect(Collectors.toList());
for (int i = 0; i < messages.size(); i++) {
ValidationMessage next = messages.get(i);
String message = next.getMessage();
// TODO: are these still needed?
if ("Binding has no source, so can't be checked".equals(message) ||
"ValueSet http://hl7.org/fhir/ValueSet/mimetypes not found".equals(message)) {
messages.remove(i);
i--;
}
if (
myErrorForUnknownProfiles &&
next.getLevel() == ValidationMessage.IssueSeverity.WARNING &&
message.contains("Profile reference '") &&
message.contains("' has not been checked because it is unknown")
) {
next.setLevel(ValidationMessage.IssueSeverity.ERROR);
}
if (myErrorForUnknownProfiles) {
messages.stream().filter(m -> m.getMessageId() != null && (m.getMessageId().equals(I18nConstants.VALIDATION_VAL_PROFILE_UNKNOWN) || m.getMessageId().equals(I18nConstants.VALIDATION_VAL_PROFILE_UNKNOWN_NOT_POLICY)))
.filter(m -> m.getLevel() == ValidationMessage.IssueSeverity.WARNING)
.forEach(m -> m.setLevel(ValidationMessage.IssueSeverity.ERROR));
}
return messages;
}

View File

@ -1,11 +1,11 @@
package org.hl7.fhir.common.hapi.validation.validator;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.context.support.ConceptValidationOptions;
import ca.uhn.fhir.context.support.IValidationSupport;
import ca.uhn.fhir.context.support.ValidationSupportContext;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException;
@ -27,6 +27,7 @@ import org.hl7.fhir.r5.formats.ParserType;
import org.hl7.fhir.r5.model.CanonicalResource;
import org.hl7.fhir.r5.model.CodeSystem;
import org.hl7.fhir.r5.model.Coding;
import org.hl7.fhir.r5.model.NamingSystem;
import org.hl7.fhir.r5.model.Resource;
import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.r5.model.ValueSet;
@ -124,8 +125,18 @@ public class VersionSpecificWorkerContextWrapper extends I18nBase implements IWo
}
@Override
public Map<String, byte[]> getBinaries() {
return null;
public Set<String> getBinaryKeysAsSet() {
throw new UnsupportedOperationException(Msg.code(2118));
}
@Override
public boolean hasBinaryKey(String s) {
throw new UnsupportedOperationException(Msg.code(2126));
}
@Override
public byte[] getBinaryForKey(String s) {
throw new UnsupportedOperationException(Msg.code(2127));
}
@Override
@ -173,9 +184,20 @@ public class VersionSpecificWorkerContextWrapper extends I18nBase implements IWo
return null;
}
@Override
public IPackageLoadingTracker getPackageTracker() {
throw new UnsupportedOperationException(Msg.code(2108));
}
@Override
public IWorkerContext setPackageTracker(
IPackageLoadingTracker packageTracker) {
throw new UnsupportedOperationException(Msg.code(2114));
}
@Override
public PackageVersion getPackageForUrl(String s) {
return null;
throw new UnsupportedOperationException(Msg.code(2109));
}
@Override
@ -413,6 +435,11 @@ public class VersionSpecificWorkerContextWrapper extends I18nBase implements IWo
return myValidationSupportContext.getRootValidationSupport().getFhirContext().getResourceTypes();
}
@Override
public List<String> getCanonicalResourceNames() {
throw new UnsupportedOperationException(Msg.code(2110));
}
@Override
public org.hl7.fhir.r5.model.StructureMap getTransform(String url) {
throw new UnsupportedOperationException(Msg.code(673));
@ -514,6 +541,11 @@ public class VersionSpecificWorkerContextWrapper extends I18nBase implements IWo
throw new UnsupportedOperationException(Msg.code(686));
}
@Override
public Map<String, NamingSystem> getNSUrlMap() {
throw new UnsupportedOperationException(Msg.code(2111));
}
@Override
public ILoggingService getLogger() {
return null;

View File

@ -355,7 +355,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
ValidationResult result = val.validateWithResult(input);
List<SingleValidationMessage> all = logResultsAndReturnAll(result);
assertFalse(result.isSuccessful());
assertEquals("ele-1: 'All FHIR elements must have a @value or children' Rule 'All FHIR elements must have a @value or children' Failed", all.get(0).getMessage());
assertThat(all.get(0).getMessage(), containsString("All FHIR elements must have a @value or children"));
}
/**

View File

@ -278,7 +278,7 @@ public class FhirInstanceValidatorR5Test {
ValidationResult result = val.validateWithResult(input);
List<SingleValidationMessage> all = logResultsAndReturnAll(result);
assertFalse(result.isSuccessful());
assertEquals("ele-1: 'All FHIR elements must have a @value or children' Rule 'All FHIR elements must have a @value or children' Failed", all.get(0).getMessage());
assertThat(all.get(0).getMessage(), containsString("All FHIR elements must have a @value or children"));
}
/**
@ -640,7 +640,7 @@ public class FhirInstanceValidatorR5Test {
List<SingleValidationMessage> messages = logResultsAndReturnNonInformationalOnes(output);
assertEquals( 3, messages.size(), output.toString());
assertThat(messages.get(0).getMessage(), containsString("Element must have some content"));
assertThat(messages.get(1).getMessage(), containsString("ele-1: 'All FHIR elements must have a @value or children' Rule 'All FHIR elements must have a @value or children' Failed"));
assertThat(messages.get(1).getMessage(), containsString("All FHIR elements must have a @value or children"));
assertThat(messages.get(2).getMessage(), containsString("Primitive types must have a value or must have child extensions"));
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More