From 034e878a6fb84f3a4267e8131d43dac11ee7bb62 Mon Sep 17 00:00:00 2001 From: jamesagnew Date: Sun, 10 May 2020 12:09:47 -0400 Subject: [PATCH] Add NOP tasks for 4.3.0 to avoid migrator issues --- .../uhn/fhir/jpa/migrate/taskdef/NopTask.java | 51 ++++++++++++++++ .../tasks/HapiFhirJpaMigrationTasks.java | 60 +++++++++++++++++++ .../fhir/jpa/migrate/tasks/api/Builder.java | 6 +- 3 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/NopTask.java diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/NopTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/NopTask.java new file mode 100644 index 00000000000..c52c9751497 --- /dev/null +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/NopTask.java @@ -0,0 +1,51 @@ +package ca.uhn.fhir.jpa.migrate.taskdef; + +/*- + * #%L + * HAPI FHIR JPA Server - Migration + * %% + * Copyright (C) 2014 - 2020 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 org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; + +public class NopTask extends BaseTask { + + public NopTask(String theProductVersion, String theSchemaVersion) { + super(theProductVersion, theSchemaVersion); + } + + @Override + public void validate() { + // nothing + } + + @Override + protected void doExecute() { + // nothing + } + + @Override + protected void generateHashCode(HashCodeBuilder theBuilder) { + // nothing + } + + @Override + protected void generateEquals(EqualsBuilder theBuilder, BaseTask theOtherObject) { + // nothing + } +} diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/HapiFhirJpaMigrationTasks.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/HapiFhirJpaMigrationTasks.java index e0840ff572e..d27c2b785b1 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/HapiFhirJpaMigrationTasks.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/HapiFhirJpaMigrationTasks.java @@ -59,9 +59,69 @@ public class HapiFhirJpaMigrationTasks extends BaseMigrationTasks { init400(); // 20190401 - 20190814 init410(); // 20190815 - 20191014 init420(); // 20191015 - 20200217 + init430(); // Replaced by 5.0.0 init500(); // 20200218 - present } + /** + * Partway through the 4.3.0 releaase cycle we renumbered to + * 5.0.0 - We have a bunch of NOP tasks here to avoid breakage for anyone + * who installed a prerelease before we made the switch + */ + @SuppressWarnings("deprecation") + private void init430() { + Builder version = forVersion(VersionEnum.V4_3_0); + version.addNop("20200218.1"); + version.addNop("20200218.2"); + version.addNop("20200218.3"); + version.addNop("20200220.1"); + version.addNop("20200419.1"); + version.addNop("20200419.2"); + version.addNop("20200420.0"); + version.addNop("20200420.1"); + version.addNop("20200420.2"); + version.addNop("20200420.3"); + version.addNop("20200420.4"); + version.addNop("20200420.5"); + version.addNop("20200420.6"); + version.addNop("20200420.7"); + version.addNop("20200420.8"); + version.addNop("20200420.9"); + version.addNop("20200420.10"); + version.addNop("20200420.11"); + version.addNop("20200420.12"); + version.addNop("20200420.13"); + version.addNop("20200420.14"); + version.addNop("20200420.15"); + version.addNop("20200420.16"); + version.addNop("20200420.17"); + version.addNop("20200420.18"); + version.addNop("20200420.19"); + version.addNop("20200420.20"); + version.addNop("20200420.21"); + version.addNop("20200420.22"); + version.addNop("20200420.23"); + version.addNop("20200420.24"); + version.addNop("20200420.25"); + version.addNop("20200420.26"); + version.addNop("20200420.27"); + version.addNop("20200420.28"); + version.addNop("20200420.29"); + version.addNop("20200420.30"); + version.addNop("20200420.31"); + version.addNop("20200420.32"); + version.addNop("20200420.33"); + version.addNop("20200420.34"); + version.addNop("20200420.35"); + version.addNop("20200420.36"); + version.addNop("20200420.37"); + version.addNop("20200420.38"); + version.addNop("20200420.39"); + version.addNop("20200420.40"); + version.addNop("20200420.41"); + version.addNop("20200420.42"); + } + protected void init500() { // 20200218 - present Builder version = forVersion(VersionEnum.V5_0_0); diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/api/Builder.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/api/Builder.java index e247953b241..d030a09d4cd 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/api/Builder.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/api/Builder.java @@ -96,7 +96,11 @@ public class Builder { addTask(task); } - public class BuilderAddTableRawSql { + public void addNop(String theVersion) { + addTask(new NopTask(myRelease, theVersion)); + } + + public class BuilderAddTableRawSql { private final AddTableRawSqlTask myTask;