Skip to content

Commit becbf1d

Browse files
committed
Merge branch 'rel_8_0' into rel_8_0_mb
2 parents 7e8ac90 + a708949 commit becbf1d

File tree

29 files changed

+2886
-133
lines changed

29 files changed

+2886
-133
lines changed

hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/IValidationSupport.java

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,7 @@ public String getPropertyName() {
774774
// Some of the types in the spec are not yet implemented as well.
775775
// @see https://github.com/hapifhir/hapi-fhir/issues/5700
776776
String TYPE_STRING = "string";
777+
String TYPE_BOOLEAN = "boolean";
777778
String TYPE_CODING = "Coding";
778779
String TYPE_GROUP = "group";
779780

@@ -800,6 +801,29 @@ public String getType() {
800801
}
801802
}
802803

804+
class BooleanConceptProperty extends BaseConceptProperty {
805+
private final boolean myValue;
806+
807+
/**
808+
* Constructor
809+
*
810+
* @param theName The name
811+
*/
812+
public BooleanConceptProperty(String theName, boolean theValue) {
813+
super(theName);
814+
myValue = theValue;
815+
}
816+
817+
public boolean getValue() {
818+
return myValue;
819+
}
820+
821+
@Override
822+
public String getType() {
823+
return TYPE_BOOLEAN;
824+
}
825+
}
826+
803827
class CodingConceptProperty extends BaseConceptProperty {
804828
private final String myCode;
805829
private final String myCodeSystem;
@@ -1073,7 +1097,7 @@ class ValueSetExpansionOutcome {
10731097
private final IBaseResource myValueSet;
10741098
private final String myError;
10751099

1076-
private boolean myErrorIsFromServer;
1100+
private final boolean myErrorIsFromServer;
10771101

10781102
public ValueSetExpansionOutcome(String theError, boolean theErrorIsFromServer) {
10791103
myValueSet = null;
@@ -1199,7 +1223,7 @@ public LookupCodeResult setFound(boolean theFound) {
11991223
}
12001224

12011225
public void throwNotFoundIfAppropriate() {
1202-
if (isFound() == false) {
1226+
if (!isFound()) {
12031227
throw new ResourceNotFoundException(Msg.code(1738) + "Unable to find code[" + getSearchedForCode()
12041228
+ "] in system[" + getSearchedForSystem() + "]");
12051229
}
@@ -1270,6 +1294,10 @@ private void populateProperty(
12701294
StringConceptProperty stringConceptProperty = (StringConceptProperty) theConceptProperty;
12711295
ParametersUtil.addPartString(theContext, theProperty, "value", stringConceptProperty.getValue());
12721296
break;
1297+
case TYPE_BOOLEAN:
1298+
BooleanConceptProperty booleanConceptProperty = (BooleanConceptProperty) theConceptProperty;
1299+
ParametersUtil.addPartBoolean(theContext, theProperty, "value", booleanConceptProperty.getValue());
1300+
break;
12731301
case TYPE_CODING:
12741302
CodingConceptProperty codingConceptProperty = (CodingConceptProperty) theConceptProperty;
12751303
ParametersUtil.addPartCoding(
@@ -1321,7 +1349,7 @@ class TranslateCodeRequest {
13211349
private final String myTargetValueSetUrl;
13221350
private final IIdType myResourceId;
13231351
private final boolean myReverse;
1324-
private List<IBaseCoding> myCodings;
1352+
private final List<IBaseCoding> myCodings;
13251353

13261354
public TranslateCodeRequest(List<IBaseCoding> theCodings, String theTargetSystemUrl) {
13271355
myCodings = theCodings;

hapi-fhir-base/src/main/resources/ca/uhn/fhir/i18n/hapi-messages.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ ca.uhn.fhir.jpa.dao.BaseTransactionProcessor.fhirPatchShouldNotUseBinaryResource
151151
ca.uhn.fhir.jpa.patch.FhirPatch.invalidInsertIndex=Invalid insert index {0} for path {1} - Only have {2} existing entries
152152
ca.uhn.fhir.jpa.patch.FhirPatch.invalidMoveSourceIndex=Invalid move source index {0} for path {1} - Only have {2} existing entries
153153
ca.uhn.fhir.jpa.patch.FhirPatch.invalidMoveDestinationIndex=Invalid move destination index {0} for path {1} - Only have {2} existing entries
154+
ca.uhn.fhir.jpa.patch.FhirPatch.noMatchingElementForPath=No element matches the specified path: {0}
154155
ca.uhn.fhir.jpa.searchparam.extractor.BaseSearchParamExtractor.externalReferenceNotAllowed=Resource contains external reference to URL "{0}" but this server is not configured to allow external references
155156
ca.uhn.fhir.jpa.searchparam.extractor.BaseSearchParamExtractor.failedToExtractPaths=Failed to extract values from resource using FHIRPath "{0}": {1}
156157
ca.uhn.fhir.jpa.search.SearchCoordinatorSvcImpl.invalidInclude=Invalid {0} parameter value: "{1}". {2}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
type: fix
3+
issue: 6599
4+
jira: SMILE-9237
5+
title: "Previously, attempting to restart the Storage module would result in a `NullPointerException` when partition
6+
selection mode was set to `PATIENT_ID`, mass ingestion was enabled, and at least one Search Parameter was disabled. This
7+
has now been fixed."
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
type: fix
3+
issue: 6615
4+
jira: SMILE-9569
5+
title: "SearchParameter validation was not being skipped on updates, even if requested. This has been fixed"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
type: add
3+
issue: 6644
4+
jira: SMILE-9604
5+
title: "By default, referential integrity is enforced on deletes.
6+
This change introduces support for an exceptional case such
7+
that deletion of a given resource will not be blocked if all
8+
references to that resource are versioned. If there is at
9+
least one unversioned reference to the resource, deletion will
10+
still be blocked.
11+
"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
type: fix
3+
issue: 6656
4+
title: "Previously, FHIR patch 'replace' would fail when trying to replace a sub-element of a high cardinality element
5+
using the the FHIR patch syntax. This has been fixed."
6+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
type: fix
3+
issue: 6662
4+
title: "Fixed remote terminology lookup results showing boolean properties as strings."

hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java

Lines changed: 24 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import ca.uhn.fhir.interceptor.api.HookParams;
3030
import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster;
3131
import ca.uhn.fhir.interceptor.api.Pointcut;
32+
import ca.uhn.fhir.interceptor.executor.InterceptorService;
3233
import ca.uhn.fhir.interceptor.model.RequestPartitionId;
3334
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
3435
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
@@ -47,6 +48,7 @@
4748
import ca.uhn.fhir.jpa.dao.data.IResourceHistoryProvenanceDao;
4849
import ca.uhn.fhir.jpa.dao.tx.HapiTransactionService;
4950
import ca.uhn.fhir.jpa.delete.DeleteConflictUtil;
51+
import ca.uhn.fhir.jpa.interceptor.PatientCompartmentEnforcingInterceptor;
5052
import ca.uhn.fhir.jpa.model.cross.IBasePersistedResource;
5153
import ca.uhn.fhir.jpa.model.dao.JpaPid;
5254
import ca.uhn.fhir.jpa.model.entity.BaseHasResource;
@@ -72,6 +74,7 @@
7274
import ca.uhn.fhir.jpa.searchparam.MatchUrlService;
7375
import ca.uhn.fhir.jpa.searchparam.ResourceSearch;
7476
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
77+
import ca.uhn.fhir.jpa.update.UpdateParameters;
7578
import ca.uhn.fhir.jpa.util.MemoryCacheService;
7679
import ca.uhn.fhir.jpa.util.QueryChunker;
7780
import ca.uhn.fhir.model.api.IQueryParameterType;
@@ -2492,16 +2495,19 @@ && getStorageSettings().getResourceServerIdStrategy()
24922495

24932496
// Start
24942497
if (outcome == null) {
2495-
outcome = doUpdateForUpdateOrPatch(
2496-
theRequest,
2497-
resourceId,
2498-
theMatchUrl,
2499-
thePerformIndexing,
2500-
theForceUpdateVersion,
2501-
theResource,
2502-
entity,
2503-
update,
2504-
theTransactionDetails);
2498+
UpdateParameters updateParameters = new UpdateParameters<>()
2499+
.setRequestDetails(theRequest)
2500+
.setResourceIdToUpdate(resourceId)
2501+
.setMatchUrl(theMatchUrl)
2502+
.setShouldPerformIndexing(thePerformIndexing)
2503+
.setShouldForceUpdateVersion(theForceUpdateVersion)
2504+
.setResource(theResource)
2505+
.setEntity(entity)
2506+
.setOperationType(update)
2507+
.setTransactionDetails(theTransactionDetails)
2508+
.setShouldForcePopulateOldResourceForProcessing(false);
2509+
2510+
outcome = doUpdateForUpdateOrPatch(updateParameters);
25052511
}
25062512

25072513
postUpdateTransaction(theTransactionDetails);
@@ -2523,23 +2529,14 @@ protected void postUpdateTransaction(TransactionDetails theTransactionDetails) {
25232529
}
25242530

25252531
@Override
2526-
protected DaoMethodOutcome doUpdateForUpdateOrPatch(
2527-
RequestDetails theRequest,
2528-
IIdType theResourceId,
2529-
String theMatchUrl,
2530-
boolean thePerformIndexing,
2531-
boolean theForceUpdateVersion,
2532-
T theResource,
2533-
IBasePersistedResource theEntity,
2534-
RestOperationTypeEnum theOperationType,
2535-
TransactionDetails theTransactionDetails) {
2532+
protected DaoMethodOutcome doUpdateForUpdateOrPatch(UpdateParameters<T> theUpdateParameters) {
25362533

25372534
/*
25382535
* We stored a resource searchUrl at creation time to prevent resource duplication.
25392536
* We'll clear any currently existing urls from the db, otherwise we could hit
25402537
* duplicate index violations if we try to add another (after this create/update)
25412538
*/
2542-
ResourceTable entity = (ResourceTable) theEntity;
2539+
ResourceTable entity = (ResourceTable) theUpdateParameters.getEntity();
25432540

25442541
/*
25452542
* If we read back the entity from hibernate, and it's already saying
@@ -2555,7 +2552,7 @@ protected DaoMethodOutcome doUpdateForUpdateOrPatch(
25552552

25562553
if (entity.isSearchUrlPresent()) {
25572554
JpaPid persistentId = entity.getResourceId();
2558-
theTransactionDetails.addUpdatedResourceId(persistentId);
2555+
theUpdateParameters.getTransactionDetails().addUpdatedResourceId(persistentId);
25592556

25602557
entity.setSearchUrlPresent(false); // it will be removed at the end
25612558
}
@@ -2572,16 +2569,11 @@ protected DaoMethodOutcome doUpdateForUpdateOrPatch(
25722569
null);
25732570
}
25742571

2575-
return super.doUpdateForUpdateOrPatch(
2576-
theRequest,
2577-
theResourceId,
2578-
theMatchUrl,
2579-
thePerformIndexing,
2580-
theForceUpdateVersion,
2581-
theResource,
2582-
theEntity,
2583-
theOperationType,
2584-
theTransactionDetails);
2572+
boolean shouldForcePopulateOldResourceForProcessing = myInterceptorBroadcaster instanceof InterceptorService
2573+
&& ((InterceptorService) myInterceptorBroadcaster)
2574+
.hasRegisteredInterceptor(PatientCompartmentEnforcingInterceptor.class);
2575+
theUpdateParameters.setShouldForcePopulateOldResourceForProcessing(shouldForcePopulateOldResourceForProcessing);
2576+
return super.doUpdateForUpdateOrPatch(theUpdateParameters);
25852577
}
25862578

25872579
/**

hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/delete/DeleteConflictFinderService.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@ public class DeleteConflictFinderService {
3535
protected EntityManager myEntityManager;
3636

3737
List<ResourceLink> findConflicts(ResourceTable theEntity, int maxResults) {
38-
TypedQuery<ResourceLink> query = myEntityManager.createQuery(
39-
"SELECT l FROM ResourceLink l WHERE l.myTargetResource.myPid = :target_pid", ResourceLink.class);
38+
String queryStr =
39+
"SELECT l FROM ResourceLink l WHERE l.myTargetResource.myPid = :target_pid AND (l.myTargetResourceVersion IS NULL)";
40+
TypedQuery<ResourceLink> query = myEntityManager.createQuery(queryStr, ResourceLink.class);
4041
query.setParameter("target_pid", theEntity.getId());
4142
query.setMaxResults(maxResults);
43+
4244
return query.getResultList();
4345
}
4446
}

0 commit comments

Comments
 (0)