From 8b09b3f3eb98c0cf984c3331cecaf7f24f715911 Mon Sep 17 00:00:00 2001 From: jamesagnew Date: Tue, 3 Sep 2019 07:01:36 -0400 Subject: [PATCH] Rename config enum for consistency --- .../main/java/ca/uhn/fhir/util/MetaUtil.java | 20 +++++++++++++++++++ .../cli/ToggleSearchParametersCommand.java | 20 +++++++++++++++++++ .../java/ca/uhn/fhir/jpa/dao/DaoConfig.java | 14 ++++++------- .../ca/uhn/fhir/jpa/dao/SearchBuilder.java | 2 +- .../dstu3/FhirResourceDaoDstu3SourceTest.java | 4 ++-- .../dao/r4/FhirResourceDaoR4SourceTest.java | 6 ++---- .../ResourceHistoryProvenanceEntity.java | 20 +++++++++++++++++++ 7 files changed, 72 insertions(+), 14 deletions(-) diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/MetaUtil.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/MetaUtil.java index 2fd2d20bdad..c84d3924883 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/MetaUtil.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/MetaUtil.java @@ -1,5 +1,25 @@ package ca.uhn.fhir.util; +/*- + * #%L + * HAPI FHIR - Core Library + * %% + * Copyright (C) 2014 - 2019 University Health Network + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + import ca.uhn.fhir.context.BaseRuntimeChildDefinition; import ca.uhn.fhir.context.BaseRuntimeElementCompositeDefinition; import ca.uhn.fhir.context.FhirContext; diff --git a/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/ToggleSearchParametersCommand.java b/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/ToggleSearchParametersCommand.java index b2635f7809d..4aa3991980a 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/ToggleSearchParametersCommand.java +++ b/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/ToggleSearchParametersCommand.java @@ -1,5 +1,25 @@ package ca.uhn.fhir.cli; +/*- + * #%L + * HAPI FHIR - Command Line Client - API + * %% + * Copyright (C) 2014 - 2019 University Health Network + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + import ca.uhn.fhir.jpa.term.IHapiTerminologyLoaderSvc; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.Options; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/DaoConfig.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/DaoConfig.java index 7a7f588a72f..a3e93390c8e 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/DaoConfig.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/DaoConfig.java @@ -151,7 +151,7 @@ public class DaoConfig { */ private boolean myPreExpandValueSetsExperimental = false; private boolean myFilterParameterEnabled = false; - private StoreMetaSourceInformation myStoreMetaSourceInformation = StoreMetaSourceInformation.SOURCE_URI_AND_REQUEST_ID; + private StoreMetaSourceInformationEnum myStoreMetaSourceInformation = StoreMetaSourceInformationEnum.SOURCE_URI_AND_REQUEST_ID; /** * EXPERIMENTAL - Do not use in production! Do not change default of {@code 0}! */ @@ -1676,10 +1676,10 @@ public class DaoConfig { * each resource. This adds extra table and index space so it should be disabled if it is not being * used. *

- * Default is {@link StoreMetaSourceInformation#SOURCE_URI_AND_REQUEST_ID} + * Default is {@link StoreMetaSourceInformationEnum#SOURCE_URI_AND_REQUEST_ID} *

*/ - public StoreMetaSourceInformation getStoreMetaSourceInformation() { + public StoreMetaSourceInformationEnum getStoreMetaSourceInformation() { return myStoreMetaSourceInformation; } @@ -1688,15 +1688,15 @@ public class DaoConfig { * each resource. This adds extra table and index space so it should be disabled if it is not being * used. *

- * Default is {@link StoreMetaSourceInformation#SOURCE_URI_AND_REQUEST_ID} + * Default is {@link StoreMetaSourceInformationEnum#SOURCE_URI_AND_REQUEST_ID} *

*/ - public void setStoreMetaSourceInformation(StoreMetaSourceInformation theStoreMetaSourceInformation) { + public void setStoreMetaSourceInformation(StoreMetaSourceInformationEnum theStoreMetaSourceInformation) { Validate.notNull(theStoreMetaSourceInformation, "theStoreMetaSourceInformation must not be null"); myStoreMetaSourceInformation = theStoreMetaSourceInformation; } - public enum StoreMetaSourceInformation { + public enum StoreMetaSourceInformationEnum { NONE(false, false), SOURCE_URI(true, false), REQUEST_ID(false, true), @@ -1705,7 +1705,7 @@ public class DaoConfig { private final boolean myStoreSourceUri; private final boolean myStoreRequestId; - StoreMetaSourceInformation(boolean theStoreSourceUri, boolean theStoreRequestId) { + StoreMetaSourceInformationEnum(boolean theStoreSourceUri, boolean theStoreRequestId) { myStoreSourceUri = theStoreSourceUri; myStoreRequestId = theStoreRequestId; } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/SearchBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/SearchBuilder.java index 7bca678788f..d6fef210449 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/SearchBuilder.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/SearchBuilder.java @@ -825,7 +825,7 @@ public class SearchBuilder implements ISearchBuilder { private Predicate addPredicateSource(List theList, SearchFilterParser.CompareOperation theOperation, RequestDetails theRequest) { - if (myDaoConfig.getStoreMetaSourceInformation() == DaoConfig.StoreMetaSourceInformation.NONE) { + if (myDaoConfig.getStoreMetaSourceInformation() == DaoConfig.StoreMetaSourceInformationEnum.NONE) { String msg = myContext.getLocalizer().getMessage(SearchBuilder.class, "sourceParamDisabled"); throw new InvalidRequestException(msg); } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SourceTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SourceTest.java index 0e9a32c0b58..d670288d35d 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SourceTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SourceTest.java @@ -37,7 +37,7 @@ public class FhirResourceDaoDstu3SourceTest extends BaseJpaDstu3Test { @Before public void before() { - myDaoConfig.setStoreMetaSourceInformation(DaoConfig.StoreMetaSourceInformation.SOURCE_URI_AND_REQUEST_ID); + myDaoConfig.setStoreMetaSourceInformation(DaoConfig.StoreMetaSourceInformationEnum.SOURCE_URI_AND_REQUEST_ID); } @Test @@ -184,7 +184,7 @@ public class FhirResourceDaoDstu3SourceTest extends BaseJpaDstu3Test { @Test public void testSourceDisabled() { - myDaoConfig.setStoreMetaSourceInformation(DaoConfig.StoreMetaSourceInformation.NONE); + myDaoConfig.setStoreMetaSourceInformation(DaoConfig.StoreMetaSourceInformationEnum.NONE); when(mySrd.getRequestId()).thenReturn("0000000000000000"); Patient pt0 = new Patient(); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SourceTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SourceTest.java index 10e51c05432..2985a153fea 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SourceTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SourceTest.java @@ -18,8 +18,6 @@ import org.junit.AfterClass; import org.junit.Before; import org.junit.Test; -import java.util.UUID; - import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.matchesPattern; import static org.junit.Assert.assertEquals; @@ -37,7 +35,7 @@ public class FhirResourceDaoR4SourceTest extends BaseJpaR4Test { @Before public void before() { - myDaoConfig.setStoreMetaSourceInformation(DaoConfig.StoreMetaSourceInformation.SOURCE_URI_AND_REQUEST_ID); + myDaoConfig.setStoreMetaSourceInformation(DaoConfig.StoreMetaSourceInformationEnum.SOURCE_URI_AND_REQUEST_ID); } @Test @@ -184,7 +182,7 @@ public class FhirResourceDaoR4SourceTest extends BaseJpaR4Test { @Test public void testSourceDisabled() { - myDaoConfig.setStoreMetaSourceInformation(DaoConfig.StoreMetaSourceInformation.NONE); + myDaoConfig.setStoreMetaSourceInformation(DaoConfig.StoreMetaSourceInformationEnum.NONE); when(mySrd.getRequestId()).thenReturn("0000000000000000"); Patient pt0 = new Patient(); diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceHistoryProvenanceEntity.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceHistoryProvenanceEntity.java index 19527c96c18..c806a2970d9 100644 --- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceHistoryProvenanceEntity.java +++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/ResourceHistoryProvenanceEntity.java @@ -1,5 +1,25 @@ package ca.uhn.fhir.jpa.model.entity; +/*- + * #%L + * HAPI FHIR Model + * %% + * Copyright (C) 2014 - 2019 University Health Network + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + import ca.uhn.fhir.rest.api.Constants; import javax.persistence.*;