Merge branch 'master' of github.com:jamesagnew/hapi-fhir
This commit is contained in:
commit
0a4dcc32ec
|
@ -334,6 +334,16 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
nextId = nextValue.getReferenceElement();
|
nextId = nextValue.getReferenceElement();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This can only really happen if the DAO is being called
|
||||||
|
* programatically with a Bundle (not through the FHIR REST API)
|
||||||
|
* but Smile does this
|
||||||
|
*/
|
||||||
|
if (nextId.isEmpty() && nextValue.getResource() != null) {
|
||||||
|
nextId = nextValue.getResource().getIdElement();
|
||||||
|
}
|
||||||
|
|
||||||
if (nextId.isEmpty() || nextId.getValue().startsWith("#")) {
|
if (nextId.isEmpty() || nextId.getValue().startsWith("#")) {
|
||||||
// This is a blank or contained resource reference
|
// This is a blank or contained resource reference
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -273,8 +273,10 @@ public abstract class BaseHapiFhirResourceDao<T extends IBaseResource> extends B
|
||||||
|
|
||||||
// Notify interceptors
|
// Notify interceptors
|
||||||
IdDt idToDelete = entity.getIdDt();
|
IdDt idToDelete = entity.getIdDt();
|
||||||
|
if (theRequestDetails != null) {
|
||||||
ActionRequestDetails requestDetails = new ActionRequestDetails(theRequestDetails, idToDelete.getResourceType(), idToDelete);
|
ActionRequestDetails requestDetails = new ActionRequestDetails(theRequestDetails, idToDelete.getResourceType(), idToDelete);
|
||||||
notifyInterceptors(RestOperationTypeEnum.DELETE, requestDetails);
|
notifyInterceptors(RestOperationTypeEnum.DELETE, requestDetails);
|
||||||
|
}
|
||||||
|
|
||||||
// Perform delete
|
// Perform delete
|
||||||
Date updateTime = new Date();
|
Date updateTime = new Date();
|
||||||
|
@ -282,12 +284,15 @@ public abstract class BaseHapiFhirResourceDao<T extends IBaseResource> extends B
|
||||||
|
|
||||||
// Notify JPA interceptors
|
// Notify JPA interceptors
|
||||||
T resourceToDelete = toResource(myResourceType, entity, false);
|
T resourceToDelete = toResource(myResourceType, entity, false);
|
||||||
|
if (theRequestDetails != null) {
|
||||||
theRequestDetails.getRequestOperationCallback().resourceDeleted(resourceToDelete);
|
theRequestDetails.getRequestOperationCallback().resourceDeleted(resourceToDelete);
|
||||||
|
ActionRequestDetails requestDetails = new ActionRequestDetails(theRequestDetails, idToDelete.getResourceType(), idToDelete);
|
||||||
for (IServerInterceptor next : getConfig().getInterceptors()) {
|
for (IServerInterceptor next : getConfig().getInterceptors()) {
|
||||||
if (next instanceof IJpaServerInterceptor) {
|
if (next instanceof IJpaServerInterceptor) {
|
||||||
((IJpaServerInterceptor) next).resourceDeleted(requestDetails, entity);
|
((IJpaServerInterceptor) next).resourceDeleted(requestDetails, entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
for (IServerInterceptor next : getConfig().getInterceptors()) {
|
for (IServerInterceptor next : getConfig().getInterceptors()) {
|
||||||
if (next instanceof IServerOperationInterceptor) {
|
if (next instanceof IServerOperationInterceptor) {
|
||||||
((IServerOperationInterceptor) next).resourceDeleted(theRequestDetails, resourceToDelete);
|
((IServerOperationInterceptor) next).resourceDeleted(theRequestDetails, resourceToDelete);
|
||||||
|
|
|
@ -542,6 +542,60 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTransactionWithReferenceUuid() {
|
||||||
|
Bundle request = new Bundle();
|
||||||
|
|
||||||
|
Patient p = new Patient();
|
||||||
|
p.setActive(true);
|
||||||
|
p.setId(IdType.newRandomUuid());
|
||||||
|
request.addEntry().setResource(p).getRequest().setMethod(HTTPVerb.POST).setUrl(p.getId());
|
||||||
|
|
||||||
|
Observation o = new Observation();
|
||||||
|
o.getCode().setText("Some Observation");
|
||||||
|
o.getSubject().setReference(p.getId());
|
||||||
|
request.addEntry().setResource(o).getRequest().setMethod(HTTPVerb.POST);
|
||||||
|
|
||||||
|
Bundle resp = mySystemDao.transaction(mySrd, request);
|
||||||
|
ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(resp));
|
||||||
|
|
||||||
|
String patientId = new IdType(resp.getEntry().get(0).getResponse().getLocation()).toUnqualifiedVersionless().getValue();
|
||||||
|
assertThat(patientId, startsWith("Patient/"));
|
||||||
|
|
||||||
|
SearchParameterMap params = new SearchParameterMap();
|
||||||
|
params.setLoadSynchronous(true);
|
||||||
|
params.add("subject", new ReferenceParam(patientId));
|
||||||
|
IBundleProvider found = myObservationDao.search(params);
|
||||||
|
assertEquals(1, found.size().intValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTransactionWithReferenceResource() {
|
||||||
|
Bundle request = new Bundle();
|
||||||
|
|
||||||
|
Patient p = new Patient();
|
||||||
|
p.setActive(true);
|
||||||
|
p.setId(IdType.newRandomUuid());
|
||||||
|
request.addEntry().setResource(p).getRequest().setMethod(HTTPVerb.POST).setUrl(p.getId());
|
||||||
|
|
||||||
|
Observation o = new Observation();
|
||||||
|
o.getCode().setText("Some Observation");
|
||||||
|
o.getSubject().setResource(p);
|
||||||
|
request.addEntry().setResource(o).getRequest().setMethod(HTTPVerb.POST);
|
||||||
|
|
||||||
|
Bundle resp = mySystemDao.transaction(mySrd, request);
|
||||||
|
ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(resp));
|
||||||
|
|
||||||
|
String patientId = new IdType(resp.getEntry().get(0).getResponse().getLocation()).toUnqualifiedVersionless().getValue();
|
||||||
|
assertThat(patientId, startsWith("Patient/"));
|
||||||
|
|
||||||
|
SearchParameterMap params = new SearchParameterMap();
|
||||||
|
params.setLoadSynchronous(true);
|
||||||
|
params.add("subject", new ReferenceParam(patientId));
|
||||||
|
IBundleProvider found = myObservationDao.search(params);
|
||||||
|
assertEquals(1, found.size().intValue());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTransactionCreateInlineMatchUrlWithOneMatch() {
|
public void testTransactionCreateInlineMatchUrlWithOneMatch() {
|
||||||
String methodName = "testTransactionCreateInlineMatchUrlWithOneMatch";
|
String methodName = "testTransactionCreateInlineMatchUrlWithOneMatch";
|
||||||
|
|
|
@ -52,6 +52,11 @@
|
||||||
Prevent duplicates in $everything query response in JPA server. Thanks to @vlad-ignatov
|
Prevent duplicates in $everything query response in JPA server. Thanks to @vlad-ignatov
|
||||||
for reporting!
|
for reporting!
|
||||||
</action>
|
</action>
|
||||||
|
<action type="fix">
|
||||||
|
Fix issue in calling JPA server transactions programmatically where resources
|
||||||
|
are linked by object reference and not by ID where indexes were not correctly
|
||||||
|
generated. This should not affect most users.
|
||||||
|
</action>
|
||||||
<action type="fix" issue="678">
|
<action type="fix" issue="678">
|
||||||
FIx issue in SubscriptionInterceptor that caused interceptor to only
|
FIx issue in SubscriptionInterceptor that caused interceptor to only
|
||||||
actually notify listeners of the first 10 subscriptions. Thanks to Jeff Chung
|
actually notify listeners of the first 10 subscriptions. Thanks to Jeff Chung
|
||||||
|
|
Loading…
Reference in New Issue