Version bump

This commit is contained in:
jamesagnew 2021-05-18 17:14:14 -04:00
parent ec565c6b24
commit de56f440cb
76 changed files with 386 additions and 209 deletions

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -214,6 +214,10 @@ class ModelScanner {
}
if (blockDefinition == null) {
if (theClass.getSimpleName().equals("XhtmlType")) {
return;
}
throw new ConfigurationException("Resource class[" + theClass.getName() + "] does not contain any valid HAPI-FHIR annotations");
}
}

View File

@ -3,14 +3,14 @@
<modelVersion>4.0.0</modelVersion>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-bom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<packaging>pom</packaging>
<name>HAPI FHIR BOM</name>
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-cli</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../../hapi-deployable-pom</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -31,8 +31,6 @@ import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.rest.server.interceptor.InterceptorAdapter;
import org.hl7.fhir.converter.NullVersionConverterAdvisor30;
import org.hl7.fhir.converter.NullVersionConverterAdvisor40;
import org.hl7.fhir.convertors.VersionConvertorAdvisor30;
import org.hl7.fhir.convertors.VersionConvertorAdvisor40;
import org.hl7.fhir.convertors.VersionConvertor_10_30;
import org.hl7.fhir.convertors.VersionConvertor_10_40;
import org.hl7.fhir.convertors.VersionConvertor_30_40;

View File

