Add support for _revinclude in web tester UI
This commit is contained in:
parent
4a5e13b301
commit
8f27462db7
|
@ -29,7 +29,7 @@
|
|||
|
||||
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
|
||||
<property name="dataSource" ref="myPersistenceDataSource" />
|
||||
<property name="persistenceUnitName" value="FHIR_UT" />
|
||||
<!-- <property name="persistenceUnitName" value="FHIR_UT" /> -->
|
||||
<property name="jpaVendorAdapter">
|
||||
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
|
||||
<property name="showSql" value="false" />
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<value>hi , DSTU1 , Health Intersections (DSTU1 FHIR) , http://fhir.healthintersections.com.au/open</value>
|
||||
<value>furored2 , DSTU2 , Spark - Furore (DSTU2 FHIR) , http://spark-dstu2.furore.com/fhir</value>
|
||||
<value>furore , DSTU1 , Spark - Furore (DSTU1 FHIR) , http://spark.furore.com/fhir</value>
|
||||
<value>sof , DSTU2 , SQL on FHIR - HealthConnex (DSTU2 FHIR) , https://sqlonfhir.azurewebsites.net/api</value>
|
||||
<value>sof , DSTU2 , SQL on FHIR - HealthConnex (DSTU2 FHIR) , http://sqlonfhir.azurewebsites.net/api</value>
|
||||
<!--
|
||||
<value>blaze , DSTU1 , Blaze (Orion Health) , https://fhir.orionhealth.com/blaze/fhir</value>
|
||||
<value>oridashi , DSTU1 , Oridashi , http://demo.oridashi.com.au:8190</value>
|
||||
|
|
|
@ -52,6 +52,8 @@ import ca.uhn.fhir.model.dstu.resource.Conformance.RestQuery;
|
|||
import ca.uhn.fhir.model.dstu.resource.Conformance.RestResource;
|
||||
import ca.uhn.fhir.model.dstu.resource.Conformance.RestResourceSearchParam;
|
||||
import ca.uhn.fhir.model.dstu.valueset.SearchParamTypeEnum;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.ResourceTypeEnum;
|
||||
import ca.uhn.fhir.model.primitive.BoundCodeDt;
|
||||
import ca.uhn.fhir.model.primitive.DateTimeDt;
|
||||
import ca.uhn.fhir.model.primitive.DecimalDt;
|
||||
import ca.uhn.fhir.model.primitive.IdDt;
|
||||
|
@ -333,6 +335,7 @@ public class Controller {
|
|||
RuntimeResourceDefinition def = getContext(theRequest).getResourceDefinition(theRequest.getResource());
|
||||
|
||||
TreeSet<String> includes = new TreeSet<String>();
|
||||
TreeSet<String> revIncludes = new TreeSet<String>();
|
||||
TreeSet<String> sortParams = new TreeSet<String>();
|
||||
List<RestQuery> queries = new ArrayList<Conformance.RestQuery>();
|
||||
boolean haveSearchParams = false;
|
||||
|
@ -341,7 +344,7 @@ public class Controller {
|
|||
switch (theRequest.getFhirVersion(myConfig)) {
|
||||
case DEV:
|
||||
case DSTU2:
|
||||
haveSearchParams = extractSearchParamsDev(conformance, resourceName, includes, sortParams, queries, haveSearchParams, queryIncludes);
|
||||
haveSearchParams = extractSearchParamsDev(conformance, resourceName, includes, revIncludes, sortParams, queries, haveSearchParams, queryIncludes);
|
||||
break;
|
||||
case DSTU1:
|
||||
haveSearchParams = extractSearchParamsDstu1(conformance, resourceName, includes, sortParams, queries, haveSearchParams, queryIncludes);
|
||||
|
@ -351,6 +354,7 @@ public class Controller {
|
|||
}
|
||||
|
||||
theModel.put("includes", includes);
|
||||
theModel.put("revincludes", revIncludes);
|
||||
theModel.put("queries", queries);
|
||||
theModel.put("haveSearchParams", haveSearchParams);
|
||||
theModel.put("queryIncludes", queryIncludes);
|
||||
|
@ -438,6 +442,18 @@ public class Controller {
|
|||
}
|
||||
clientCodeJsonWriter.writeEnd();
|
||||
|
||||
clientCodeJsonWriter.writeStartArray("revincludes");
|
||||
String[] revIncValues = theReq.getParameterValues(Constants.PARAM_REVINCLUDE);
|
||||
if (revIncValues != null) {
|
||||
for (String next : revIncValues) {
|
||||
if (isNotBlank(next)) {
|
||||
query.revInclude(new Include(next));
|
||||
clientCodeJsonWriter.write(next);
|
||||
}
|
||||
}
|
||||
}
|
||||
clientCodeJsonWriter.writeEnd();
|
||||
|
||||
String limit = theReq.getParameter("resource-search-limit");
|
||||
if (isNotBlank(limit)) {
|
||||
if (!limit.matches("[0-9]+")) {
|
||||
|
@ -699,7 +715,7 @@ public class Controller {
|
|||
|
||||
}
|
||||
|
||||
private boolean extractSearchParamsDev(IResource theConformance, String resourceName, TreeSet<String> includes, TreeSet<String> sortParams, List<RestQuery> queries, boolean haveSearchParams,
|
||||
private boolean extractSearchParamsDev(IResource theConformance, String resourceName, TreeSet<String> includes, TreeSet<String> theRevIncludes, TreeSet<String> sortParams, List<RestQuery> queries, boolean haveSearchParams,
|
||||
List<List<String>> queryIncludes) {
|
||||
ca.uhn.fhir.model.dstu2.resource.Conformance conformance = (ca.uhn.fhir.model.dstu2.resource.Conformance) theConformance;
|
||||
for (ca.uhn.fhir.model.dstu2.resource.Conformance.Rest nextRest : conformance.getRest()) {
|
||||
|
@ -718,6 +734,18 @@ public class Controller {
|
|||
if (nextRes.getSearchParam().size() > 0) {
|
||||
haveSearchParams = true;
|
||||
}
|
||||
} else {
|
||||
// It's a different resource from the one we're searching, so
|
||||
// scan for revinclude candidates
|
||||
for (ca.uhn.fhir.model.dstu2.resource.Conformance.RestResourceSearchParam next : nextRes.getSearchParam()) {
|
||||
if (next.getTypeElement().getValueAsEnum() == ca.uhn.fhir.model.dstu2.valueset.SearchParamTypeEnum.REFERENCE) {
|
||||
for (BoundCodeDt<ResourceTypeEnum> nextTargetType : next.getTarget()) {
|
||||
if (nextTargetType.getValue().equals(resourceName)) {
|
||||
theRevIncludes.add(nextRes.getTypeElement().getValue() + ":" + next.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,6 +106,8 @@
|
|||
if (this.id) {
|
||||
if (this.id.substring(0,4) == 'inc_') {
|
||||
this.name = '_include';
|
||||
} else if (this.id.substring(0,7) == 'revinc_') {
|
||||
this.name = '_revinclude';
|
||||
} else if (this.id.indexOf('autogen') == -1) {
|
||||
this.name = this.id;
|
||||
}
|
||||
|
@ -127,11 +129,10 @@
|
|||
<!-- Placeholder: gets populated by script below -->
|
||||
</div>
|
||||
|
||||
<div class="row-fluid">
|
||||
<h4>Includes <small>Also load and include referenced resources in results</small></h4>
|
||||
</div>
|
||||
|
||||
<!-- Includes -->
|
||||
<div class="row-fluid">
|
||||
<h4>Includes <small>Also include resources which are referenced by the search results</small></h4>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<span th:each="include : ${includes}" class="includeCheckContainer">
|
||||
<span class="includeCheckCheck">
|
||||
|
@ -141,6 +142,23 @@
|
|||
</span>
|
||||
</div>
|
||||
|
||||
<!-- Includes -->
|
||||
<div class="row-fluid">
|
||||
<h4>Reverse Includes <small>Also include resources which reference to the search results</small></h4>
|
||||
</div>
|
||||
<div class="row-fluid">
|
||||
<span class="includeCheckCheck">
|
||||
<input type="checkbox" th:value="'*'" th:id="'revinc_STAR'" />
|
||||
</span>
|
||||
<span class="includeCheckName" th:text="'*'"/>
|
||||
<span th:each="include : ${revincludes}" class="includeCheckContainer">
|
||||
<span class="includeCheckCheck">
|
||||
<input type="checkbox" th:value="${include}" th:id="'revinc_' + ${include}" />
|
||||
</span>
|
||||
<span class="includeCheckName" th:text="${include}"/>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- Results Sorting -->
|
||||
<div class="row-fluid">
|
||||
<h4>Sort Results</h4>
|
||||
|
|
|
@ -61,7 +61,10 @@ public class OverlayTestApp {
|
|||
|
||||
}
|
||||
|
||||
ourAppCtx = new ClassPathXmlApplicationContext("hapi-fhir-server-resourceproviders-dstu2.xml", "hapi-fhir-server-resourceproviders-dstu1.xml", "fhir-jpabase-spring-test-config.xml");
|
||||
ourAppCtx = new ClassPathXmlApplicationContext(
|
||||
"hapi-fhir-server-resourceproviders-dstu2.xml",
|
||||
"hapi-fhir-server-resourceproviders-dstu1.xml",
|
||||
"fhir-jpabase-spring-test-config.xml");
|
||||
ServletContextHandler proxyHandler = new ServletContextHandler();
|
||||
proxyHandler.setContextPath("/");
|
||||
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
|
||||
version="2.0">
|
||||
|
||||
<persistence-unit name="FHIR_UT" transaction-type="RESOURCE_LOCAL">
|
||||
<provider>org.hibernate.ejb.HibernatePersistence</provider>
|
||||
<!-- <class>ca.uhn.fhir.jpa.entity.PatientResourceTable</class> -->
|
||||
|
||||
<class>ca.uhn.fhir.jpa.entity.ForcedId</class>
|
||||
<class>ca.uhn.fhir.jpa.entity.ResourceTable</class>
|
||||
<class>ca.uhn.fhir.jpa.entity.ResourceHistoryTable</class>
|
||||
<class>ca.uhn.fhir.jpa.entity.ResourceHistoryTag</class>
|
||||
<class>ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamDate</class>
|
||||
<class>ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamNumber</class>
|
||||
<class>ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamQuantity</class>
|
||||
<class>ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamString</class>
|
||||
<class>ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamToken</class>
|
||||
<class>ca.uhn.fhir.jpa.entity.ResourceLink</class>
|
||||
<class>ca.uhn.fhir.jpa.entity.ResourceTag</class>
|
||||
<class>ca.uhn.fhir.jpa.entity.TagDefinition</class>
|
||||
|
||||
<exclude-unlisted-classes>false</exclude-unlisted-classes>
|
||||
<properties>
|
||||
<property name="hibernate.connection.url" value="jdbc:hsqldb:mem:unit-testing-jpa" />
|
||||
<property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver" />
|
||||
<property name="hibernate.dialect" value="org.hibernate.dialect.DerbyTenSevenDialect" />
|
||||
<property name="hibernate.hbm2ddl.auto" value="update" />
|
||||
<property name="hibernate.connection.username" value="sa" />
|
||||
<property name="hibernate.connection.password" value="" />
|
||||
<property name="hibernate.jdbc.batch_size" value="0" />
|
||||
<property name="hibernate.cache.use_minimal_puts" value="false" />
|
||||
<property name="hibernate.cache.use_query_cache" value="false" />
|
||||
<property name="hibernate.cache.use_second_level_cache" value="false" />
|
||||
<property name="hibernate.cache.use_structured_entries" value="false" />
|
||||
<!--
|
||||
<property name="hibernate.ejb.naming_strategy" value="ca.uhn.fhir.jpa.util.CustomNamingStrategy" />
|
||||
-->
|
||||
<!--
|
||||
<property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory" />
|
||||
-->
|
||||
</properties>
|
||||
</persistence-unit>
|
||||
|
||||
</persistence>
|
|
@ -0,0 +1,50 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:task="http://www.springframework.org/schema/task" xmlns:util="http://www.springframework.org/schema/util"
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
|
||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
|
||||
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd
|
||||
"
|
||||
default-autowire="no" default-lazy-init="false">
|
||||
|
||||
<context:annotation-config />
|
||||
<context:mbean-server />
|
||||
|
||||
<bean id="myDaoConfig" class="ca.uhn.fhir.jpa.dao.DaoConfig">
|
||||
</bean>
|
||||
|
||||
<bean id="myPersistenceDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" lazy-init="true">
|
||||
<property name="url" value="jdbc:derby:memory:myUnitTestDB;create=true" />
|
||||
</bean>
|
||||
|
||||
<bean id="myPersistenceDataSource2" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" lazy-init="true">
|
||||
<!-- <property name="url" value="jdbc:hsqldb:mem:unit-testing-jpa"/> -->
|
||||
<!-- <property name="url" value="jdbc:hsqldb:file:svcret.hsqldb" /> -->
|
||||
<property name="url" value="jdbc:derby:memory:myUnitTestDB;create=true" />
|
||||
<!--
|
||||
<property name="username" value="sa" />
|
||||
<property name="password" value="" />
|
||||
-->
|
||||
</bean>
|
||||
|
||||
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
|
||||
<property name="dataSource" ref="myPersistenceDataSource" />
|
||||
<property name="persistenceUnitName" value="FHIR_UT" />
|
||||
<property name="jpaVendorAdapter">
|
||||
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
|
||||
<property name="showSql" value="false" />
|
||||
<property name="generateDdl" value="true" />
|
||||
<!-- <property name="databasePlatform" value="org.hibernate.dialect.HSQLDialect" /> -->
|
||||
<property name="databasePlatform" value="org.hibernate.dialect.DerbyTenSevenDialect" />
|
||||
</bean>
|
||||
</property>
|
||||
</bean>
|
||||
<bean id="myTxManager" class="org.springframework.orm.jpa.JpaTransactionManager">
|
||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||
</bean>
|
||||
<tx:annotation-driven transaction-manager="myTxManager" />
|
||||
|
||||
</beans>
|
|
@ -52,6 +52,9 @@
|
|||
parameters with JSON encoding (e.g. the $everything operation on UHN's test server).
|
||||
Thanks to Avinash Shanbhag for reporting!
|
||||
</action>
|
||||
<action type="add">
|
||||
Web tester UI now supports _revinclude
|
||||
</action>
|
||||
</release>
|
||||
<release version="1.0" date="2015-May-8">
|
||||
<action type="add">
|
||||
|
|
Loading…
Reference in New Issue