Add support for quantity search params in tester UI
This commit is contained in:
parent
47c98ffe4e
commit
7905e9d918
|
@ -7,9 +7,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
|
|||
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
|
@ -97,4 +97,4 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
|||
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
||||
org.eclipse.jdt.core.compiler.source=1.7
|
||||
|
|
|
@ -64,6 +64,9 @@ import ca.uhn.fhir.rest.client.IGenericClient;
|
|||
import ca.uhn.fhir.rest.gclient.ICreateTyped;
|
||||
import ca.uhn.fhir.rest.gclient.IQuery;
|
||||
import ca.uhn.fhir.rest.gclient.IUntypedQuery;
|
||||
import ca.uhn.fhir.rest.gclient.NumberClientParam.IMatches;
|
||||
import ca.uhn.fhir.rest.gclient.QuantityClientParam;
|
||||
import ca.uhn.fhir.rest.gclient.QuantityClientParam.IAndUnits;
|
||||
import ca.uhn.fhir.rest.gclient.StringClientParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenClientParam;
|
||||
import ca.uhn.fhir.rest.server.Constants;
|
||||
|
@ -961,12 +964,17 @@ public class Controller {
|
|||
List<String> values;
|
||||
boolean addToWhere = true;
|
||||
if ("token".equals(nextType)) {
|
||||
if (isBlank(parts.get(2))) {
|
||||
if (isBlank(parts.get(1))) {
|
||||
return true;
|
||||
}
|
||||
values = Collections.singletonList(StringUtils.join(parts, ""));
|
||||
addToWhere = false;
|
||||
theQuery.where(new TokenClientParam(nextName + nextQualifier).exactly().systemAndCode(parts.get(0), parts.get(2)));
|
||||
if (isBlank(parts.get(0))) {
|
||||
values = Collections.singletonList(parts.get(1));
|
||||
theQuery.where(new TokenClientParam(nextName + nextQualifier).exactly().code(parts.get(1)));
|
||||
} else {
|
||||
values = Collections.singletonList(parts.get(0) + "|" + parts.get(1));
|
||||
theQuery.where(new TokenClientParam(nextName + nextQualifier).exactly().systemAndCode(parts.get(0), parts.get(1)));
|
||||
}
|
||||
} else if ("date".equals(nextType)) {
|
||||
values = new ArrayList<String>();
|
||||
if (isNotBlank(parts.get(1))) {
|
||||
|
@ -975,6 +983,42 @@ public class Controller {
|
|||
if (isNotBlank(parts.get(3))) {
|
||||
values.add(StringUtils.join(parts.get(2), parts.get(3)));
|
||||
}
|
||||
if (values.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
} else if ("quantity".equals(nextType)) {
|
||||
values = new ArrayList<String>();
|
||||
addToWhere = false;
|
||||
|
||||
QuantityClientParam param = new QuantityClientParam(nextName);
|
||||
IMatches<IAndUnits> matcher;
|
||||
if ("~".equals(parts.get(0))) {
|
||||
matcher = param.approximately();
|
||||
} else if ("=".equals(parts.get(0))) {
|
||||
matcher = param.exactly();
|
||||
} else if (">=".equals(parts.get(0))) {
|
||||
matcher = param.greaterThanOrEquals();
|
||||
} else if ("<=".equals(parts.get(0))) {
|
||||
matcher = param.lessThanOrEquals();
|
||||
} else if (">".equals(parts.get(0))) {
|
||||
matcher = param.greaterThan();
|
||||
} else if ("<".equals(parts.get(0))) {
|
||||
matcher = param.lessThan();
|
||||
} else {
|
||||
throw new Error("Unknown qualifier: " + parts.get(0));
|
||||
}
|
||||
IAndUnits number = matcher.number(parts.get(1));
|
||||
|
||||
if (isBlank(parts.get(3))) {
|
||||
theQuery.where(number.andNoUnits());
|
||||
} else if (isBlank(parts.get(2))) {
|
||||
theQuery.where(number.andUnits(parts.get(3)));
|
||||
} else {
|
||||
theQuery.where(number.andUnits(parts.get(2), parts.get(3)));
|
||||
}
|
||||
|
||||
values.add(parts.get(0) + parts.get(1) + "|" + parts.get(2) + "|" + parts.get(3));
|
||||
|
||||
if (values.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<property name="servers">
|
||||
<list>
|
||||
<value>home , DSTU1 , Localhost Server DSTU1 , http://localhost:8887/fhir/contextDstu1</value>
|
||||
<value>home_dev , DEV , Localhost Server DEV , http://localhost:8887/fhir/contextDev</value>
|
||||
<value>home_d2 , DSTU2 , Localhost Server DSTU2 , http://localhost:8887/fhir/contextDstu2</value>
|
||||
<value>hi , DSTU1 , Health Intersections , http://fhir.healthintersections.com.au/open</value>
|
||||
<value>furore , DSTU1 , Spark - Furore Reference Server , http://spark.furore.com/fhir</value>
|
||||
<value>blaze , DSTU1 , Blaze (Orion Health) , https://fhir.orionhealth.com/blaze/fhir</value>
|
||||
|
|
|
@ -113,6 +113,7 @@
|
|||
});
|
||||
$("#outerForm").attr("action", "search").submit();
|
||||
});
|
||||
$('#search-btn').button('reset');
|
||||
</script>
|
||||
<br clear="all"/>
|
||||
|
||||
|
|
|
@ -75,8 +75,7 @@ function addSearchControls(theConformance, theSearchParamType, theSearchParamNam
|
|||
$('<input />', { id: 'param.' + theRowNum + '.0', placeholder: 'system/namespace', type: 'text', 'class': 'form-control' })
|
||||
),
|
||||
$('<div />', { 'class': 'col-sm-3' }).append(
|
||||
$('<input />', { id: 'param.' + theRowNum + '.1', type: 'hidden', value: '|' }),
|
||||
$('<input />', { id: 'param.' + theRowNum + '.2', placeholder: 'value', type: 'text', 'class': 'form-control' })
|
||||
$('<input />', { id: 'param.' + theRowNum + '.1', placeholder: 'value', type: 'text', 'class': 'form-control' })
|
||||
)
|
||||
);
|
||||
} else if (theSearchParamType == 'string') {
|
||||
|
@ -132,6 +131,8 @@ function addSearchControls(theConformance, theSearchParamType, theSearchParamNam
|
|||
} else if (theSearchParamType == 'date') {
|
||||
addSearchControlDate(theSearchParamName, theContainerRowNum, theRowNum, true);
|
||||
addSearchControlDate(theSearchParamName, theContainerRowNum, theRowNum, false);
|
||||
} else if (theSearchParamType == 'quantity') {
|
||||
addSearchControlQuantity(theSearchParamName, theContainerRowNum, theRowNum);
|
||||
} else if (theSearchParamType == 'reference' && (!theSearchParamChain || theSearchParamChain.length == 0)) {
|
||||
/*
|
||||
* This is a reference parameter with no chain options, so just display a simple
|
||||
|
@ -174,10 +175,6 @@ function addSearchControls(theConformance, theSearchParamType, theSearchParamNam
|
|||
newContainer
|
||||
);
|
||||
|
||||
// select.append(
|
||||
// $('<option />', { value: '' }).text('Resource ID')
|
||||
// );
|
||||
|
||||
var params = new Array();
|
||||
{
|
||||
var param = new Object();
|
||||
|
@ -291,6 +288,61 @@ function addSearchControlDate(theSearchParamName, theContainerRowNum, theRowNum,
|
|||
);
|
||||
}
|
||||
|
||||
function addSearchControlQuantity(theSearchParamName, theContainerRowNum, theRowNum) {
|
||||
var input = $('<div />', { 'class':'input-group'});
|
||||
var qualifier = $('<input />', {type:'hidden', id:'param.' + theRowNum + '.0'});
|
||||
var qualifierDiv = $('<div />', {'class':'input-group-btn'});
|
||||
|
||||
input.append(
|
||||
qualifierDiv,
|
||||
$('<input />', { type:'text', 'class':'form-control', id: 'param.' + theRowNum + '.1', placeholder: "value" }),
|
||||
$('<div />', { 'class':'input-group-addon', 'style':'padding:6px;'} ).append(
|
||||
$('<span>System</span>')
|
||||
),
|
||||
$('<input />', { type:'text', 'class':'form-control', id: 'param.' + theRowNum + '.2', placeholder: "(opt)" }),
|
||||
$('<div />', { 'class':'input-group-addon', 'style':'padding:6px;'} ).append(
|
||||
$('<span>Code</span>')
|
||||
),
|
||||
$('<input />', { type:'text', 'class':'form-control', id: 'param.' + theRowNum + '.3', placeholder: "(opt)" })
|
||||
);
|
||||
|
||||
var qualifierTooltip = "Set a qualifier and a date to specify a boundary date. Set two qualifiers and dates to specify a range.";
|
||||
var qualifierBtn = $('<button />', {type:'button', 'class':'btn btn-default dropdown-toggle', 'data-toggle':'dropdown', 'data-placement':'top', 'title':qualifierTooltip}).text('=');
|
||||
qualifierBtn.tooltip({
|
||||
'selector': '',
|
||||
'placement': 'top',
|
||||
'container':'body'
|
||||
});
|
||||
var qualifierBtnEq = $('<a>=</a>').click(function() { updateSearchDateQualifier(qualifierBtn, qualifier, '='); });
|
||||
var qualifierBtnAp = $('<a>~ (Approx)</a>').click(function() { updateSearchDateQualifier(qualifierBtn, qualifier, '~'); });
|
||||
var qualifierBtnGt = $('<a>></a>').click(function() { updateSearchDateQualifier(qualifierBtn, qualifier, '>'); });
|
||||
var qualifierBtnGe = $('<a>>=</a>').click(function() { updateSearchDateQualifier(qualifierBtn, qualifier, '>='); });
|
||||
var qualifierBtnLt = $('<a><</a>').click(function() { updateSearchDateQualifier(qualifierBtn, qualifier, '<'); });
|
||||
var qualifierBtnLe = $('<a><=</a>').click(function() { updateSearchDateQualifier(qualifierBtn, qualifier, '<='); });
|
||||
qualifierDiv.append(
|
||||
qualifierBtn,
|
||||
$('<ul class="dropdown-menu" role="menu">').append(
|
||||
$('<li />').append(qualifierBtnEq),
|
||||
$('<li />').append(qualifierBtnAp),
|
||||
$('<li />').append(qualifierBtnGt),
|
||||
$('<li />').append(qualifierBtnGe),
|
||||
$('<li />').append(qualifierBtnLt),
|
||||
$('<li />').append(qualifierBtnLe)
|
||||
)
|
||||
);
|
||||
|
||||
$('#search-param-rowopts-' + theContainerRowNum).append(
|
||||
qualifier,
|
||||
$('<div />', { 'class': 'col-sm-5' }).append(
|
||||
input
|
||||
)
|
||||
// $('<div />', { 'class': 'col-sm-2' }).append(
|
||||
// $('<div />', { 'class':'input-group'}).append(
|
||||
// )
|
||||
// )
|
||||
);
|
||||
}
|
||||
|
||||
function handleSearchParamTypeChange(select, params, theContainerRowNum, theParamRowNum) {
|
||||
var oldVal = select.prevVal;
|
||||
var newVal = select.val();
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
|
|||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.jpa.provider.JpaSystemProviderDstu1;
|
||||
import ca.uhn.fhir.jpa.provider.JpaSystemProviderDstu2;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
|
||||
|
@ -63,22 +64,22 @@ public class OverlayTestApp {
|
|||
proxyHandler.setContextPath("/");
|
||||
|
||||
/*
|
||||
* DEV resources
|
||||
* DSTU2 resources
|
||||
*/
|
||||
|
||||
RestfulServer restServerDev = new RestfulServer();
|
||||
restServerDev.setPagingProvider(new FifoMemoryPagingProvider(10));
|
||||
restServerDev.setImplementationDescription("This is a great server!!!!");
|
||||
restServerDev.setFhirContext(ourAppCtx.getBean("myFhirContextDev", FhirContext.class));
|
||||
List<IResourceProvider> rpsDev = (List<IResourceProvider>) ourAppCtx.getBean("myResourceProvidersDev", List.class);
|
||||
restServerDev.setFhirContext(ourAppCtx.getBean("myFhirContextDstu2", FhirContext.class));
|
||||
List<IResourceProvider> rpsDev = (List<IResourceProvider>) ourAppCtx.getBean("myResourceProvidersDstu2", List.class);
|
||||
restServerDev.setResourceProviders(rpsDev);
|
||||
|
||||
JpaSystemProviderDstu1 systemProvDev = (JpaSystemProviderDstu1) ourAppCtx.getBean("mySystemProviderDev", JpaSystemProviderDstu1.class);
|
||||
JpaSystemProviderDstu2 systemProvDev = (JpaSystemProviderDstu2) ourAppCtx.getBean("mySystemProviderDstu2", JpaSystemProviderDstu2.class);
|
||||
restServerDev.setPlainProviders(systemProvDev);
|
||||
|
||||
ServletHolder servletHolder = new ServletHolder();
|
||||
servletHolder.setServlet(restServerDev);
|
||||
proxyHandler.addServlet(servletHolder, "/fhir/contextDev/*");
|
||||
proxyHandler.addServlet(servletHolder, "/fhir/contextDstu2/*");
|
||||
|
||||
/*
|
||||
* DSTU resources
|
||||
|
|
|
@ -127,6 +127,9 @@
|
|||
users to configure a default encoding (XML/JSON) to use if none is specified in the
|
||||
client request. Currently defaults to XML.
|
||||
</action>
|
||||
<action type="add">
|
||||
Add support for quantity search params in FHIR tester UI
|
||||
</action>
|
||||
</release>
|
||||
<release version="0.8" date="2014-Dec-17">
|
||||
<action type="add">
|
||||
|
@ -156,10 +159,10 @@
|
|||
<![CDATA[
|
||||
<b>API Change</b>: The IResource#getResourceMetadata() method has been changed
|
||||
from returning
|
||||
<code>Map<ResourceMetadataKeyEnum<?>, Object><code>
|
||||
<code>Map<ResourceMetadataKeyEnum<?>, Object></code>
|
||||
to returning a new type called
|
||||
<code>ResourceMetadataMap</code>. This new type implements
|
||||
<code>Map<ResourceMetadataKeyEnum<?>, Object><code>
|
||||
<code>Map<ResourceMetadataKeyEnum<?>, Object></code>
|
||||
itself, so this change should not break existing code, but may
|
||||
require a clean build in order to run correctly.
|
||||
]]>
|
||||
|
|
Loading…
Reference in New Issue