@ -20,33 +20,33 @@ package org.hl7.fhir.converter;
* #L%
*/
import org.hl7.fhir.convertors.VersionConvertorAdvisor30;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor30;
import org.hl7.fhir.dstu2.model.Resource;
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.dstu2.model.Resource;
import org.hl7.fhir.r5.model.FhirPublication;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class NullVersionConverterAdvisor30 implements VersionConvertorAdvisor30 {
@Nullable
@Override
public boolean ignoreEntry(BundleEntryComponent theSrc) {
public CodeSystem getCodeSystem(@Nullable ValueSet theValueSet) throws FHIRException {
return null;
}
@Override
public void handleCodeSystem(@Nullable CodeSystem theCodeSystem, @Nullable ValueSet theValueSet) throws FHIRException {
// nothing
}
@Override
public boolean ignoreEntry(@Nullable BundleEntryComponent theBundleEntryComponent, @Nonnull FhirPublication theFhirPublication) {
return false;
}
@Override
public Resource convert(org.hl7.fhir.dstu3.model.Resource theResource) throws FHIRException {
return null;
}
@Override
public void handleCodeSystem(CodeSystem theTgtcs, ValueSet theSource) {
//nothing
}
@Override
public CodeSystem getCodeSystem(ValueSet theSrc) {
return null;
}
}

View File

@ -20,43 +20,33 @@ package org.hl7.fhir.converter;
* #L%
*/
import org.hl7.fhir.convertors.VersionConvertorAdvisor40;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import org.hl7.fhir.dstu2.model.Resource;
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 NullVersionConverterAdvisor40 implements VersionConvertorAdvisor40 {
@Nullable
@Override
public Resource convertR2(org.hl7.fhir.r4.model.Resource resource) throws FHIRException {
public CodeSystem getCodeSystem(@Nullable ValueSet theValueSet) throws FHIRException {
return null;
}
@Override
public org.hl7.fhir.dstu2016may.model.Resource convertR2016May(org.hl7.fhir.r4.model.Resource theResource) throws FHIRException {
return null;
public void handleCodeSystem(@Nullable CodeSystem theCodeSystem, @Nullable ValueSet theValueSet) throws FHIRException {
// nothing
}
@Override
public org.hl7.fhir.dstu3.model.Resource convertR3(org.hl7.fhir.r4.model.Resource resource) throws FHIRException {
return null;
}
@Override
public CodeSystem getCodeSystem(ValueSet theSrc) {
return null;
}
@Override
public void handleCodeSystem(CodeSystem theTgtcs, ValueSet theSource) {
//nothing
}
@Override
public boolean ignoreEntry(BundleEntryComponent theSrc) {
public boolean ignoreEntry(@Nullable BundleEntryComponent theBundleEntryComponent, @Nonnull FhirPublication theFhirPublication) {
return false;
}
}

View File

@ -20,44 +20,22 @@ package org.hl7.fhir.converter;
* #L%
*/
import org.hl7.fhir.convertors.VersionConvertorAdvisor50;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor50;
import org.hl7.fhir.dstu2.model.Resource;
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 NullVersionConverterAdvisor50 implements VersionConvertorAdvisor50 {
private IdentityHashMap<ValueSet, CodeSystem> myCodeSystems = new IdentityHashMap<>();
@Override
public boolean ignoreEntry(Bundle.BundleEntryComponent src) {
return false;
}
@Override
public Resource convertR2(org.hl7.fhir.r5.model.Resource resource) throws FHIRException {
return null;
}
@Override
public org.hl7.fhir.dstu2016may.model.Resource convertR2016May(org.hl7.fhir.r5.model.Resource resource) throws FHIRException {
return null;
}
@Override
public org.hl7.fhir.dstu3.model.Resource convertR3(org.hl7.fhir.r5.model.Resource resource) throws FHIRException {
return null;
}
@Override
public org.hl7.fhir.r4.model.Resource convertR4(org.hl7.fhir.r5.model.Resource resource) throws FHIRException {
return null;
}
@Override
public void handleCodeSystem(CodeSystem tgtcs, ValueSet source) throws FHIRException {
myCodeSystems.put(source, tgtcs);
@ -67,4 +45,9 @@ public class NullVersionConverterAdvisor50 implements VersionConvertorAdvisor50
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

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
@ -83,13 +83,13 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-subscription</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<scope>compile</scope>
</dependency>
<dependency>
@ -106,7 +106,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-testpage-overlay</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<classifier>classes</classifier>
</dependency>
<dependency>

View File

@ -11,7 +11,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -0,0 +1,165 @@
package ca.uhn.fhir.jpa.dao.r5;
/*
* #%L
* HAPI FHIR JPA Server
* %%
* Copyright (C) 2014 - 2021 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.support.IValidationSupport;
import ca.uhn.fhir.context.support.ValidationSupportContext;
import ca.uhn.fhir.context.support.IValidationSupport.CodeValidationResult;
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoCodeSystem;
import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao;
import ca.uhn.fhir.jpa.dao.index.IdHelperService;
import ca.uhn.fhir.jpa.model.cross.IBasePersistedResource;
import ca.uhn.fhir.jpa.term.api.ITermDeferredStorageSvc;
import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId;
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
import ca.uhn.fhir.rest.api.server.storage.TransactionDetails;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.jpa.term.api.ITermCodeSystemStorageSvc;
import ca.uhn.fhir.jpa.util.LogicUtil;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.param.TokenParam;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.instance.model.api.IPrimitiveType;
import org.hl7.fhir.r5.model.CodeSystem;
import org.hl7.fhir.r5.model.CodeableConcept;
import org.hl7.fhir.r5.model.Coding;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Set;
import static ca.uhn.fhir.jpa.dao.FhirResourceDaoValueSetDstu2.toStringOrNull;
import static ca.uhn.fhir.jpa.dao.dstu3.FhirResourceDaoValueSetDstu3.vsValidateCodeOptions;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
public class FhirResourceDaoCodeSystemR5 extends BaseHapiFhirResourceDao<CodeSystem> implements IFhirResourceDaoCodeSystem<CodeSystem, Coding, CodeableConcept> {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirResourceDaoCodeSystemR5.class);
@Autowired
protected ITermCodeSystemStorageSvc myTerminologyCodeSystemStorageSvc;
@Autowired
protected IdHelperService myIdHelperService;
@Autowired
private IValidationSupport myValidationSupport;
@Autowired
private FhirContext myFhirContext;
@Autowired
protected ITermDeferredStorageSvc myTermDeferredStorageSvc;
@Override
public List<IIdType> findCodeSystemIdsContainingSystemAndCode(String theCode, String theSystem, RequestDetails theRequest) {
List<IIdType> valueSetIds;
Set<ResourcePersistentId> ids = searchForIds(new SearchParameterMap(CodeSystem.SP_CODE, new TokenParam(theSystem, theCode)), theRequest);
valueSetIds = new ArrayList<>();
for (ResourcePersistentId next : ids) {
IIdType id = myIdHelperService.translatePidIdToForcedId(myFhirContext, "CodeSystem", next);
valueSetIds.add(id);
}
return valueSetIds;
}
@Nonnull
@Override
public IValidationSupport.LookupCodeResult lookupCode(IPrimitiveType<String> theCode, IPrimitiveType<String> theSystem, Coding theCoding, RequestDetails theRequestDetails) {
boolean haveCoding = theCoding != null && isNotBlank(theCoding.getSystem()) && isNotBlank(theCoding.getCode());
boolean haveCode = theCode != null && theCode.isEmpty() == false;
boolean haveSystem = theSystem != null && theSystem.isEmpty() == false;
if (!haveCoding && !(haveSystem && haveCode)) {
throw new InvalidRequestException("No code, coding, or codeableConcept provided to validate");
}
if (!LogicUtil.multiXor(haveCoding, (haveSystem && haveCode)) || (haveSystem != haveCode)) {
throw new InvalidRequestException("$lookup can only validate (system AND code) OR (coding.system AND coding.code)");
}
String code;
String system;
if (haveCoding) {
code = theCoding.getCode();
if (theCoding.hasVersion()) {
system = theCoding.getSystem() + "|" + theCoding.getVersion();
} else {
system = theCoding.getSystem();
}
} else {
code = theCode.getValue();
system = theSystem.getValue();
}
ourLog.info("Looking up {} / {}", system, code);
if (myValidationSupport.isCodeSystemSupported(new ValidationSupportContext(myValidationSupport), system)) {
ourLog.info("Code system {} is supported", system);
IValidationSupport.LookupCodeResult retVal = myValidationSupport.lookupCode(new ValidationSupportContext(myValidationSupport), system, code);
if (retVal != null) {
return retVal;
}
}
// We didn't find it..
return IValidationSupport.LookupCodeResult.notFound(system, code);
}
@Override
public SubsumesResult subsumes(IPrimitiveType<String> theCodeA, IPrimitiveType<String> theCodeB, IPrimitiveType<String> theSystem, Coding theCodingA, Coding theCodingB, RequestDetails theRequestDetails) {
return myTerminologySvc.subsumes(theCodeA, theCodeB, theSystem, theCodingA, theCodingB);
}
@Override
protected void preDelete(CodeSystem theResourceToDelete, ResourceTable theEntityToDelete) {
super.preDelete(theResourceToDelete, theEntityToDelete);
myTermDeferredStorageSvc.deleteCodeSystemForResource(theEntityToDelete);
}
@Override
public ResourceTable updateEntity(RequestDetails theRequest, IBaseResource theResource, IBasePersistedResource theEntity, Date theDeletedTimestampOrNull, boolean thePerformIndexing,
boolean theUpdateVersion, TransactionDetails theTransactionDetails, boolean theForceUpdate, boolean theCreateNewHistoryEntry) {
ResourceTable retVal = super.updateEntity(theRequest, theResource, theEntity, theDeletedTimestampOrNull, thePerformIndexing, theUpdateVersion, theTransactionDetails, theForceUpdate, theCreateNewHistoryEntry);
if (!retVal.isUnchangedInCurrentOperation()) {
CodeSystem cs = (CodeSystem) theResource;
addPidToResource(theEntity, theResource);
myTerminologyCodeSystemStorageSvc.storeNewCodeSystemVersionIfNeeded(org.hl7.fhir.convertors.conv40_50.CodeSystem40_50.convertCodeSystem(cs), (ResourceTable) theEntity);
}
return retVal;
}
@Override
public CodeValidationResult validateCode(IIdType theCodeSystemId, IPrimitiveType<String> theCodeSystemUrl,
IPrimitiveType<String> theVersion, IPrimitiveType<String> theCode, IPrimitiveType<String> theDisplay,
Coding theCoding, CodeableConcept theCodeableConcept, RequestDetails theRequestDetails) {
return myTerminologySvc.codeSystemValidateCode(theCodeSystemId, toStringOrNull(theCodeSystemUrl), toStringOrNull(theVersion), toStringOrNull(theCode), toStringOrNull(theDisplay), theCoding, theCodeableConcept);
}
}

View File

@ -613,10 +613,8 @@ public abstract class BaseJpaR5Test extends BaseJpaTest implements ITestDataBuil
conceptMap.setTarget(new UriType(VS_URL_2));
ConceptMapGroupComponent group = conceptMap.addGroup();
group.setSource(CS_URL);
group.setSourceVersion("Version 1");
group.setTarget(CS_URL_2);
group.setTargetVersion("Version 2");
group.setSource(CS_URL + "|" + "Version 1");
group.setTarget(CS_URL_2 + "|" + "Version 2");
SourceElementComponent element = group.addElement();
element.setCode("12345");
@ -643,10 +641,8 @@ public abstract class BaseJpaR5Test extends BaseJpaTest implements ITestDataBuil
target.setRelationship(Enumerations.ConceptMapRelationship.SOURCEISBROADERTHANTARGET);
group = conceptMap.addGroup();
group.setSource(CS_URL);
group.setSourceVersion("Version 3");
group.setTarget(CS_URL_3);
group.setTargetVersion("Version 4");
group.setSource(CS_URL + "|" + "Version 3");
group.setTarget(CS_URL_3 + "|" + "Version 4");
element = group.addElement();
element.setCode("12345");
@ -663,10 +659,8 @@ public abstract class BaseJpaR5Test extends BaseJpaTest implements ITestDataBuil
target.setRelationship(Enumerations.ConceptMapRelationship.SOURCEISBROADERTHANTARGET);
group = conceptMap.addGroup();
group.setSource(CS_URL_4);
group.setSourceVersion("Version 5");
group.setTarget(CS_URL_2);
group.setTargetVersion("Version 2");
group.setSource(CS_URL_4 + "|" + "Version 5");
group.setTarget(CS_URL_2 + "|" + "Version 2");
element = group.addElement();
element.setCode("78901");

View File

@ -31,7 +31,7 @@ public class ResourceProviderR5ConceptMapTest extends BaseResourceProviderR5Test
conceptMap1.setUrl(CM_URL).setVersion("v1").setSource(new UriType(VS_URL)).setTarget(new UriType(VS_URL_2));
ConceptMapGroupComponent group1 = conceptMap1.addGroup();
group1.setSource(CS_URL).setSourceVersion("Version 1").setTarget(CS_URL_2).setTargetVersion("Version 2");
group1.setSource(CS_URL + "|" + "Version 1").setTarget(CS_URL_2 + "|" + "Version 2");
SourceElementComponent element1 = group1.addElement();
element1.setCode("11111").setDisplay("Source Code 11111");
@ -49,7 +49,7 @@ public class ResourceProviderR5ConceptMapTest extends BaseResourceProviderR5Test
conceptMap2.setUrl(CM_URL).setVersion("v2").setSource(new UriType(VS_URL)).setTarget(new UriType(VS_URL_2));
ConceptMapGroupComponent group2 = conceptMap2.addGroup();
group2.setSource(CS_URL).setSourceVersion("Version 1").setTarget(CS_URL_2).setTargetVersion("Version 2");
group2.setSource(CS_URL + "|" + "Version 1").setTarget(CS_URL_2 + "|" + "Version 2");
SourceElementComponent element2 = group2.addElement();
element2.setCode("11111").setDisplay("Source Code 11111");
@ -114,7 +114,7 @@ public class ResourceProviderR5ConceptMapTest extends BaseResourceProviderR5Test
conceptMap1.setUrl(CM_URL).setVersion("v1").setSource(new UriType(VS_URL)).setTarget(new UriType(VS_URL_2));
ConceptMapGroupComponent group1 = conceptMap1.addGroup();
group1.setSource(CS_URL).setSourceVersion("Version 1").setTarget(CS_URL_2).setTargetVersion("Version 2");
group1.setSource(CS_URL + "|" + "Version 1").setTarget(CS_URL_2 + "|" + "Version 2");
SourceElementComponent element1 = group1.addElement();
element1.setCode("12222").setDisplay("Source Code 12222");
@ -132,7 +132,7 @@ public class ResourceProviderR5ConceptMapTest extends BaseResourceProviderR5Test
conceptMap2.setUrl(CM_URL).setVersion("v2").setSource(new UriType(VS_URL)).setTarget(new UriType(VS_URL_2));
ConceptMapGroupComponent group2 = conceptMap2.addGroup();
group2.setSource(CS_URL).setSourceVersion("Version 1").setTarget(CS_URL_2).setTargetVersion("Version 2");
group2.setSource(CS_URL + "|" + "Version 1").setTarget(CS_URL_2 + "|" + "Version 2");
SourceElementComponent element2 = group2.addElement();
element2.setCode("13333").setDisplay("Source Code 13333");

View File

@ -129,10 +129,12 @@ public abstract class BaseSubscriptionsR5Test extends BaseResourceProviderR5Test
protected Subscription newSubscription(String theCriteria, String thePayload) {
SubscriptionTopic topic = new SubscriptionTopic();
topic.getResourceTrigger().getQueryCriteria().setCurrent(theCriteria);
topic.getResourceTriggerFirstRep().getQueryCriteria().setCurrent(theCriteria);
topic.setId("1");
Subscription subscription = new Subscription();
subscription.getTopic().setResource(topic);
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);

View File

@ -444,8 +444,8 @@ public class RestHookTestR5Test extends BaseSubscriptionsR5Test {
Subscription subscriptionTemp = myClient.read(Subscription.class, subscription2.getId());
assertNotNull(subscriptionTemp);
SubscriptionTopic topic = (SubscriptionTopic) subscriptionTemp.getTopic().getResource();
topic.getResourceTrigger().getQueryCriteria().setCurrent(criteria1);
SubscriptionTopic topic = (SubscriptionTopic) subscriptionTemp.getContained().get(0);
topic.getResourceTriggerFirstRep().getQueryCriteria().setCurrent(criteria1);
myClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
waitForQueueToDrain();
@ -526,8 +526,8 @@ public class RestHookTestR5Test extends BaseSubscriptionsR5Test {
Subscription subscriptionTemp = myClient.read(Subscription.class, subscription2.getId());
assertNotNull(subscriptionTemp);
SubscriptionTopic topic = (SubscriptionTopic) subscriptionTemp.getTopic().getResource();
topic.getResourceTrigger().getQueryCriteria().setCurrent(criteria1);
SubscriptionTopic topic = (SubscriptionTopic) subscriptionTemp.getContained().get(0);
topic.getResourceTriggerFirstRep().getQueryCriteria().setCurrent(criteria1);
myClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
waitForQueueToDrain();
@ -604,8 +604,9 @@ public class RestHookTestR5Test extends BaseSubscriptionsR5Test {
Subscription subscriptionTemp = myClient.read(Subscription.class, subscription2.getId());
assertNotNull(subscriptionTemp);
SubscriptionTopic topic = (SubscriptionTopic) subscriptionTemp.getTopic().getResource();
topic.getResourceTrigger().getQueryCriteria().setCurrent(criteria1);
SubscriptionTopic topic = (SubscriptionTopic) subscriptionTemp.getContained().get(0);
topic.getResourceTriggerFirstRep().getQueryCriteria().setCurrent(criteria1);
myClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
waitForQueueToDrain();
@ -732,8 +733,8 @@ public class RestHookTestR5Test extends BaseSubscriptionsR5Test {
assertNotNull(subscriptionTemp);
String criteriaGood = "Observation?code=SNOMED-CT|" + code + "&_format=xml";
SubscriptionTopic topic = (SubscriptionTopic) subscriptionTemp.getTopic().getResource();
topic.getResourceTrigger().getQueryCriteria().setCurrent(criteriaGood);
SubscriptionTopic topic = (SubscriptionTopic) subscriptionTemp.getContained().get(0);
topic.getResourceTriggerFirstRep().getQueryCriteria().setCurrent(criteriaGood);
ourLog.info("** About to update subscription");
myClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
@ -149,13 +149,13 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-test-utilities</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-test-utilities</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<scope>test</scope>
</dependency>
</dependencies>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
@ -50,13 +50,13 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-test-utilities</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-test-utilities</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<scope>test</scope>
</dependency>
<dependency>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -368,9 +368,11 @@ public class SubscriptionCanonicalizer {
retVal = ((org.hl7.fhir.r4.model.Subscription) theSubscription).getCriteria();
break;
case R5:
org.hl7.fhir.r5.model.SubscriptionTopic topic = (org.hl7.fhir.r5.model.SubscriptionTopic) ((org.hl7.fhir.r5.model.Subscription) theSubscription).getTopic().getResource();
org.hl7.fhir.r5.model.Subscription subscription = (org.hl7.fhir.r5.model.Subscription) theSubscription;
String topicElement = subscription.getTopicElement().getValue();
org.hl7.fhir.r5.model.SubscriptionTopic topic = (org.hl7.fhir.r5.model.SubscriptionTopic) subscription.getContained().stream().filter(t -> ("#" + t.getId()).equals(topicElement) || (t.getId()).equals(topicElement)).findFirst().orElse(null);
Validate.notNull(topic);
retVal = topic.getResourceTrigger().getQueryCriteria().getCurrent();
retVal = topic.getResourceTriggerFirstRep().getQueryCriteria().getCurrent();
break;
}

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -169,7 +169,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-converter</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
</dependency>
</dependencies>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot-samples</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
</parent>
<artifactId>hapi-fhir-spring-boot-sample-client-apache</artifactId>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot-samples</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
</parent>
<artifactId>hapi-fhir-spring-boot-sample-client-okhttp</artifactId>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot-samples</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
</parent>
<artifactId>hapi-fhir-spring-boot-sample-server-jersey</artifactId>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
</parent>
<artifactId>hapi-fhir-spring-boot-samples</artifactId>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -1,5 +1,5 @@
# This file contains version definitions
# Generated: 2020-12-18T09:20:13.196-05:00
# Generated: 2021-05-18T15:08:03.074-04:00
resource.Account=org.hl7.fhir.r5.model.Account
resource.ActivityDefinition=org.hl7.fhir.r5.model.ActivityDefinition
@ -44,7 +44,7 @@ resource.Device=org.hl7.fhir.r5.model.Device
resource.DeviceDefinition=org.hl7.fhir.r5.model.DeviceDefinition
resource.DeviceMetric=org.hl7.fhir.r5.model.DeviceMetric
resource.DeviceRequest=org.hl7.fhir.r5.model.DeviceRequest
resource.DeviceUseStatement=org.hl7.fhir.r5.model.DeviceUseStatement
resource.DeviceUsage=org.hl7.fhir.r5.model.DeviceUsage
resource.DiagnosticReport=org.hl7.fhir.r5.model.DiagnosticReport
resource.DocumentManifest=org.hl7.fhir.r5.model.DocumentManifest
resource.DocumentReference=org.hl7.fhir.r5.model.DocumentReference
@ -73,6 +73,7 @@ resource.ImmunizationRecommendation=org.hl7.fhir.r5.model.ImmunizationRecommenda
resource.ImplementationGuide=org.hl7.fhir.r5.model.ImplementationGuide
resource.Ingredient=org.hl7.fhir.r5.model.Ingredient
resource.InsurancePlan=org.hl7.fhir.r5.model.InsurancePlan
resource.InventoryReport=org.hl7.fhir.r5.model.InventoryReport
resource.Invoice=org.hl7.fhir.r5.model.Invoice
resource.Library=org.hl7.fhir.r5.model.Library
resource.Linkage=org.hl7.fhir.r5.model.Linkage
@ -185,6 +186,7 @@ datatype.ProductShelfLife=org.hl7.fhir.r5.model.ProductShelfLife
datatype.Quantity=org.hl7.fhir.r5.model.Quantity
datatype.Range=org.hl7.fhir.r5.model.Range
datatype.Ratio=org.hl7.fhir.r5.model.Ratio
datatype.RatioRange=org.hl7.fhir.r5.model.RatioRange
datatype.Reference=org.hl7.fhir.r5.model.Reference
datatype.RelatedArtifact=org.hl7.fhir.r5.model.RelatedArtifact
datatype.SampledData=org.hl7.fhir.r5.model.SampledData

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -34,11 +34,13 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;
import static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.BOOLEAN;
import static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.CHOICE;
import static org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED;
@ -1119,10 +1121,15 @@ public class QuestionnaireResponseValidatorDstu3Test {
qa = new QuestionnaireResponse();
qa.setStatus(QuestionnaireResponseStatus.COMPLETED);
qa.getQuestionnaire().setReference(questionnaireRef);
qa.addItem().setLinkId("link0").addAnswer().setValue(new Coding().setDisplay("Hello"));
qa.addItem().setLinkId("link0").addAnswer().setValue(new StringType("Hello"));
errors = myVal.validateWithResult(qa);
ourLog.info(errors.toString());
assertThat(errors.getMessages(), empty());
List<SingleValidationMessage> warningsAndErrors = errors
.getMessages()
.stream()
.filter(t -> t.getSeverity().ordinal() > ResultSeverityEnum.INFORMATION.ordinal())
.collect(Collectors.toList());
assertThat(warningsAndErrors, is(empty()));
// Missing String answer

View File

@ -343,7 +343,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' failed", all.get(0).getMessage());
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());
}
/**
@ -996,7 +996,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest {
assertEquals(3, messages.size(), output.toString());
assertThat(messages.get(0).getMessage(), containsString("Element must have some content"));
assertThat(messages.get(1).getMessage(), containsString("Primitive types must have a value or must have child extensions"));
assertThat(messages.get(2).getMessage(), containsString("ele-1: 'All FHIR elements must have a @value or children' failed"));
assertThat(messages.get(2).getMessage(), containsString("ele-1: 'All FHIR elements must have a @value or children' Rule 'All FHIR elements must have a @value or children' Failed"));
}
@Test

View File

@ -28,11 +28,13 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
@ -627,10 +629,14 @@ public class QuestionnaireResponseValidatorR4Test {
qa.getText().setDiv(new XhtmlNode().setValue("<div>AA</div>")).setStatus(Narrative.NarrativeStatus.GENERATED);
qa.setStatus(QuestionnaireResponseStatus.COMPLETED);
qa.getQuestionnaireElement().setValue(questionnaireRef);
qa.addItem().setLinkId("link0").addAnswer().setValue(new Coding().setDisplay("Hello"));
qa.addItem().setLinkId("link0").addAnswer().setValue(new StringType("Hello"));
errors = myVal.validateWithResult(qa);
ourLog.info(errors.toString());
assertThat(errors.getMessages(), empty());
List<SingleValidationMessage> warningsAndErrors = errors
.getMessages()
.stream()
.filter(t -> t.getSeverity().ordinal() > ResultSeverityEnum.INFORMATION.ordinal())
.collect(Collectors.toList());
assertThat(warningsAndErrors, is(empty()));
// Missing String answer
@ -653,6 +659,7 @@ public class QuestionnaireResponseValidatorR4Test {
List<Questionnaire.QuestionnaireItemAnswerOptionComponent> options = new ArrayList<>();
options.add(new Questionnaire.QuestionnaireItemAnswerOptionComponent().setValue(new Coding("http://foo", "foo", "FOOOO")));
options.add(new Questionnaire.QuestionnaireItemAnswerOptionComponent().setValue(new Coding("http://bar", "bar", "FOOOO")));
options.add(new Questionnaire.QuestionnaireItemAnswerOptionComponent().setValue(new StringType("Hello")));
Questionnaire q = new Questionnaire();
QuestionnaireItemComponent item = q.addItem();
@ -681,7 +688,12 @@ public class QuestionnaireResponseValidatorR4Test {
qa.addItem().setLinkId("link0").addAnswer().setValue(new StringType("Hello"));
errors = myVal.validateWithResult(qa);
ourLog.info(errors.toString());
assertEquals(true, errors.isSuccessful());
List<SingleValidationMessage> warningsAndErrors = errors
.getMessages()
.stream()
.filter(t -> t.getSeverity().ordinal() > ResultSeverityEnum.INFORMATION.ordinal())
.collect(Collectors.toList());
assertThat(warningsAndErrors, is(empty()));
qa = new QuestionnaireResponse();
qa.getText().setDiv(new XhtmlNode().setValue("<div>AA</div>")).setStatus(Narrative.NarrativeStatus.GENERATED);

View File

@ -255,7 +255,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' failed", all.get(0).getMessage());
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());
}
/**
@ -615,7 +615,7 @@ public class FhirInstanceValidatorR5Test {
assertEquals( 3, messages.size(), output.toString());
assertThat(messages.get(0).getMessage(), containsString("Element must have some content"));
assertThat(messages.get(1).getMessage(), containsString("Primitive types must have a value or must have child extensions"));
assertThat(messages.get(2).getMessage(), containsString("ele-1: 'All FHIR elements must have a @value or children' failed"));
assertThat(messages.get(2).getMessage(), containsString("ele-1: 'All FHIR elements must have a @value or children' Rule 'All FHIR elements must have a @value or children' Failed"));
}
@Test

View File

@ -14,12 +14,30 @@ import org.hl7.fhir.common.hapi.validation.support.InMemoryTerminologyServerVali
import org.hl7.fhir.common.hapi.validation.support.ValidationSupportChain;
import org.hl7.fhir.common.hapi.validation.validator.FhirInstanceValidator;
import org.hl7.fhir.r5.hapi.ctx.HapiWorkerContext;
import org.hl7.fhir.r5.model.*;
import org.hl7.fhir.r5.model.Attachment;
import org.hl7.fhir.r5.model.BooleanType;
import org.hl7.fhir.r5.model.CodeSystem;
import org.hl7.fhir.r5.model.CodeSystem.CodeSystemContentMode;
import org.hl7.fhir.r5.model.Coding;
import org.hl7.fhir.r5.model.DataType;
import org.hl7.fhir.r5.model.DateTimeType;
import org.hl7.fhir.r5.model.DateType;
import org.hl7.fhir.r5.model.DecimalType;
import org.hl7.fhir.r5.model.IntegerType;
import org.hl7.fhir.r5.model.MarkdownType;
import org.hl7.fhir.r5.model.Narrative;
import org.hl7.fhir.r5.model.Quantity;
import org.hl7.fhir.r5.model.Questionnaire;
import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent;
import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType;
import org.hl7.fhir.r5.model.QuestionnaireResponse;
import org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseItemComponent;
import org.hl7.fhir.r5.model.QuestionnaireResponse.QuestionnaireResponseStatus;
import org.hl7.fhir.r5.model.Reference;
import org.hl7.fhir.r5.model.StringType;
import org.hl7.fhir.r5.model.TimeType;
import org.hl7.fhir.r5.model.UriType;
import org.hl7.fhir.r5.model.ValueSet;
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeEach;
@ -29,6 +47,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
@ -102,7 +121,7 @@ public class QuestionnaireResponseValidatorR5Test {
when(myValSupport.validateCodeInValueSet(any(), any(), any(), any(), any(), nullable(ValueSet.class)))
.thenReturn(new IValidationSupport.CodeValidationResult().setCode("code0"));
int itemCnt = 16;
int itemCnt = 15;
QuestionnaireItemType[] questionnaireItemTypes = new QuestionnaireItemType[itemCnt];
questionnaireItemTypes[0] = QuestionnaireItemType.BOOLEAN;
questionnaireItemTypes[1] = QuestionnaireItemType.DECIMAL;
@ -114,12 +133,11 @@ public class QuestionnaireResponseValidatorR5Test {
questionnaireItemTypes[7] = QuestionnaireItemType.TEXT;
questionnaireItemTypes[8] = QuestionnaireItemType.TEXT;
questionnaireItemTypes[9] = QuestionnaireItemType.URL;
questionnaireItemTypes[10] = QuestionnaireItemType.CHOICE;
questionnaireItemTypes[11] = QuestionnaireItemType.OPENCHOICE;
questionnaireItemTypes[12] = QuestionnaireItemType.OPENCHOICE;
questionnaireItemTypes[13] = QuestionnaireItemType.ATTACHMENT;
questionnaireItemTypes[14] = QuestionnaireItemType.REFERENCE;
questionnaireItemTypes[15] = QuestionnaireItemType.QUANTITY;
questionnaireItemTypes[10] = QuestionnaireItemType.CODING;
questionnaireItemTypes[11] = QuestionnaireItemType.CODING;
questionnaireItemTypes[12] = QuestionnaireItemType.ATTACHMENT;
questionnaireItemTypes[13] = QuestionnaireItemType.REFERENCE;
questionnaireItemTypes[14] = QuestionnaireItemType.QUANTITY;
DataType[] answerValues = new DataType[itemCnt];
answerValues[0] = new BooleanType(true);
@ -134,10 +152,9 @@ public class QuestionnaireResponseValidatorR5Test {
answerValues[9] = new UriType("http://example.com");
answerValues[10] = new Coding().setSystem("http://codesystems.com/system").setCode("code0");
answerValues[11] = new Coding().setSystem("http://codesystems.com/system").setCode("code0");
answerValues[12] = new StringType("some value");
answerValues[13] = new Attachment().setData("some data".getBytes()).setContentType("txt");
answerValues[14] = new Reference("http://example.com/Questionnaire/q1");
answerValues[15] = new Quantity(42);
answerValues[12] = new Attachment().setData("some data".getBytes()).setContentType("txt");
answerValues[13] = new Reference("http://example.com/Questionnaire/q1");
answerValues[14] = new Quantity(42);
for (int i = 0; i < itemCnt; i++) {
@ -195,7 +212,7 @@ public class QuestionnaireResponseValidatorR5Test {
String questionnaireRef = "http://example.com/Questionnaire/q1";
Questionnaire q = new Questionnaire();
q.addItem().setLinkId("link0").setRequired(false).setType(QuestionnaireItemType.CHOICE).setAnswerValueSet("http://somevalueset");
q.addItem().setLinkId("link0").setRequired(false).setType(QuestionnaireItemType.CODING).setAnswerValueSet("http://somevalueset");
when(myValSupport.fetchResource(eq(Questionnaire.class), eq("http://example.com/Questionnaire/q1"))).thenReturn(q);
when(myValSupport.isCodeSystemSupported(any(), eq("http://codesystems.com/system"))).thenReturn(true);
@ -238,7 +255,7 @@ public class QuestionnaireResponseValidatorR5Test {
qa.addItem().setLinkId("link0").addAnswer().setValue(new Coding().setSystem("http://codesystems.com/system").setCode("code0"));
errors = myVal.validateWithResult(qa);
errors = stripBindingHasNoSourceMessage(errors);
assertEquals( 0, errors.getMessages().size(), errors.toString());
assertEquals(0, errors.getMessages().size(), errors.toString());
// Bad code
@ -336,7 +353,7 @@ public class QuestionnaireResponseValidatorR5Test {
// create the questionnaire
QuestionnaireItemComponent item1 = new QuestionnaireItemComponent();
item1.setLinkId("link1")
.setType(QuestionnaireItemType.CHOICE)
.setType(QuestionnaireItemType.CODING)
.setAnswerValueSet(valueSetRef);
item1.addItem().setLinkId("link11")
@ -392,7 +409,7 @@ public class QuestionnaireResponseValidatorR5Test {
// create the questionnaire
QuestionnaireItemComponent item1 = new QuestionnaireItemComponent();
item1.setLinkId("link1")
.setType(QuestionnaireItemType.OPENCHOICE)
.setType(QuestionnaireItemType.CODING)
.setAnswerValueSet(valueSetRef);
item1.addItem().setLinkId("link11")
@ -513,7 +530,7 @@ public class QuestionnaireResponseValidatorR5Test {
Questionnaire q = new Questionnaire();
QuestionnaireItemComponent item = q.addItem();
item.setLinkId("link0").setRequired(true).setType(QuestionnaireItemType.OPENCHOICE).setAnswerValueSet("http://somevalueset");
item.setLinkId("link0").setRequired(true).setType(QuestionnaireItemType.CODING).setAnswerValueSet("http://somevalueset").setAnswerConstraint(Questionnaire.QuestionnaireAnswerConstraint.OPTIONSORTYPE);
when(myValSupport.fetchResource(eq(Questionnaire.class), eq(questionnaireRef))).thenReturn(q);
CodeSystem codeSystem = new CodeSystem();
@ -570,10 +587,10 @@ public class QuestionnaireResponseValidatorR5Test {
qa.getText().setDiv(new XhtmlNode().setValue("<div>AA</div>")).setStatus(Narrative.NarrativeStatus.GENERATED);
qa.setStatus(QuestionnaireResponseStatus.COMPLETED);
qa.getQuestionnaireElement().setValue(questionnaireRef);
qa.addItem().setLinkId("link0").addAnswer().setValue(new Coding().setDisplay("Hello"));
qa.addItem().setLinkId("link0").addAnswer().setValue(new StringType("Hello"));
errors = myVal.validateWithResult(qa);
ourLog.info(errors.toString());
assertThat(errors.getMessages(), empty());
assertThat(errors.getMessages().stream().filter(t->t.getSeverity().ordinal() > ResultSeverityEnum.INFORMATION.ordinal()).collect(Collectors.toList()), empty());
// Missing String answer
@ -660,7 +677,7 @@ public class QuestionnaireResponseValidatorR5Test {
basicGroup
.addItem()
.setLinkId("schoolType")
.setType(QuestionnaireItemType.CHOICE)
.setType(QuestionnaireItemType.CODING)
.setAnswerValueSet(ID_VS_SCHOOLTYPE)
.setRequired(true);
}

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -58,37 +58,37 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu3</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-hl7org-dstu2</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-r4</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-r5</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-dstu2</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-dstu3</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-r4</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>

View File

@ -126,12 +126,12 @@ public class VersionPropertyFileGeneratorMojo extends AbstractMojo {
public static void main(String[] theArgs) throws MojoFailureException {
VersionPropertyFileGeneratorMojo m = new VersionPropertyFileGeneratorMojo();
m.packageName = "org.hl7.fhir.r4.model";
m.targetFile = new File("hapi-fhir-structures-r4/src/main/resources/org/hl7/fhir/r4/model/fhirversion.properties");
m.execute();
// VersionPropertyFileGeneratorMojo m = new VersionPropertyFileGeneratorMojo();
// m.packageName = "org.hl7.fhir.r4.model";
// m.targetFile = new File("hapi-fhir-structures-r4/src/main/resources/org/hl7/fhir/r4/model/fhirversion.properties");
// m.execute();
m = new VersionPropertyFileGeneratorMojo();
VersionPropertyFileGeneratorMojo m = new VersionPropertyFileGeneratorMojo();
m.packageName = "org.hl7.fhir.r5.model";
m.targetFile = new File("hapi-fhir-structures-r5/src/main/resources/org/hl7/fhir/r5/model/fhirversion.properties");
m.execute();

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<packaging>pom</packaging>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<name>HAPI-FHIR</name>
<description>An open-source implementation of the FHIR specification in Java.</description>
<url>https://hapifhir.io</url>
@ -743,7 +743,7 @@
<properties>
<fhir_core_version>5.3.11</fhir_core_version>
<fhir_core_version>5.4.0</fhir_core_version>
<ucum_version>1.0.3</ucum_version>
<surefire_jvm_args>-Dfile.encoding=UTF-8 -Xmx2048m</surefire_jvm_args>

View File

@ -8,7 +8,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>5.4.0-PRE10-SNAPSHOT</version>
<version>5.4.0</version>
<relativePath>../../pom.xml</relativePath>
</parent>