Skip to content

Commit 066c242

Browse files
committed
Merge branch 'rel_8_0_mb'
2 parents c9889a9 + 78537ba commit 066c242

File tree

91 files changed

+4623
-746
lines changed

Some content is hidden

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

91 files changed

+4623
-746
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/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/parser/LenientErrorHandler.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ public void incorrectJsonType(
8787
ScalarType theFoundScalarType) {
8888
if (myLogErrors) {
8989
if (ourLog.isWarnEnabled()) {
90-
String message = describeLocation(theLocation) +
91-
createIncorrectJsonTypeMessage(
92-
theElementName, theExpected, theExpectedScalarType, theFound, theFoundScalarType);
90+
String message = describeLocation(theLocation)
91+
+ createIncorrectJsonTypeMessage(
92+
theElementName, theExpected, theExpectedScalarType, theFound, theFoundScalarType);
9393
ourLog.warn(message);
9494
}
9595
}

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/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}

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);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This was an interim release which was never made public, as it was decided that this release would have a major bump, to 8.0.0
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
release-date: "2025-02-17"
3+
codename: "Transfiguration"
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"

0 commit comments

Comments
 (0)