Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ public Result writeEntry(AuditEntry auditEntry) {
ps.setString(18, auditEntry.getRecoveryStrategy() != null ? auditEntry.getRecoveryStrategy().name() : null);
ps.setObject(19, auditEntry.getTransactionFlag());
ps.setObject(20, auditEntry.getSystemChange());
ps.setBoolean(21, auditEntry.isLegacy());
ps.executeUpdate();
}
return Result.OK();
Expand Down Expand Up @@ -135,7 +134,6 @@ public List<AuditEntry> getAuditHistory() {
rs.getString("execution_hostname"),
rs.getString("metadata"),
rs.getBoolean("system_change"),
rs.getBoolean("legacy"),
rs.getString("error_trace"),
AuditTxType.fromString(rs.getString("tx_strategy")),
rs.getString("target_system_id"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ public String getCreateTableSqlString(String tableName) {
"change_order VARCHAR(50), " +
"recovery_strategy VARCHAR(50), " +
"transaction_flag %s, " +
"system_change %s, " +
"legacy %s" +
")", tableName, getAutoIncrementType(), getClobType(), getBigIntType(), getClobType(), getBooleanType(), getBooleanType(), getBooleanType());
"system_change %s" +
")", tableName, getAutoIncrementType(), getClobType(), getBigIntType(), getClobType(), getBooleanType(), getBooleanType());
case FIREBIRD:
return String.format(
"CREATE TABLE %s (" +
Expand All @@ -83,8 +82,7 @@ public String getCreateTableSqlString(String tableName) {
"change_order VARCHAR(50), " +
"recovery_strategy VARCHAR(50), " +
"transaction_flag SMALLINT, " +
"system_change SMALLINT, " +
"legacy SMALLINT" +
"system_change SMALLINT" +
")", tableName);
case POSTGRESQL:
return String.format(
Expand All @@ -109,8 +107,7 @@ public String getCreateTableSqlString(String tableName) {
"change_order VARCHAR(255)," +
"recovery_strategy VARCHAR(32)," +
"transaction_flag BOOLEAN," +
"system_change BOOLEAN," +
"legacy BOOLEAN" +
"system_change BOOLEAN" +
")", tableName);

case SQLSERVER:
Expand All @@ -137,9 +134,8 @@ public String getCreateTableSqlString(String tableName) {
"change_order VARCHAR(50), " +
"recovery_strategy VARCHAR(50), " +
"transaction_flag %s, " +
"system_change %s, " +
"legacy %s" +
")", tableName, tableName, getAutoIncrementType(), getClobType(), getBigIntType(), getClobType(), getBooleanType(), getBooleanType(), getBooleanType());
"system_change %s" +
")", tableName, tableName, getAutoIncrementType(), getClobType(), getBigIntType(), getClobType(), getBooleanType(), getBooleanType());
case SYBASE:
return String.format(
"IF NOT EXISTS (SELECT 1 FROM sysobjects WHERE name='%s' AND type='U') " +
Expand All @@ -165,8 +161,7 @@ public String getCreateTableSqlString(String tableName) {
" change_order VARCHAR(255), " +
" recovery_strategy VARCHAR(64), " +
" transaction_flag BIT NOT NULL, " +
" system_change BIT NOT NULL, " +
" legacy BIT NOT NULL" +
" system_change BIT NOT NULL" +
" )') " +
"END",
tableName, tableName
Expand Down Expand Up @@ -194,9 +189,8 @@ public String getCreateTableSqlString(String tableName) {
"change_order VARCHAR2(50), " +
"recovery_strategy VARCHAR2(50), " +
"transaction_flag %s, " +
"system_change %s, " +
"legacy %s" +
")'; EXCEPTION WHEN OTHERS THEN IF SQLCODE != -955 THEN RAISE; END IF; END;", tableName, getAutoIncrementType(), getClobType(), getBigIntType(), getClobType(), getBooleanType(), getBooleanType(), getBooleanType());
"system_change %s" +
")'; EXCEPTION WHEN OTHERS THEN IF SQLCODE != -955 THEN RAISE; END IF; END;", tableName, getAutoIncrementType(), getClobType(), getBigIntType(), getClobType(), getBooleanType(), getBooleanType());
case DB2:
return String.format(
"BEGIN\n" +
Expand All @@ -222,8 +216,7 @@ public String getCreateTableSqlString(String tableName) {
"change_order VARCHAR(50)," +
"recovery_strategy VARCHAR(50)," +
"transaction_flag SMALLINT," +
"system_change SMALLINT," +
"legacy SMALLINT" +
"system_change SMALLINT" +
")';\n" +
"END",
tableName);
Expand Down Expand Up @@ -251,8 +244,7 @@ public String getCreateTableSqlString(String tableName) {
"change_order TEXT, " +
"recovery_strategy TEXT, " +
"transaction_flag INTEGER, " +
"system_change INTEGER, " +
"legacy INTEGER" +
"system_change INTEGER" +
")", tableName);
case INFORMIX:
return String.format(
Expand All @@ -277,8 +269,7 @@ public String getCreateTableSqlString(String tableName) {
"change_order VARCHAR(50), " +
"recovery_strategy VARCHAR(50), " +
"transaction_flag BOOLEAN, " +
"system_change BOOLEAN, " +
"legacy BOOLEAN" +
"system_change BOOLEAN" +
")", tableName);


Expand All @@ -291,16 +282,16 @@ public String getInsertSqlString(String tableName) {
return String.format(
"INSERT INTO %s (" +
"execution_id, stage_id, change_id, author, created_at, state, invoked_class, invoked_method, source_file, metadata, " +
"execution_millis, execution_hostname, error_trace, type, tx_strategy, target_system_id, change_order, recovery_strategy, transaction_flag, system_change, legacy" +
"execution_millis, execution_hostname, error_trace, type, tx_strategy, target_system_id, change_order, recovery_strategy, transaction_flag, system_change" +
") VALUES (" +
"?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?" +
"?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?" +
")", tableName);
}

public String getSelectHistorySqlString(String tableName) {
return String.format(
"SELECT execution_id, stage_id, change_id, author, created_at, state, type, invoked_class, invoked_method, source_file, " +
"execution_millis, execution_hostname, metadata, system_change, legacy, error_trace, tx_strategy, target_system_id, change_order, recovery_strategy, transaction_flag " +
"execution_millis, execution_hostname, metadata, system_change, error_trace, tx_strategy, target_system_id, change_order, recovery_strategy, transaction_flag " +
"FROM %s ORDER BY id ASC", tableName);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

public class AuditEntry implements Comparable<AuditEntry> {
protected final Boolean systemChange;
protected final boolean legacy;
private final String executionId;
private final String stageId;
//TODO move to changeId
Expand Down Expand Up @@ -59,7 +58,6 @@ public AuditEntry(String executionId,
String executionHostname,
Object metadata,
boolean systemChange,
boolean legacy,
String errorTrace,
AuditTxType txStrategy,
String targetSystemId,
Expand All @@ -84,7 +82,6 @@ public AuditEntry(String executionId,
this.targetSystemId = targetSystemId;
this.order = order;
this.systemChange = systemChange;
this.legacy = legacy;
this.recoveryStrategy = recoveryStrategy != null ? recoveryStrategy : RecoveryStrategy.MANUAL_INTERVENTION;
this.transactionFlag = transactionFlag;
}
Expand All @@ -111,7 +108,7 @@ public AuditEntry(String executionId,
String errorTrace,
AuditTxType txStrategy) {
this(executionId, stageId, taskId, author, timestamp, state, type, className, methodName, sourceFile,
executionMillis, executionHostname, metadata, systemChange, false, errorTrace, txStrategy, null, null, RecoveryStrategy.MANUAL_INTERVENTION, null);
executionMillis, executionHostname, metadata, systemChange, errorTrace, txStrategy, null, null, RecoveryStrategy.MANUAL_INTERVENTION, null);
}

/**
Expand All @@ -135,7 +132,7 @@ public AuditEntry(String executionId,
boolean systemChange,
String errorTrace) {
this(executionId, stageId, taskId, author, timestamp, state, type, className, methodName, sourceFile,
executionMillis, executionHostname, metadata, systemChange, false, errorTrace, null, null, null, RecoveryStrategy.MANUAL_INTERVENTION, null);
executionMillis, executionHostname, metadata, systemChange, errorTrace, null, null, null, RecoveryStrategy.MANUAL_INTERVENTION, null);
}

public static AuditEntry getMostRelevant(AuditEntry currentEntry, AuditEntry newEntry) {
Expand Down Expand Up @@ -204,7 +201,7 @@ public Boolean getSystemChange() {
}

public boolean isLegacy() {
return legacy;
return type != null && type.isLegacy();
}

public ChangeType getType() {
Expand Down Expand Up @@ -260,7 +257,6 @@ public AuditEntry copyWithNewIdAndStageId(String id, String stageId) {
getExecutionHostname(),
getMetadata(),
getSystemChange(),
isLegacy(),
getErrorTrace(),
getTxType(),
getTargetSystemId(),
Expand Down Expand Up @@ -328,6 +324,10 @@ public AuditEntryRequest.Status toRequestStatus() {
public enum ChangeType {
STANDARD_CODE, STANDARD_TEMPLATE, MONGOCK_EXECUTION, MONGOCK_BEFORE;

public boolean isLegacy() {
return this == MONGOCK_EXECUTION || this == MONGOCK_BEFORE;
}

public AuditEntryRequest.ChangeType toRequestExecutionType() {
return AuditEntryRequest.ChangeType.valueOf(name());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ public FixResult fixAuditIssue(String changeId, Resolution resolution) {
StringUtil.hostname(),
currentEntry.getMetadata(),//??
currentEntry.getSystemChange(),
currentEntry.isLegacy(),
"",
currentEntry.getTxType(),
currentEntry.getTargetSystemId(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ public AuditEntry toAuditEntry() {
stageExecutionContext.getHostname(),
stageExecutionContext.getMetadata(),
loadedChange.isSystem(),
loadedChange.isLegacy(),
ThrowableUtil.serialize(runtimeContext.getError().orElse(null)),
getAuditTxType(),
getTargetSystemId(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ public class AuditEntryDefinition {
private RecoveryStrategy recoveryStrategy;
private String order;
private Boolean transactional;
private boolean legacy;
private AuditEntry.ChangeType type;


Expand Down Expand Up @@ -442,17 +441,6 @@ public AuditEntryDefinition withTransactional(boolean transactional) {
return this;
}

/**
* Sets the legacy flag.
*
* @param legacy the legacy flag
* @return this builder for method chaining
*/
public AuditEntryDefinition withLegacy(boolean legacy) {
this.legacy = legacy;
return this;
}

/**
* Sets the change type.
*
Expand Down Expand Up @@ -531,7 +519,7 @@ public Boolean getTransactional() {
}

public boolean isLegacy() {
return legacy;
return type != null && type.isLegacy();
}

public AuditEntry.ChangeType getType() {
Expand Down Expand Up @@ -574,7 +562,6 @@ public AuditEntry toAuditEntry() {
executionHostname != null ? executionHostname : "test-host",
metadata,
false, // systemChange
legacy,
errorTrace,
AuditTxType.NON_TX,
targetSystemId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,6 @@ private static AuditEntry createAuditEntry(
hostname,
metadata,
false,
false,
errorTrace,
AuditTxType.NON_TX,
targetSystemId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ void shouldPassValidation_whenOptionalFieldsMatch() {
"host",
null,
false,
false,
null,
null,
"target-1",
Expand Down Expand Up @@ -245,7 +244,6 @@ void shouldFailValidation_whenOptionalFieldMismatch() {
"host",
null,
false,
false,
null,
null,
"target-1",
Expand Down Expand Up @@ -288,7 +286,6 @@ private AuditEntry createAuditEntry(String changeId, AuditEntry.Status status) {
"localhost",
null,
false,
false,
null,
null,
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ public AuditEntry toAuditEntry() {
executionHostName,
metadata,
systemChange != null && systemChange,
true,
errorTrace,
null,
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ public AuditEntry toAuditEntry() {
executionHostName,
metadata,
systemChange != null && systemChange,
true,
errorTrace,
null,
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ private static AuditEntry toAuditEntry(Document document) {
changeEntry.getExecutionHostname(),
changeEntry.getMetadata(),
changeEntry.getSystemChange(),
true,
changeEntry.getErrorTrace(),
null,
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import static io.flamingock.internal.util.constants.AuditEntryFieldConstants.KEY_TX_STRATEGY;
import static io.flamingock.internal.util.constants.AuditEntryFieldConstants.KEY_STATE;
import static io.flamingock.internal.util.constants.AuditEntryFieldConstants.KEY_SYSTEM_CHANGE;
import static io.flamingock.internal.util.constants.AuditEntryFieldConstants.KEY_LEGACY;
import static io.flamingock.internal.util.constants.AuditEntryFieldConstants.KEY_TARGET_SYSTEM_ID;
import static io.flamingock.internal.util.constants.AuditEntryFieldConstants.KEY_CREATED_AT;
import static io.flamingock.internal.util.constants.AuditEntryFieldConstants.KEY_TYPE;
Expand All @@ -62,7 +61,6 @@ public JsonObject toDocument(AuditEntry auditEntry) {
CouchbaseUtils.addFieldToDocument(document, KEY_EXECUTION_HOSTNAME, auditEntry.getExecutionHostname());
CouchbaseUtils.addFieldToDocument(document, KEY_ERROR_TRACE, auditEntry.getErrorTrace());
CouchbaseUtils.addFieldToDocument(document, KEY_SYSTEM_CHANGE, auditEntry.getSystemChange());
CouchbaseUtils.addFieldToDocument(document, KEY_LEGACY, auditEntry.isLegacy());
CouchbaseUtils.addFieldToDocument(document, KEY_TX_STRATEGY, AuditTxType.safeString(auditEntry.getTxType()));
CouchbaseUtils.addFieldToDocument(document, KEY_TARGET_SYSTEM_ID, auditEntry.getTargetSystemId());
CouchbaseUtils.addFieldToDocument(document, KEY_CHANGE_ORDER, auditEntry.getOrder());
Expand Down Expand Up @@ -97,7 +95,6 @@ public AuditEntry fromDocument(JsonObject jsonObject) {
jsonObject.getString(KEY_EXECUTION_HOSTNAME),
jsonObject.get(KEY_METADATA) != null ? jsonObject.getObject(KEY_METADATA).toMap() : null,
jsonObject.getBoolean(KEY_SYSTEM_CHANGE) != null && jsonObject.getBoolean(KEY_SYSTEM_CHANGE),
jsonObject.getBoolean(KEY_LEGACY) != null && jsonObject.getBoolean(KEY_LEGACY),
jsonObject.getString(KEY_ERROR_TRACE),
txStrategy,
jsonObject.getString(KEY_TARGET_SYSTEM_ID),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
public class AuditEntryEntity implements Comparable<AuditEntryEntity> {

protected Boolean systemChange;
protected boolean legacy;
private String partitionKey;
private String taskId;
private String stageId;
Expand Down Expand Up @@ -79,7 +78,6 @@ public AuditEntryEntity(AuditEntry auditEntry) {
this.order = auditEntry.getOrder();
this.recoveryStrategy = auditEntry.getRecoveryStrategy().name();
this.systemChange = auditEntry.getSystemChange();
this.legacy = auditEntry.isLegacy();
this.transactionFlag = auditEntry.getTransactionFlag();
}

Expand Down Expand Up @@ -235,15 +233,6 @@ public void setSystemChange(Boolean systemChange) {
this.systemChange = systemChange;
}

@DynamoDbAttribute(AuditEntryFieldConstants.KEY_LEGACY)
public boolean isLegacy() {
return legacy;
}

public void setLegacy(boolean legacy) {
this.legacy = legacy;
}

@DynamoDbAttribute(AuditEntryFieldConstants.KEY_TX_STRATEGY)
public String getTxType() {
return AuditTxType.safeString(txStrategy);
Expand Down Expand Up @@ -329,7 +318,6 @@ public AuditEntry toAuditEntry() {
executionHostname,
metadata,
systemChange,
legacy,
Objects.toString(errorTrace, ""),
txStrategy,
targetSystemId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public class AuditEntryFieldConstants {
public static final String KEY_EXECUTION_HOSTNAME = "executionHostname";
public static final String KEY_ERROR_TRACE = "errorTrace";
public static final String KEY_SYSTEM_CHANGE = "systemChange";
public static final String KEY_LEGACY = "legacy";
public static final String KEY_TX_STRATEGY = "txStrategy";
public static final String KEY_TARGET_SYSTEM_ID = "targetSystemId";
public static final String KEY_CHANGE_ORDER = "changeOrder";
Expand Down
Loading
Loading