RED-8702: Explore document databases to store entityLog

* fix pmd and checkstyle
This commit is contained in:
maverickstuder 2024-04-11 12:10:02 +02:00
parent fc9a014395
commit d4d84c6ac2

View File

@ -20,6 +20,7 @@ import liquibase.integration.spring.SpringLiquibase;
import liquibase.integration.spring.SpringResourceAccessor;
import lombok.Getter;
import lombok.Setter;
import lombok.SneakyThrows;
@Getter
@Setter
@ -27,6 +28,7 @@ public class MongoSpringLiquibase extends SpringLiquibase {
protected Database database;
public MongoSpringLiquibase() {
super();
@ -63,8 +65,8 @@ public class MongoSpringLiquibase extends SpringLiquibase {
if (rollbackFile != null) {
try (final OutputStream outputStream = Files.newOutputStream(rollbackFile.toPath()); Writer output = new OutputStreamWriter(outputStream,
GlobalConfiguration.OUTPUT_FILE_ENCODING.getCurrentValue())) {
try (OutputStream outputStream = Files.newOutputStream(rollbackFile.toPath()); Writer output = new OutputStreamWriter(outputStream,
GlobalConfiguration.OUTPUT_FILE_ENCODING.getCurrentValue())) {
if (tag != null) {
liquibase.futureRollbackSQL(tag, new Contexts(getContexts()), new LabelExpression(getLabelFilter()), output);
@ -79,18 +81,21 @@ public class MongoSpringLiquibase extends SpringLiquibase {
@SuppressWarnings("squid:S2095")
protected Liquibase createLiquibase(Database db) throws LiquibaseException {
@SneakyThrows
protected Liquibase createLiquibase(Database db) {
SpringResourceAccessor resourceAccessor = createResourceOpener();
Liquibase liquibase = new Liquibase(getChangeLog(), resourceAccessor, db);
if (parameters != null) {
for (Map.Entry<String, String> entry : parameters.entrySet()) {
liquibase.setChangeLogParameter(entry.getKey(), entry.getValue());
Liquibase liquibase;
try (SpringResourceAccessor resourceAccessor = createResourceOpener()) {
liquibase = new Liquibase(getChangeLog(), resourceAccessor, db);
if (parameters != null) {
for (Map.Entry<String, String> entry : parameters.entrySet()) {
liquibase.setChangeLogParameter(entry.getKey(), entry.getValue());
}
}
}
if (isDropFirst()) {
liquibase.dropAll();
if (isDropFirst()) {
liquibase.dropAll();
}
}
return liquibase;