Skip to content

Commit a9be258

Browse files
committed
Merge rel 8 in
2 parents c096c31 + e720011 commit a9be258

File tree

60 files changed

+1711
-610
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1711
-610
lines changed

hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/model/RequestPartitionId.java

Lines changed: 52 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,36 @@ public String getFirstPartitionNameOrNull() {
220220

221221
/**
222222
* Returns true if this request partition contains only one partition ID and it is the DEFAULT partition ID (null)
223+
*
224+
* @deprecated use {@link #isDefaultPartition(Integer)} or {@link IRequestPartitionHelperSvc.isDefaultPartition}
225+
* instead
226+
* .
223227
*/
228+
@Deprecated(since = "2025.02.R01")
224229
public boolean isDefaultPartition() {
230+
return isDefaultPartition(null);
231+
}
232+
233+
/**
234+
* Test whether this request partition is for a given default partition ID.
235+
*
236+
* This method can be directly invoked on a requestPartition object providing that <code>theDefaultPartitionId</code>
237+
* is known or through {@link IRequestPartitionHelperSvc.isDefaultPartition} where the implementer of the interface
238+
* will provide the default partition id (see {@link IRequestPartitionHelperSvc.getDefaultPartition}).
239+
*
240+
* @param theDefaultPartitionId is the ID that was given to the default partition. The default partition ID can be
241+
* NULL as per default or specifically assigned another value.
242+
* See PartitionSettings#setDefaultPartitionId.
243+
* @return <code>true</code> if the request partition contains only one partition ID and the partition ID is
244+
* <code>theDefaultPartitionId</code>.
245+
*/
246+
public boolean isDefaultPartition(@Nullable Integer theDefaultPartitionId) {
225247
if (isAllPartitions()) {
226248
return false;
227249
}
228250
return hasPartitionIds()
229251
&& getPartitionIds().size() == 1
230-
&& getPartitionIds().get(0) == null;
252+
&& Objects.equals(getPartitionIds().get(0), theDefaultPartitionId);
231253
}
232254

233255
public boolean hasPartitionId(Integer thePartitionId) {
@@ -243,8 +265,34 @@ public boolean hasPartitionNames() {
243265
return myPartitionNames != null;
244266
}
245267

268+
/**
269+
* Verifies that one of the requested partition is the default partition which is assumed to have a default value of
270+
* null.
271+
*
272+
* @return true if one of the requested partition is the default partition(null).
273+
*
274+
* @deprecated use {@link #hasDefaultPartitionId(Integer)} or {@link IRequestPartitionHelperSvc.hasDefaultPartitionId}
275+
* instead
276+
*/
277+
@Deprecated(since = "2025.02.R01")
246278
public boolean hasDefaultPartitionId() {
247-
return getPartitionIds().contains(null);
279+
return hasDefaultPartitionId(null);
280+
}
281+
282+
/**
283+
* Test whether this request partition has the default partition as one of its targeted partitions.
284+
*
285+
* This method can be directly invoked on a requestPartition object providing that <code>theDefaultPartitionId</code>
286+
* is known or through {@link IRequestPartitionHelperSvc.hasDefaultPartitionId} where the implementer of the interface
287+
* will provide the default partition id (see {@link IRequestPartitionHelperSvc.getDefaultPartition}).
288+
*
289+
* @param theDefaultPartitionId is the ID that was given to the default partition. The default partition ID can be
290+
* NULL as per default or specifically assigned another value.
291+
* See PartitionSettings#setDefaultPartitionId.
292+
* @return <code>true</code> if the request partition has the default partition as one of the targeted partition.
293+
*/
294+
public boolean hasDefaultPartitionId(@Nullable Integer theDefaultPartitionId) {
295+
return getPartitionIds().contains(theDefaultPartitionId);
248296
}
249297

250298
public List<Integer> getPartitionIdsWithoutDefault() {
@@ -285,11 +333,13 @@ public static RequestPartitionId allPartitions() {
285333
}
286334

287335
@Nonnull
336+
// TODO GGG: This is a now-bad usage and we should remove it. we cannot assume null means default.
288337
public static RequestPartitionId defaultPartition() {
289338
return fromPartitionIds(Collections.singletonList(null));
290339
}
291340

292341
@Nonnull
342+
// TODO GGG: This is a now-bad usage and we should remove it. we cannot assume null means default.
293343
public static RequestPartitionId defaultPartition(@Nullable LocalDate thePartitionDate) {
294344
return fromPartitionIds(Collections.singletonList(null), thePartitionDate);
295345
}
@@ -360,14 +410,6 @@ public static RequestPartitionId forPartitionIdsAndNames(
360410
return new RequestPartitionId(thePartitionNames, thePartitionIds, thePartitionDate);
361411
}
362412

363-
public static boolean isDefaultPartition(@Nullable RequestPartitionId thePartitionId) {
364-
if (thePartitionId == null) {
365-
return false;
366-
}
367-
368-
return thePartitionId.isDefaultPartition();
369-
}
370-
371413
/**
372414
* Create a string representation suitable for use as a cache key. Null aware.
373415
* <p>

hapi-fhir-base/src/main/java/ca/uhn/fhir/system/HapiSystemProperties.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ public final class HapiSystemProperties {
3737
static final long DEFAULT_VALIDATION_RESOURCE_CACHE_TIMEOUT_MILLIS = TimeUnit.MINUTES.toMillis(10);
3838
static final String PREVENT_INVALIDATING_CONDITIONAL_MATCH_CRITERIA =
3939
"hapi.storage.prevent_invalidating_conditional_match_criteria";
40+
static final String DISABLE_DATABASE_PARTITION_MODE_SCHEMA_CHECK =
41+
"hapi.storage.disable_database_partition_mode_schema_check";
4042

4143
private HapiSystemProperties() {}
4244

@@ -164,4 +166,9 @@ public static boolean isPreventInvalidatingConditionalMatchCriteria() {
164166
return Boolean.parseBoolean(System.getProperty(
165167
HapiSystemProperties.PREVENT_INVALIDATING_CONDITIONAL_MATCH_CRITERIA, Boolean.FALSE.toString()));
166168
}
169+
170+
public static boolean isDisableDatabasePartitionModeSchemaCheck() {
171+
return Boolean.parseBoolean(System.getProperty(
172+
HapiSystemProperties.DISABLE_DATABASE_PARTITION_MODE_SCHEMA_CHECK, Boolean.FALSE.toString()));
173+
}
167174
}

hapi-fhir-base/src/test/java/ca/uhn/fhir/interceptor/model/RequestPartitionIdTest.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
public class RequestPartitionIdTest {
1818
private static final Logger ourLog = LoggerFactory.getLogger(RequestPartitionIdTest.class);
1919

20+
private static final Integer ourDefaultPartitionId = 0;
21+
2022
@Test
2123
public void testHashCode() {
2224
assertEquals(31860737, RequestPartitionId.allPartitions().hashCode());
@@ -41,6 +43,29 @@ public void testPartition() {
4143
assertFalse(RequestPartitionId.forPartitionIdsAndNames(null, Lists.newArrayList(1, 2), null).isDefaultPartition());
4244
}
4345

46+
@Test
47+
public void testIsDefaultPartition_withDefaultPartitionAsParameter() {
48+
49+
assertThat(RequestPartitionId.defaultPartition().isDefaultPartition(null)).isTrue();
50+
assertThat(RequestPartitionId.fromPartitionIds(ourDefaultPartitionId).isDefaultPartition(ourDefaultPartitionId)).isTrue();
51+
52+
assertThat(RequestPartitionId.defaultPartition().isDefaultPartition(ourDefaultPartitionId)).isFalse();
53+
assertThat(RequestPartitionId.allPartitions().isDefaultPartition(ourDefaultPartitionId)).isFalse();
54+
assertThat(RequestPartitionId.fromPartitionIds(ourDefaultPartitionId, 2).isDefaultPartition(ourDefaultPartitionId)).isFalse();
55+
}
56+
57+
@Test
58+
public void testHasDefaultPartition_withDefaultPartitionAsParameter() {
59+
60+
assertThat(RequestPartitionId.defaultPartition().hasDefaultPartitionId(null)).isTrue();
61+
assertThat(RequestPartitionId.fromPartitionIds(ourDefaultPartitionId).hasDefaultPartitionId(ourDefaultPartitionId)).isTrue();
62+
assertThat(RequestPartitionId.fromPartitionIds(ourDefaultPartitionId, null).hasDefaultPartitionId(null)).isTrue();
63+
assertThat(RequestPartitionId.fromPartitionIds(ourDefaultPartitionId, null).hasDefaultPartitionId(ourDefaultPartitionId)).isTrue();
64+
65+
assertThat(RequestPartitionId.fromPartitionIds(ourDefaultPartitionId).hasDefaultPartitionId(null)).isFalse();
66+
assertThat(RequestPartitionId.defaultPartition().hasDefaultPartitionId(ourDefaultPartitionId)).isFalse();
67+
}
68+
4469
@Test
4570
public void testMergeIds() {
4671
RequestPartitionId input0 = RequestPartitionId.fromPartitionIds(1, 2, 3);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
type: fix
3+
issue: 6673
4+
title: "When attempting to search for resources while both `AdvancedHSearchIndexing`
5+
and `StoreResourcesInHibernateSearchIndex` are enabled, returned lists
6+
could sometimes contain null entries.
7+
This has been fixed.
8+
"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
type: fix
3+
issue: 6686
4+
title: "Previously, attempting to create a cross-partition subscription would fail if the default partition ID was
5+
assigned a value different than the default value(null). This issue is fixed."
6+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
type: change
3+
issue: 6689
4+
title: "$hapi.fhir.replace-references operation has been changed to not replace versioned references"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
type: fix
3+
issue: 6692
4+
jira: SMILE-9736
5+
title: "Previously, when the in-memory matcher was used to match resources with a `_security` label filter
6+
and a `:not` operator (i.e. `_security:not=http://terminology.hl7.org/CodeSystem/v3-ActCode|NODSCLCD`),
7+
resources with no security labels at all were not matched. This has been fixed."
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
type: fix
3+
issue: 6697
4+
title: "Previously, operation $apply-codesystem-delta-add issued with Hibernate Search enabled and default search params option turned off resulted in an invalid sort specification error. This has been fixed."
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
type: fix
3+
issue: 6700
4+
title: "Previously if a non-null default partition ID was selected when partitioning is enabled, the subscription matcher would fail to find cross-partition subscriptions, causing subscriptions to appear to not be working. This has been corrected."
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
---
22
release-date: "2025-02-17"
3-
codename: "TBD"
3+
codename: "Transfiguration"

0 commit comments

Comments
 (0)