fix enum hashcode

This commit is contained in:
Ken Stevens 2019-11-02 17:48:30 -04:00
parent 0404454167
commit 3bfcb42012
2 changed files with 11 additions and 2 deletions

View File

@ -5,12 +5,16 @@ import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import org.flywaydb.core.api.MigrationVersion; import org.flywaydb.core.api.MigrationVersion;
import org.flywaydb.core.api.migration.Context; import org.flywaydb.core.api.migration.Context;
import org.flywaydb.core.api.migration.JavaMigration; import org.flywaydb.core.api.migration.JavaMigration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.SQLException; import java.sql.SQLException;
import static org.apache.commons.lang3.StringUtils.isBlank; import static org.apache.commons.lang3.StringUtils.isBlank;
public class FlywayMigration implements JavaMigration { public class FlywayMigration implements JavaMigration {
private static final Logger ourLog = LoggerFactory.getLogger(FlywayMigration.class);
private final BaseTask myTask; private final BaseTask myTask;
private final FlywayMigrator myFlywayMigrator; private final FlywayMigrator myFlywayMigrator;
private DriverTypeEnum.ConnectionProperties myConnectionProperties; private DriverTypeEnum.ConnectionProperties myConnectionProperties;

View File

@ -21,9 +21,12 @@ package ca.uhn.fhir.jpa.migrate.taskdef;
*/ */
import ca.uhn.fhir.jpa.migrate.DriverTypeEnum; import ca.uhn.fhir.jpa.migrate.DriverTypeEnum;
import ca.uhn.fhir.jpa.migrate.FlywayMigration;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import java.util.HashMap; import java.util.HashMap;
@ -31,6 +34,8 @@ import java.util.Map;
import java.util.Objects; import java.util.Objects;
public abstract class BaseTableColumnTypeTask<T extends BaseTableTask> extends BaseTableColumnTask<T> { public abstract class BaseTableColumnTypeTask<T extends BaseTableTask> extends BaseTableColumnTask<T> {
private static final Logger ourLog = LoggerFactory.getLogger(BaseTableColumnTypeTask.class);
private ColumnTypeEnum myColumnType; private ColumnTypeEnum myColumnType;
private Map<ColumnTypeEnum, Map<DriverTypeEnum, String>> myColumnTypeToDriverTypeToSqlType = new HashMap<>(); private Map<ColumnTypeEnum, Map<DriverTypeEnum, String>> myColumnTypeToDriverTypeToSqlType = new HashMap<>();
@ -202,7 +207,7 @@ public abstract class BaseTableColumnTypeTask<T extends BaseTableTask> extends B
return new EqualsBuilder() return new EqualsBuilder()
.appendSuper(super.equals(theO)) .appendSuper(super.equals(theO))
.append(myColumnType, that.myColumnType) .append(myColumnType.name(), that.myColumnType.name())
.append(myNullable, that.myNullable) .append(myNullable, that.myNullable)
.append(myColumnLength, that.myColumnLength) .append(myColumnLength, that.myColumnLength)
.isEquals(); .isEquals();
@ -212,7 +217,7 @@ public abstract class BaseTableColumnTypeTask<T extends BaseTableTask> extends B
public int hashCode() { public int hashCode() {
return new HashCodeBuilder(17, 37) return new HashCodeBuilder(17, 37)
.appendSuper(super.hashCode()) .appendSuper(super.hashCode())
.append(myColumnType) .append(myColumnType.name())
.append(myNullable) .append(myNullable)
.append(myColumnLength) .append(myColumnLength)
.toHashCode(); .toHashCode();