Syncing master into working branch.

This commit is contained in:
Diederik Muylwyk 2019-07-29 19:39:29 -04:00
commit d1cba9f928
3 changed files with 49 additions and 12 deletions

View File

@ -1,5 +1,25 @@
package ca.uhn.fhir.jpa.provider;
/*-
* #%L
* HAPI FHIR JPA Server
* %%
* 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.model.util.JpaConstants;
/**

View File

@ -50,7 +50,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import static org.apache.commons.lang3.StringUtils.*;
public abstract class TerminologyUploaderProvider extends BaseJpaProvider {
public class TerminologyUploaderProvider extends BaseJpaProvider {
public static final String CONCEPT_COUNT = "conceptCount";
public static final String TARGET = "target";
@ -65,6 +65,23 @@ public abstract class TerminologyUploaderProvider extends BaseJpaProvider {
@Autowired
private IHapiTerminologySvc myTerminologySvc;
/**
* Constructor
*/
public TerminologyUploaderProvider() {
this(null, null, null);
}
/**
* Constructor
*/
public TerminologyUploaderProvider(FhirContext theContext, IHapiTerminologyLoaderSvc theTerminologyLoaderSvc, IHapiTerminologySvc theTerminologySvc) {
myCtx = theContext;
myTerminologyLoaderSvc = theTerminologyLoaderSvc;
myTerminologySvc = theTerminologySvc;
}
/**
* <code>
* $apply-codesystem-delta-add

View File

@ -188,8 +188,8 @@ public class TerminologySvcImplR4Test extends BaseJpaR4Test {
.setDisplay("displayB");
myTermSvc.applyDeltaCodesystemsAdd("http://foo", null, delta);
assertEquals(true, myTermSvc.findCode("http://foo", "codeA").isPresent());
assertEquals(false, myTermSvc.findCode("http://foo", "codeZZZ").isPresent());
assertEquals(true, runInTransaction(()->myTermSvc.findCode("http://foo", "codeA").isPresent()));
assertEquals(false, runInTransaction(()->myTermSvc.findCode("http://foo", "codeZZZ").isPresent()));
}
@ -321,7 +321,7 @@ public class TerminologySvcImplR4Test extends BaseJpaR4Test {
.setDisplay("displayAAA");
myTermSvc.applyDeltaCodesystemsAdd("http://foo", "codeA", delta);
assertEquals(true, myTermSvc.findCode("http://foo", "codeAA").isPresent());
assertEquals(true, runInTransaction(()->myTermSvc.findCode("http://foo", "codeAA").isPresent()));
assertEquals(ConceptSubsumptionOutcome.SUBSUMEDBY, myTermSvc.subsumes(toString("codeA"), toString("codeAA"), toString("http://foo"), null, null).getOutcome());
assertEquals(ConceptSubsumptionOutcome.SUBSUMEDBY, myTermSvc.subsumes(toString("codeA"), toString("codeAAA"), toString("http://foo"), null, null).getOutcome());
assertEquals(ConceptSubsumptionOutcome.SUBSUMEDBY, myTermSvc.subsumes(toString("codeAA"), toString("codeAAA"), toString("http://foo"), null, null).getOutcome());
@ -440,10 +440,10 @@ public class TerminologySvcImplR4Test extends BaseJpaR4Test {
.setDisplay("displayB");
myTermSvc.applyDeltaCodesystemsRemove("http://foo", delta);
assertEquals(false, myTermSvc.findCode("http://foo", "codeB").isPresent());
assertEquals(true, myTermSvc.findCode("http://foo", "codeA").isPresent());
assertEquals(true, myTermSvc.findCode("http://foo", "codeAA").isPresent());
assertEquals(true, myTermSvc.findCode("http://foo", "codeAAA").isPresent());
assertEquals(false, runInTransaction(()->myTermSvc.findCode("http://foo", "codeB").isPresent()));
assertEquals(true, runInTransaction(()->myTermSvc.findCode("http://foo", "codeA").isPresent()));
assertEquals(true, runInTransaction(()->myTermSvc.findCode("http://foo", "codeAA").isPresent()));
assertEquals(true, runInTransaction(()->myTermSvc.findCode("http://foo", "codeAAA").isPresent()));
// Remove CodeA
delta = new CodeSystem();
@ -452,10 +452,10 @@ public class TerminologySvcImplR4Test extends BaseJpaR4Test {
.setCode("codeA");
myTermSvc.applyDeltaCodesystemsRemove("http://foo", delta);
assertEquals(false, myTermSvc.findCode("http://foo", "codeB").isPresent());
assertEquals(false, myTermSvc.findCode("http://foo", "codeA").isPresent());
assertEquals(false, myTermSvc.findCode("http://foo", "codeAA").isPresent());
assertEquals(false, myTermSvc.findCode("http://foo", "codeAAA").isPresent());
assertEquals(false, runInTransaction(()->myTermSvc.findCode("http://foo", "codeB").isPresent()));
assertEquals(false, runInTransaction(()->myTermSvc.findCode("http://foo", "codeA").isPresent()));
assertEquals(false, runInTransaction(()->myTermSvc.findCode("http://foo", "codeAA").isPresent()));
assertEquals(false, runInTransaction(()->myTermSvc.findCode("http://foo", "codeAAA").isPresent()));
}