Merge branch 'master' of github.com:jamesagnew/hapi-fhir

This commit is contained in:
jamesagnew 2019-12-05 18:19:36 -05:00
commit 38ee01f279
6 changed files with 60 additions and 9 deletions

View File

@ -80,7 +80,7 @@ public class HapiFlywayMigrateDatabaseCommandTest {
@Test
public void testMigrateFrom340_NoFlyway() throws IOException, SQLException {
File location = getLocation("migrator_h2_test_340_current");
File location = getLocation("migrator_h2_test_340_current_noflyway");
String url = "jdbc:h2:" + location.getAbsolutePath() + ";create=true";
DriverTypeEnum.ConnectionProperties connectionProperties = DriverTypeEnum.H2_EMBEDDED.newConnectionProperties(url, "", "");

View File

@ -82,11 +82,6 @@
<artifactId>jdom2</artifactId>
<version>2.0.6</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.28</version>
</dependency>
<!-- Needed for JEE/Servlet support -->
<dependency>
<groupId>javax.servlet</groupId>

View File

@ -24,12 +24,17 @@ import ca.uhn.fhir.jpa.util.DeleteConflict;
import org.apache.commons.lang3.Validate;
import org.hl7.fhir.instance.model.api.IIdType;
import java.util.*;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.function.Predicate;
public class DeleteConflictList implements Iterable<DeleteConflict> {
private final List<DeleteConflict> myList = new ArrayList<>();
private final Set<String> myResourceIdsMarkedForDeletion;
private int myRemoveModCount;
/**
* Constructor
@ -69,11 +74,38 @@ public class DeleteConflictList implements Iterable<DeleteConflict> {
@Override
public Iterator<DeleteConflict> iterator() {
return myList.iterator();
// Note that handlers may add items to this list, so we're using a special iterator
// that is ok with this. Only removals from the list should trigger a concurrent modification
// issue
return new Iterator<DeleteConflict>() {
private final int myOriginalRemoveModCont = myRemoveModCount;
private int myNextIndex = 0;
@Override
public boolean hasNext() {
checkForCoModification();
return myNextIndex < myList.size();
}
@Override
public DeleteConflict next() {
checkForCoModification();
return myList.get(myNextIndex++);
}
private void checkForCoModification() {
Validate.isTrue(myOriginalRemoveModCont == myRemoveModCount);
}
};
}
public boolean removeIf(Predicate<DeleteConflict> theFilter) {
return myList.removeIf(theFilter);
boolean retVal = myList.removeIf(theFilter);
if (retVal) {
myRemoveModCount++;
}
return retVal;
}
public void addAll(DeleteConflictList theNewConflicts) {

View File

@ -64,6 +64,10 @@ public class CascadingDeleteInterceptorR4Test extends BaseResourceProviderR4Test
e.setSubject(new Reference(myPatientId));
myEncounterId = ourClient.create().resource(e).execute().getId().toUnqualifiedVersionless();
CarePlan cp = new CarePlan();
cp.setEncounter(new Reference(myEncounterId));
ourClient.create().resource(cp).execute();
Observation o = new Observation();
o.setStatus(Observation.ObservationStatus.FINAL);
o.setSubject( new Reference(myPatientId));

View File

@ -101,6 +101,22 @@
</pluginManagement>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
<dumpOnExit>true</dumpOnExit>
</configuration>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Tell Maven which Java source version you want to use -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>

View File

@ -50,6 +50,10 @@
ValueSet Precalculation sometimes failed on Oracle DBs due to an invalid SQL function. This
has been corrected.
</action>
<action type="fix">
A ConcurrentModificationException was sometimes thrown when performing a cascading delete.
This has been corrected.
</action>
</release>
<release version="4.1.0" date="2019-11-13" description="Jitterbug">
<action type="add">