Merge remote-tracking branch 'remotes/origin/master' into feature_2020_09_02_term_multi_version_support

This commit is contained in:
ianmarshall 2020-09-15 12:34:11 -04:00
commit 087c9e3c3b
24 changed files with 234 additions and 169 deletions

View File

@ -40,9 +40,8 @@ public class HapiLocalizer {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(HapiLocalizer.class);
private static boolean ourFailOnMissingMessage;
private final Map<String, MessageFormat> myKeyToMessageFormat = new ConcurrentHashMap<>();
private List<ResourceBundle> myBundle = new ArrayList<>();
private List<ResourceBundle> myBundle;
private final Map<String, String> myHardcodedMessages = new HashMap<>();
private String[] myBundleNames;
private Locale myLocale = Locale.getDefault();
public HapiLocalizer() {
@ -50,8 +49,7 @@ public class HapiLocalizer {
}
public HapiLocalizer(String... theBundleNames) {
myBundleNames = theBundleNames;
init();
init(theBundleNames);
addMessage("hapi.version", VersionUtil.getVersion());
}
@ -159,8 +157,9 @@ public class HapiLocalizer {
return new MessageFormat(pattern.toString());
}
protected void init() {
for (String nextName : myBundleNames) {
protected void init(String[] theBundleNames) {
myBundle = new ArrayList<>();
for (String nextName : theBundleNames) {
myBundle.add(ResourceBundle.getBundle(nextName));
}
}

View File

@ -243,10 +243,10 @@
"description": "With the ACS App, Community Health Agents (CHA) work gets faster and faster, and they can take better care of their community. Best of all, it is 100% free to the Health Agent.",
"link": "http://ephealth.com.br/?lang=en",
"contactName": "Alan Lescano",
"contactEmail": "alan@ephealth.com.br",
"contactEmail": "alan.lesc1@gmail.com",
"city": "Sao Paulo, Brazil",
"lat": -6.6167,
"lon": -38.1500,
"lat": -23.533773,
"lon": -46.625290,
"added": "2019-09-29"
},
{
@ -259,16 +259,7 @@
"added": "2019-11-25"
},
{
"title": "Software Interoperability Lab for Asia",
"description": "",
"link": "",
"city": "Manila, Philippines",
"lat": 14.6914,
"lon": 120.9686,
"added": "2019-11-25"
},
{
"title": "Software Interoperability Lab for Asia",
"title": "Standards and Interoperability Lab Asia",
"description": "SIL-A maintains a suite of tools used to promote interoperability and medical informatics across Asia.",
"link": "http://sil-asia.org/",
"city": "Manila, Philippines",

View File

@ -0,0 +1,5 @@
---
type: add
issue: 2078
title: "When using package support to install a package with STORE_AND_INSTALL mode, resources that are already
present in the database will now be updated to the contents of the version in the package."

View File

@ -4,5 +4,11 @@
title: "The version of a few dependencies have been bumped to the latest versions
(dependent HAPI modules listed in brackets):
<ul>
<li>Flyway (JPA): 6.4.1-&gt; 6.5.4</li>
<li>Jackson (Base): 2.10.0 -&gt; 2.11.2</li>
<li>Flyway (JPA): 6.4.1 -&gt; 6.5.4</li>
<li>UCUM (JPA): 1.0.2 -&gt; 1.0.3</li>
<li>JQuery (Testpage Overlay): 3.3.1 -&gt; 3.5.1</li>
<li>Awesome Bootstrap Checkbos (Testpage Overlay): 1.0.1 -&gt; 1.0.2</li>
<li>MomentJS (Testpage Overlay): 2.15.1 -&gt; 2.27.0</li>
<li>Select2 (Testpage Overlay): 4.0.3 -&gt; 4.0.13</li>
</ul>"

View File

@ -45,7 +45,7 @@ public class DaoSearchParamProvider implements ISearchParamProvider {
@Override
public int refreshCache(SearchParamRegistryImpl theSearchParamRegistry, long theRefreshInterval) {
int retVal = 0;
if (myDaoRegistry.getResourceDao("SearchParameter") != null) {
if (myDaoRegistry.getResourceDaoOrNull("SearchParameter") != null) {
retVal = theSearchParamRegistry.doRefresh(theRefreshInterval);
}
return retVal;

View File

@ -29,11 +29,13 @@ import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
import ca.uhn.fhir.jpa.dao.data.INpmPackageVersionDao;
import ca.uhn.fhir.jpa.model.entity.NpmPackageVersionEntity;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistry;
import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.param.StringParam;
import ca.uhn.fhir.rest.param.TokenParam;
import ca.uhn.fhir.rest.param.UriParam;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException;
import ca.uhn.fhir.util.FhirTerser;
import ca.uhn.fhir.util.SearchParameterUtil;
import com.google.common.annotations.VisibleForTesting;
@ -94,6 +96,8 @@ public class PackageInstallerSvcImpl implements IPackageInstallerSvc {
private PlatformTransactionManager myTxManager;
@Autowired
private INpmPackageVersionDao myPackageVersionDao;
@Autowired
private ISearchParamRegistry mySearchParamRegistry;
/**
* Constructor
@ -161,6 +165,9 @@ public class PackageInstallerSvcImpl implements IPackageInstallerSvc {
if (theInstallationSpec.getInstallMode() == PackageInstallationSpec.InstallModeEnum.STORE_AND_INSTALL) {
install(npmPackage, theInstallationSpec, retVal);
// If any SearchParameters were installed, let's load them right away
mySearchParamRegistry.refreshCacheIfNecessary();
}
} catch (IOException e) {
@ -304,11 +311,20 @@ public class PackageInstallerSvcImpl implements IPackageInstallerSvc {
IFhirResourceDao dao = myDaoRegistry.getResourceDao(theResource.getClass());
SearchParameterMap map = createSearchParameterMapFor(theResource);
IBundleProvider searchResult = dao.search(map);
if (searchResult.isEmpty()) {
if (validForUpload(theResource)) {
if (searchResult.isEmpty()) {
if (validForUpload(theResource)) {
ourLog.info("Creating new resource matching {}", map.toNormalizedQueryString(myFhirContext));
theOutcome.incrementResourcesInstalled(myFhirContext.getResourceType(theResource));
dao.create(theResource);
} else {
ourLog.info("Updating existing resource matching {}", map.toNormalizedQueryString(myFhirContext));
theOutcome.incrementResourcesInstalled(myFhirContext.getResourceType(theResource));
theResource.setId(searchResult.getResources(0,1).get(0).getIdElement().toUnqualifiedVersionless());
dao.update(theResource);
}
}

View File

@ -11,8 +11,11 @@ import ca.uhn.fhir.jpa.model.entity.NpmPackageEntity;
import ca.uhn.fhir.jpa.model.entity.NpmPackageVersionEntity;
import ca.uhn.fhir.jpa.model.entity.NpmPackageVersionResourceEntity;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistry;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.param.ReferenceParam;
import ca.uhn.fhir.rest.param.TokenParam;
import ca.uhn.fhir.rest.param.UriParam;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.test.utilities.JettyUtil;
@ -22,7 +25,13 @@ import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.r4.model.Enumerations;
import org.hl7.fhir.r4.model.ImplementationGuide;
import org.hl7.fhir.r4.model.Organization;
import org.hl7.fhir.r4.model.PractitionerRole;
import org.hl7.fhir.r4.model.Reference;
import org.hl7.fhir.r4.model.SearchParameter;
import org.hl7.fhir.r4.model.StructureDefinition;
import org.hl7.fhir.utilities.cache.NpmPackage;
import org.junit.jupiter.api.AfterEach;
@ -230,7 +239,6 @@ public class NpmTestR4 extends BaseJpaR4Test {
}
@Test
public void testInstallR4PackageWithNoDescription() throws Exception {
myDaoConfig.setAllowExternalReferences(true);
@ -433,6 +441,53 @@ public class NpmTestR4 extends BaseJpaR4Test {
}
@Test
public void testInstallPkgContainingSearchParameter() throws IOException {
myDaoConfig.setAllowExternalReferences(true);
byte[] contents0111 = loadClasspathBytes("/packages/test-exchange-sample.tgz");
myFakeNpmServlet.myResponses.put("/test-exchange.fhir.us.com/2.1.1", contents0111);
contents0111 = loadClasspathBytes("/packages/test-exchange-sample-2.tgz");
myFakeNpmServlet.myResponses.put("/test-exchange.fhir.us.com/2.1.2", contents0111);
// Install older version
PackageInstallationSpec spec = new PackageInstallationSpec().setName("test-exchange.fhir.us.com").setVersion("2.1.1").setInstallMode(PackageInstallationSpec.InstallModeEnum.STORE_AND_INSTALL);
igInstaller.install(spec);
IBundleProvider spSearch = mySearchParameterDao.search(SearchParameterMap.newSynchronous("code", new TokenParam("network-id")));
assertEquals(1, spSearch.sizeOrThrowNpe());
SearchParameter sp = (SearchParameter) spSearch.getResources(0, 1).get(0);
assertEquals("network-id", sp.getCode());
assertEquals("2.1", sp.getVersion());
assertEquals(Enumerations.PublicationStatus.ACTIVE, sp.getStatus());
Organization org = new Organization();
org.setName("Hello");
IIdType orgId = myOrganizationDao.create(org).getId().toUnqualifiedVersionless();
PractitionerRole pr = new PractitionerRole();
pr.addExtension().setUrl("http://test-exchange.com/fhir/us/providerdataexchange/StructureDefinition/networkreference").setValue(new Reference(orgId));
myPractitionerRoleDao.create(pr);
SearchParameterMap map = SearchParameterMap.newSynchronous("network-id", new ReferenceParam(orgId.getValue()));
spSearch = myPractitionerRoleDao.search(map);
assertEquals(1, spSearch.sizeOrThrowNpe());
// Install newer version
spec = new PackageInstallationSpec().setName("test-exchange.fhir.us.com").setVersion("2.1.2").setInstallMode(PackageInstallationSpec.InstallModeEnum.STORE_AND_INSTALL);
igInstaller.install(spec);
spSearch = mySearchParameterDao.search(SearchParameterMap.newSynchronous("code", new TokenParam("network-id")));
assertEquals(1, spSearch.sizeOrThrowNpe());
sp = (SearchParameter) spSearch.getResources(0, 1).get(0);
assertEquals("network-id", sp.getCode());
assertEquals(Enumerations.PublicationStatus.ACTIVE, sp.getStatus());
assertEquals("2.2", sp.getVersion());
}
@Test
public void testLoadContents() throws IOException {
byte[] contents0111 = loadClasspathBytes("/packages/hl7.fhir.uv.shorthand-0.11.1.tgz");

View File

@ -50,6 +50,7 @@ public abstract class BaseColumnCalculatorTask extends BaseTableColumnTask {
protected static final Logger ourLog = LoggerFactory.getLogger(BaseColumnCalculatorTask.class);
private int myBatchSize = 10000;
private ThreadPoolExecutor myExecutor;
private String myPidColumnName;
/**
* Constructor
@ -160,6 +161,10 @@ public abstract class BaseColumnCalculatorTask extends BaseTableColumnTask {
rejectedExecutionHandler);
}
public void setPidColumnName(String thePidColumnName) {
myPidColumnName = thePidColumnName;
}
private Future<?> updateRows(List<Map<String, Object>> theRows) {
Runnable task = () -> {
StopWatch sw = new StopWatch();
@ -193,8 +198,8 @@ public abstract class BaseColumnCalculatorTask extends BaseTableColumnTask {
sqlBuilder.append(nextNewValueEntry.getKey()).append(" = ?");
arguments.add(nextNewValueEntry.getValue());
}
sqlBuilder.append(" WHERE SP_ID = ?");
arguments.add((Number) nextRow.get("SP_ID"));
sqlBuilder.append(" WHERE " + myPidColumnName + " = ?");
arguments.add((Number) nextRow.get(myPidColumnName));
// Apply update SQL
newJdbcTemplate().update(sqlBuilder.toString(), arguments.toArray());

View File

@ -60,6 +60,14 @@ public abstract class BaseTask {
mySchemaVersion = theSchemaVersion;
}
public String getProductVersion() {
return myProductVersion;
}
public String getSchemaVersion() {
return mySchemaVersion;
}
public boolean isNoColumnShrink() {
return myNoColumnShrink;
}
@ -137,16 +145,18 @@ public abstract class BaseTask {
return myConnectionProperties;
}
public void setConnectionProperties(DriverTypeEnum.ConnectionProperties theConnectionProperties) {
public BaseTask setConnectionProperties(DriverTypeEnum.ConnectionProperties theConnectionProperties) {
myConnectionProperties = theConnectionProperties;
return this;
}
public DriverTypeEnum getDriverType() {
return myDriverType;
}
public void setDriverType(DriverTypeEnum theDriverType) {
public BaseTask setDriverType(DriverTypeEnum theDriverType) {
myDriverType = theDriverType;
return this;
}
public abstract void validate();

View File

@ -46,6 +46,7 @@ public class CalculateHashesTask extends BaseColumnCalculatorTask {
public CalculateHashesTask(VersionEnum theRelease, String theVersion) {
super(theRelease, theVersion);
setDescription("Calculate resource search parameter index hashes");
setPidColumnName("SP_ID");
}
@Override

View File

@ -28,6 +28,7 @@ public class CalculateOrdinalDatesTask extends BaseColumnCalculatorTask {
super(theRelease, theVersion);
setDescription("Calculate SP_LOW_VALUE_DATE_ORDINAL and SP_HIGH_VALUE_DATE_ORDINAL based on existing SP_VALUE_LOW and SP_VALUE_HIGH date values in Date Search Params");
setWhereClause("(SP_VALUE_LOW_DATE_ORDINAL IS NULL AND SP_VALUE_LOW IS NOT NULL) OR (SP_VALUE_HIGH_DATE_ORDINAL IS NULL AND SP_VALUE_HIGH IS NOT NULL)");
setPidColumnName("SP_ID");
}
@Override

View File

@ -86,9 +86,13 @@ public class DropIndexTask extends BaseTableTask {
@Language("SQL") String findConstraintSql = "SELECT DISTINCT constraint_name FROM user_cons_columns WHERE constraint_name = ? AND table_name = ?";
@Language("SQL") String dropConstraintSql = "ALTER TABLE " + getTableName() + " DROP CONSTRAINT ?";
findAndDropConstraint(findConstraintSql, dropConstraintSql);
findConstraintSql = "SELECT DISTINCT constraint_name FROM all_constraints WHERE index_name = ? AND table_name = ?";
findAndDropConstraint(findConstraintSql, dropConstraintSql);
} else if (getDriverType() == DriverTypeEnum.MSSQL_2012) {
// Legacy deletion for SQL Server unique indexes
@Language("SQL") String findConstraintSql = "SELECT tc.CONSTRAINT_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS AS tc WHERE tc.CONSTRAINT_NAME = ? AND tc.TABLE_NAME = ?";
@Language("SQL") String dropConstraintSql = "ALTER TABLE " + getTableName() + " DROP CONSTRAINT ?";
findAndDropConstraint(findConstraintSql, dropConstraintSql);
}
Set<String> indexNames = JdbcUtils.getIndexNames(getConnectionProperties(), getTableName());

View File

@ -63,14 +63,15 @@ public class DropTableTask extends BaseTableTask {
}
}
DropIndexTask theIndexTask = new DropIndexTask(getProductVersion(), getSchemaVersion());
theIndexTask
.setTableName(getTableName())
.setConnectionProperties(getConnectionProperties())
.setDriverType(getDriverType());
for (String nextIndex : indexNames) {
List<String> sqls = DropIndexTask.createDropIndexSql(getConnectionProperties(), getTableName(), nextIndex, getDriverType());
if (!sqls.isEmpty()) {
logInfo(ourLog, "Dropping index {} on table {} in preparation for table delete", nextIndex, getTableName());
}
for (@Language("SQL") String sql : sqls) {
executeSql(getTableName(), sql);
}
theIndexTask
.setIndexName(nextIndex)
.execute();
}
logInfo(ourLog, "Dropping table: {}", getTableName());

View File

@ -6,6 +6,7 @@ import ca.uhn.fhir.jpa.model.entity.ModelConfig;
import ca.uhn.fhir.jpa.search.LuceneSearchMappingFactory;
import ca.uhn.fhir.jpa.util.CurrentThreadCaptureQueriesListener;
import ca.uhn.fhir.jpa.util.DerbyTenSevenHapiFhirDialect;
import ca.uhn.fhir.jpa.validation.ValidationSettings;
import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor;
import ca.uhn.fhir.validation.IValidatorModule;
import ca.uhn.fhir.validation.ResultSeverityEnum;
@ -15,6 +16,7 @@ import org.apache.commons.dbcp2.BasicDataSource;
import org.apache.commons.lang3.time.DateUtils;
import org.hibernate.dialect.PostgreSQL94Dialect;
import org.hl7.fhir.dstu2.model.Subscription;
import org.hl7.fhir.r5.utils.IResourceValidator;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@ -81,6 +83,15 @@ public class TestDstu2Config extends BaseJavaConfigDstu2 {
return daoConfig().getModelConfig();
}
@Override
@Bean
public ValidationSettings validationSettings() {
ValidationSettings retVal = super.validationSettings();
retVal.setLocalReferenceValidationDefaultPolicy(IResourceValidator.ReferenceValidationPolicy.CHECK_VALID);
return retVal;
}
@Bean(name = "myPersistenceDataSourceDstu1", destroyMethod = "close")
public DataSource dataSource() {
BasicDataSource retVal = new BasicDataSource();

View File

@ -7,6 +7,7 @@ import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
import ca.uhn.fhir.jpa.search.LuceneSearchMappingFactory;
import ca.uhn.fhir.jpa.util.CurrentThreadCaptureQueriesListener;
import ca.uhn.fhir.jpa.util.DerbyTenSevenHapiFhirDialect;
import ca.uhn.fhir.jpa.validation.ValidationSettings;
import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor;
import ca.uhn.fhir.validation.ResultSeverityEnum;
import ca.uhn.fhirtest.interceptor.PublicSecurityInterceptor;
@ -15,6 +16,7 @@ import org.apache.commons.dbcp2.BasicDataSource;
import org.apache.commons.lang3.time.DateUtils;
import org.hibernate.dialect.PostgreSQL94Dialect;
import org.hl7.fhir.dstu2.model.Subscription;
import org.hl7.fhir.r5.utils.IResourceValidator;
import org.springframework.beans.factory.annotation.Autowire;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
@ -80,6 +82,17 @@ public class TestDstu3Config extends BaseJavaConfigDstu3 {
}
@Override
@Bean
public ValidationSettings validationSettings() {
ValidationSettings retVal = super.validationSettings();
retVal.setLocalReferenceValidationDefaultPolicy(IResourceValidator.ReferenceValidationPolicy.CHECK_VALID);
return retVal;
}
@Override
@Bean(autowire = Autowire.BY_TYPE)
public DatabaseBackedPagingProvider databaseBackedPagingProvider() {

View File

@ -7,6 +7,7 @@ import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
import ca.uhn.fhir.jpa.search.LuceneSearchMappingFactory;
import ca.uhn.fhir.jpa.util.CurrentThreadCaptureQueriesListener;
import ca.uhn.fhir.jpa.util.DerbyTenSevenHapiFhirDialect;
import ca.uhn.fhir.jpa.validation.ValidationSettings;
import ca.uhn.fhir.rest.client.interceptor.ThreadLocalCapturingInterceptor;
import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor;
import ca.uhn.fhir.validation.ResultSeverityEnum;
@ -16,6 +17,7 @@ import org.apache.commons.dbcp2.BasicDataSource;
import org.apache.commons.lang3.time.DateUtils;
import org.hibernate.dialect.PostgreSQL94Dialect;
import org.hl7.fhir.dstu2.model.Subscription;
import org.hl7.fhir.r5.utils.IResourceValidator;
import org.springframework.beans.factory.annotation.Autowire;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
@ -81,6 +83,15 @@ public class TestR4Config extends BaseJavaConfigR4 {
}
@Override
@Bean
public ValidationSettings validationSettings() {
ValidationSettings retVal = super.validationSettings();
retVal.setLocalReferenceValidationDefaultPolicy(IResourceValidator.ReferenceValidationPolicy.CHECK_VALID);
return retVal;
}
@Bean(name = "myPersistenceDataSourceR4", destroyMethod = "close")
public DataSource dataSource() {
BasicDataSource retVal = new BasicDataSource();

View File

@ -7,6 +7,7 @@ import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
import ca.uhn.fhir.jpa.search.LuceneSearchMappingFactory;
import ca.uhn.fhir.jpa.util.CurrentThreadCaptureQueriesListener;
import ca.uhn.fhir.jpa.util.DerbyTenSevenHapiFhirDialect;
import ca.uhn.fhir.jpa.validation.ValidationSettings;
import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor;
import ca.uhn.fhir.validation.ResultSeverityEnum;
import ca.uhn.fhirtest.interceptor.PublicSecurityInterceptor;
@ -15,6 +16,7 @@ import org.apache.commons.dbcp2.BasicDataSource;
import org.apache.commons.lang3.time.DateUtils;
import org.hibernate.dialect.PostgreSQL94Dialect;
import org.hl7.fhir.dstu2.model.Subscription;
import org.hl7.fhir.r5.utils.IResourceValidator;
import org.springframework.beans.factory.annotation.Autowire;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
@ -79,6 +81,16 @@ public class TestR5Config extends BaseJavaConfigR5 {
return daoConfig().getModelConfig();
}
@Override
@Bean
public ValidationSettings validationSettings() {
ValidationSettings retVal = super.validationSettings();
retVal.setLocalReferenceValidationDefaultPolicy(IResourceValidator.ReferenceValidationPolicy.CHECK_VALID);
return retVal;
}
@Bean(name = "myPersistenceDataSourceR5", destroyMethod = "close")
public DataSource dataSource() {

View File

@ -106,6 +106,13 @@ public interface ITestDataBuilder {
};
}
/**
* Set Organization.name
*/
default Consumer<IBaseResource> withName(String theStatus) {
return t -> __setPrimitiveChild(getFhirContext(), t, "name", "string", theStatus);
}
default Consumer<IBaseResource> withId(String theId) {
return t -> {
assertThat(theId, matchesPattern("[a-zA-Z0-9]+"));
@ -129,6 +136,10 @@ public interface ITestDataBuilder {
return createResource("Patient", theModifiers);
}
default IIdType createOrganization(Consumer<IBaseResource>... theModifiers) {
return createResource("Organization", theModifiers);
}
default IIdType createResource(String theResourceType, Consumer<IBaseResource>[] theModifiers) {
IBaseResource resource = getFhirContext().getResourceDefinition(theResourceType).newInstance();
for (Consumer<IBaseResource> next : theModifiers) {
@ -155,6 +166,30 @@ public interface ITestDataBuilder {
};
}
default Consumer<IBaseResource> withObservationHasMember(@Nullable IIdType theHasMember) {
return t -> {
if (theHasMember != null) {
IBaseReference reference = (IBaseReference) getFhirContext().getElementDefinition("Reference").newInstance();
reference.setReference(theHasMember.getValue());
RuntimeResourceDefinition resourceDef = getFhirContext().getResourceDefinition(t.getClass());
resourceDef.getChildByName("hasMember").getMutator().addValue(t, reference);
}
};
}
default Consumer<IBaseResource> withOrganization(@Nullable IIdType theHasMember) {
return t -> {
if (theHasMember != null) {
IBaseReference reference = (IBaseReference) getFhirContext().getElementDefinition("Reference").newInstance();
reference.setReference(theHasMember.getValue());
RuntimeResourceDefinition resourceDef = getFhirContext().getResourceDefinition(t.getClass());
resourceDef.getChildByName("managingOrganization").getMutator().addValue(t, reference);
}
};
}
/**
* Users of this API must implement this method
*/

View File

@ -29,8 +29,8 @@
<script th:src="@{/resources/moment/min/moment-with-locales.min.js}"></script>
<link th:href="@{/resources/Eonasdan-bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css}" rel="stylesheet" />
<script th:src="@{/resources/Eonasdan-bootstrap-datetimepicker/js/bootstrap-datetimepicker.js}"></script>
<link th:href="@{/resources/select2/dist/css/select2.css}" rel="stylesheet"/>
<script th:src="@{/resources/select2/dist/js/select2.min.js}"></script>
<link th:href="@{/resources/select2/css/select2.css}" rel="stylesheet"/>
<script th:src="@{/resources/select2/js/select2.min.js}"></script>
<script src="js/RestfulTester.js" type="text/javascript"></script>

View File

@ -38,8 +38,6 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IInsta
private boolean assumeValidRestReferences;
private List<String> myExtensionDomains = Collections.emptyList();
private IResourceValidator.IValidatorResourceFetcher validatorResourceFetcher;
private volatile FhirContext myDstu2Context;
private volatile FhirContext myHl7OrgDstu2Context;
/**
* Constructor
@ -136,8 +134,6 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IInsta
/**
* Returns the {@link IValidationSupport validation support} in use by this validator. Default is an instance of
* DefaultProfileValidationSupport if the no-arguments constructor for this object was used.
*
* @return
*/
public IValidationSupport getValidationSupport() {
return myValidationSupport;
@ -276,24 +272,6 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IInsta
return wrappedWorkerContext;
}
private FhirContext getDstu2Context() {
FhirContext dstu2Context = myDstu2Context;
if (dstu2Context == null) {
dstu2Context = FhirContext.forDstu2();
myDstu2Context = dstu2Context;
}
return dstu2Context;
}
private FhirContext getHl7OrgDstu2Context() {
FhirContext hl7OrgDstu2Context = myHl7OrgDstu2Context;
if (hl7OrgDstu2Context == null) {
hl7OrgDstu2Context = FhirContext.forDstu2Hl7Org();
myHl7OrgDstu2Context = hl7OrgDstu2Context;
}
return hl7OrgDstu2Context;
}
public IResourceValidator.IValidatorResourceFetcher getValidatorResourceFetcher() {
return validatorResourceFetcher;
}

View File

@ -210,7 +210,7 @@
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.7.0</version>
<version>1.10.8</version>
</dependency>
<!-- This is just used for -->

127
pom.xml
View File

@ -679,7 +679,7 @@
<properties>
<fhir_core_version>5.1.0</fhir_core_version>
<ucum_version>1.0.2</ucum_version>
<ucum_version>1.0.3</ucum_version>
<surefire_jvm_args>-Dfile.encoding=UTF-8 -Xmx2048m</surefire_jvm_args>
@ -726,8 +726,8 @@
<hibernate_validator_version>6.1.3.Final</hibernate_validator_version>
<httpcore_version>4.4.13</httpcore_version>
<httpclient_version>4.5.12</httpclient_version>
<jackson_version>2.10.0</jackson_version>
<jackson_databind_version>2.10.0</jackson_databind_version>
<jackson_version>2.11.2</jackson_version>
<jackson_databind_version>2.11.2</jackson_databind_version>
<maven_assembly_plugin_version>3.1.0</maven_assembly_plugin_version>
<maven_license_plugin_version>1.8</maven_license_plugin_version>
<resteasy_version>4.0.0.Beta3</resteasy_version>
@ -1018,11 +1018,6 @@
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>io.github.devacfr.maven.skins</groupId>
<artifactId>reflow-velocity-tools</artifactId>
<version>2.0.0-beta2</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
@ -1572,6 +1567,12 @@
<groupId>org.webjars</groupId>
<artifactId>bootstrap</artifactId>
<version>3.3.7</version>
<exclusions>
<exclusion>
<groupId>org.webjars</groupId>
<artifactId>jquery</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
@ -1586,7 +1587,7 @@
<dependency>
<groupId>org.webjars.bower</groupId>
<artifactId>awesome-bootstrap-checkbox</artifactId>
<version>1.0.1</version>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
@ -1596,17 +1597,23 @@
<dependency>
<groupId>org.webjars</groupId>
<artifactId>select2</artifactId>
<version>4.0.3</version>
<version>4.0.13</version>
<exclusions>
<exclusion>
<groupId>org.webjars</groupId>
<artifactId>jquery</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.webjars.bower</groupId>
<artifactId>jquery</artifactId>
<version>3.3.1</version>
<version>3.5.1</version>
</dependency>
<dependency>
<groupId>org.webjars.bower</groupId>
<artifactId>moment</artifactId>
<version>2.15.1</version>
<version>2.27.0</version>
</dependency>
<dependency>
<groupId>org.xmlunit</groupId>
@ -1873,49 +1880,6 @@
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
<configuration>
<skip>false</skip>
<skipDeploy>true</skipDeploy>
<inputEncoding>UTF-8</inputEncoding>
<outputEncoding>UTF-8</outputEncoding>
<relativizeDecorationLinks>false</relativizeDecorationLinks>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-scm</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-manager-plexus</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gitexe</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-api</artifactId>
</dependency>
<!-- <dependency> <groupId>org.apache.maven.doxia</groupId> <artifactId>doxia-core</artifactId> </dependency> -->
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-module-markdown</artifactId>
</dependency>
<dependency>
<groupId>io.github.devacfr.maven.skins</groupId>
<artifactId>reflow-velocity-tools</artifactId>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
</dependency>
</dependencies>
</plugin>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
@ -2310,59 +2274,6 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<inherited>false</inherited>
<executions>
<execution>
<id>stage-for-scm-publish</id>
<phase>post-site</phase>
<goals>
<goal>stage</goal>
</goals>
<configuration>
<stagingDirectory>${siteMainDirectory}</stagingDirectory>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-scm</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-manager-plexus</artifactId>
<version>1.9.5</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gitexe</artifactId>
<version>1.9.5</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-api</artifactId>
<version>1.9.5</version>
</dependency>
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-module-markdown</artifactId>
<version>1.8</version>
</dependency>
<dependency>
<groupId>io.github.devacfr.maven.skins</groupId>
<artifactId>reflow-velocity-tools</artifactId>
<version>2.0.0-beta2</version>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.7</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-publish-plugin</artifactId>