it works now

This commit is contained in:
Ken Stevens 2020-02-09 18:29:55 -05:00
parent 190e9bed58
commit 5e8eec8bf6
4 changed files with 19 additions and 2 deletions

View File

@ -34,6 +34,7 @@ import java.util.Set;
public class InitializeSchemaTask extends BaseTask<InitializeSchemaTask> { public class InitializeSchemaTask extends BaseTask<InitializeSchemaTask> {
private static final Logger ourLog = LoggerFactory.getLogger(InitializeSchemaTask.class); private static final Logger ourLog = LoggerFactory.getLogger(InitializeSchemaTask.class);
private final ISchemaInitializationProvider mySchemaInitializationProvider; private final ISchemaInitializationProvider mySchemaInitializationProvider;
public InitializeSchemaTask(String theProductVersion, String theSchemaVersion, ISchemaInitializationProvider theSchemaInitializationProvider) { public InitializeSchemaTask(String theProductVersion, String theSchemaVersion, ISchemaInitializationProvider theSchemaInitializationProvider) {
@ -77,4 +78,8 @@ public class InitializeSchemaTask extends BaseTask<InitializeSchemaTask> {
protected void generateHashCode(HashCodeBuilder theBuilder) { protected void generateHashCode(HashCodeBuilder theBuilder) {
theBuilder.append(mySchemaInitializationProvider); theBuilder.append(mySchemaInitializationProvider);
} }
public ISchemaInitializationProvider getSchemaInitializationProvider() {
return mySchemaInitializationProvider;
}
} }

View File

@ -893,7 +893,7 @@ public class HapiFhirJpaMigrationTasks extends BaseMigrationTasks<VersionEnum> {
} }
private void init330() { // 20180114 - 20180329 protected void init330() { // 20180114 - 20180329
Builder version = forVersion(VersionEnum.V3_3_0); Builder version = forVersion(VersionEnum.V3_3_0);
version.initializeSchema("20180115.0", new SchemaInitializationProvider("/ca/uhn/hapi/fhir/jpa/docs/database", "HFJ_RESOURCE")); version.initializeSchema("20180115.0", new SchemaInitializationProvider("/ca/uhn/hapi/fhir/jpa/docs/database", "HFJ_RESOURCE"));

View File

@ -37,7 +37,7 @@ import static org.apache.commons.lang3.StringUtils.isBlank;
public class SchemaInitializationProvider implements ISchemaInitializationProvider { public class SchemaInitializationProvider implements ISchemaInitializationProvider {
private final String mySchemaFileClassPath; private String mySchemaFileClassPath;
private final String mySchemaExistsIndicatorTable; private final String mySchemaExistsIndicatorTable;
/** /**
@ -110,5 +110,10 @@ public class SchemaInitializationProvider implements ISchemaInitializationProvid
public String getSchemaExistsIndicatorTable() { public String getSchemaExistsIndicatorTable() {
return mySchemaExistsIndicatorTable; return mySchemaExistsIndicatorTable;
} }
public SchemaInitializationProvider setSchemaFileClassPath(String theSchemaFileClassPath) {
mySchemaFileClassPath = theSchemaFileClassPath;
return this;
}
} }

View File

@ -81,6 +81,13 @@ public class BaseMigrationTasks<T extends Enum> {
return retval; return retval;
} }
protected BaseTask getTaskWithVersion(String theFlywayVersion) {
return myTasks.values().stream()
.filter(task -> theFlywayVersion.equals(task.getFlywayVersion()))
.findFirst()
.get();
}
void validate(Collection<BaseTask> theTasks) { void validate(Collection<BaseTask> theTasks) {
for (BaseTask task: theTasks) { for (BaseTask task: theTasks) {
task.validateVersion(); task.validateVersion();