Merge branch 'master' into 2478_add_extension_mdm_matcher

This commit is contained in:
Nick Goupinets 2021-03-25 12:22:23 -04:00
commit 05c3ca2512
5 changed files with 70 additions and 2 deletions

View File

@ -0,0 +1,5 @@
---
type: fix
issue: 2505
title: "An incorrect path caused the select2 library to fail to load in the HAPI FHIR testpage overlay
modue. Thanks to Ari Ruotsalainen for reporting!"

View File

@ -277,6 +277,8 @@ public class FhirResourceDaoR4SearchCustomSearchParamTest extends BaseJpaR4Test
}
}
@Test
@Disabled
public void testCreateInvalidParamInvalidResourceName() {

View File

@ -14,6 +14,7 @@ import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.gclient.ReferenceClientParam;
import ca.uhn.fhir.rest.gclient.StringClientParam;
import ca.uhn.fhir.rest.gclient.TokenClientParam;
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
import ca.uhn.fhir.util.BundleUtil;
@ -31,6 +32,7 @@ import org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResource
import org.hl7.fhir.r4.model.CodeType;
import org.hl7.fhir.r4.model.Enumerations;
import org.hl7.fhir.r4.model.Enumerations.AdministrativeGender;
import org.hl7.fhir.r4.model.ExplanationOfBenefit;
import org.hl7.fhir.r4.model.Observation;
import org.hl7.fhir.r4.model.Observation.ObservationStatus;
import org.hl7.fhir.r4.model.Patient;
@ -54,6 +56,8 @@ import java.util.stream.Collectors;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
@ -416,6 +420,59 @@ public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProvide
}
@SuppressWarnings("unused")
@Test
public void testSearchWithCustomParamInvalidDateFormat() {
SearchParameter dateParameter = new SearchParameter();
dateParameter.setId("explanationofbenefit-service-date");
dateParameter.setName("ExplanationOfBenefit_ServiceDate");
dateParameter.setCode("service-date");
dateParameter.setDescription("test");
dateParameter.setUrl("http://integer");
dateParameter.setStatus(Enumerations.PublicationStatus.ACTIVE);
dateParameter.addBase("ExplanationOfBenefit");
dateParameter.setType(Enumerations.SearchParamType.DATE);
dateParameter.setExpression("ExplanationOfBenefit.billablePeriod | ExplanationOfBenefit.item.serviced as Date | ExplanationOfBenefit.item.serviced as Period");
dateParameter.setXpath("f:ExplanationOfBenefit/f:billablePeriod | f:ExplanationOfBenefit/f:item/f:serviced/f:servicedDate | f:ExplanationOfBenefit/f:item/f:serviced/f:servicedPeriod");
dateParameter.setXpathUsage(SearchParameter.XPathUsageType.NORMAL);
mySearchParameterDao.update(dateParameter);
mySearchParamRegistry.forceRefresh();
IBundleProvider results;
List<String> foundResources;
Bundle result;
//Try with builtin SP
try {
myClient
.search()
.forResource(ExplanationOfBenefit.class)
.where(new StringClientParam("created").matches().value("01-01-2020"))
.returnBundle(Bundle.class)
.execute();
} catch (Exception e) {
assertThat(e.getMessage(), is(equalTo("HTTP 400 Bad Request: Invalid date/time format: \"01-01-2020\"")));
}
//Now with custom SP
try {
myClient
.search()
.forResource(ExplanationOfBenefit.class)
.where(new StringClientParam("service-date").matches().value("01-01-2020"))
.returnBundle(Bundle.class)
.execute();
} catch (Exception e) {
assertThat(e.getMessage(), is(equalTo("HTTP 400 Bad Request: Invalid date/time format: \"01-01-2020\"")));
}
}
/**
* See #1300
*/

View File

@ -26,6 +26,7 @@ import ca.uhn.fhir.interceptor.api.HookParams;
import ca.uhn.fhir.interceptor.api.Pointcut;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.Include;
import ca.uhn.fhir.parser.DataFormatException;
import ca.uhn.fhir.rest.annotation.*;
import ca.uhn.fhir.rest.api.MethodOutcome;
import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
@ -251,6 +252,9 @@ public abstract class BaseMethodBinding<T> {
if (e.getCause() instanceof BaseServerResponseException) {
throw (BaseServerResponseException) e.getCause();
}
if (e.getTargetException() instanceof DataFormatException) {
throw (DataFormatException)e.getTargetException();
}
throw new InternalErrorException("Failed to call access method: " + e.getCause(), e);
} catch (Exception e) {
throw new InternalErrorException("Failed to call access method: " + e.getCause(), e);

View File

@ -31,8 +31,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>