Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

History count fix #739

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
11 changes: 11 additions & 0 deletions src/main/java/ca/uhn/fhir/jpa/starter/AppProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public class AppProperties {
private List<String> supported_resource_types = new ArrayList<>();
private List<Bundle.BundleType> allowed_bundle_types = null;
private Boolean narrative_enabled = true;
private String history_count_mode = "CACHED_ONLY_WITHOUT_OFFSET";

private Boolean ig_runtime_upload_enabled = false;

Expand Down Expand Up @@ -554,6 +555,16 @@ public void setNarrative_enabled(Boolean narrative_enabled)
this.narrative_enabled = narrative_enabled;
}

public String getHistory_count_mode()
{
return history_count_mode;
}

public void setHistory_count_mode(String history_count_mode)
{
this.history_count_mode = history_count_mode;
}

public Boolean getLastn_enabled() {
return lastn_enabled;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import ca.uhn.fhir.jpa.api.config.ThreadPoolFactoryConfig;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao;
import ca.uhn.fhir.jpa.api.model.HistoryCountModeEnum;
import ca.uhn.fhir.jpa.binary.interceptor.BinaryStorageInterceptor;
import ca.uhn.fhir.jpa.binary.provider.BinaryAccessProvider;
import ca.uhn.fhir.jpa.config.util.HapiEntityManagerFactoryUtil;
Expand Down Expand Up @@ -63,6 +64,7 @@
import ca.uhn.fhir.validation.IValidatorModule;
import ca.uhn.fhir.validation.ResultSeverityEnum;
import com.google.common.base.Strings;
import org.apache.commons.lang3.EnumUtils;
import jakarta.persistence.EntityManagerFactory;
import org.hl7.fhir.common.hapi.validation.support.CachingValidationSupport;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
Expand Down Expand Up @@ -457,6 +459,10 @@ public RestfulServer restfulServer(
fhirServer.registerProvider(theIpsOperationProvider.get());
}

if(EnumUtils.isValidEnum(HistoryCountModeEnum.class, appProperties.getHistory_count_mode())){
jpaStorageSettings.setHistoryCountMode(HistoryCountModeEnum.valueOf(appProperties.getHistory_count_mode()));
}

// register custom providers
registerCustomProviders(fhirServer, appContext, appProperties.getCustomProviderClasses());

Expand Down
5 changes: 5 additions & 0 deletions src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,11 @@ hapi:
# These are allowed_origin patterns, see: https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/cors/CorsConfiguration.html#setAllowedOriginPatterns-java.util.List-
allowed_origin:
- '*'
# history_count_mode is an integer that represents the mode that the jpaStorageConfig will use when getting the history count during a history request
# history_count_mode = CACHED_ONLY_WITHOUT_OFFSET (default within hapi-fhir jpaStorageConfig)
# history_count_mode = COUNT_ACCURATE (ignores cache and always gets correct count)
# history_count_mode = COUNT_DISABLED (does not return count at all)
history_count_mode: COUNT_ACCURATE

# Search coordinator thread pool sizes
search-coord-core-pool-size: 20
Expand Down
5 changes: 5 additions & 0 deletions src/test/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ hapi:
# These are allowed_origin patterns, see: https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/cors/CorsConfiguration.html#setAllowedOriginPatterns-java.util.List-
# allowed_origin:
# - '*'
# history_count_mode represents the mode that the jpaStorageConfig will use when getting the history count during a history request
# history_count_mode = CACHED_ONLY_WITHOUT_OFFSET (default within hapi-fhir jpaStorageConfig)
# history_count_mode = COUNT_ACCURATE (ignores cache and always gets correct count)
# history_count_mode = COUNT_DISABLED (does not return count at all)
# history_count_mode: CACHED_ONLY_WITHOUT_OFFSET

# Search coordinator thread pool sizes
search-coord-core-pool-size: 20
Expand Down