Fix su Change Tracking
This commit is contained in:
@@ -12,6 +12,7 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -174,16 +175,26 @@ public class DbmsChangeTracker {
|
||||
return result.stream()
|
||||
.map(x -> {
|
||||
DetectedChangeDataDTO detectedChangeDataDTO = new DetectedChangeDataDTO()
|
||||
.setTableName(tableName)
|
||||
.setSysChangeVersion(UtilityHashMap.getValueIfExists(x, "SYS_CHANGE_VERSION"))
|
||||
.setSysChangeCreationVersion(UtilityHashMap.getValueIfExists(x, "SYS_CHANGE_CREATION_VERSION"))
|
||||
.setSysChangeOperation(DetectedChangeDataDTO.Operation.from(UtilityHashMap.<String>getValueIfExists(x, "SYS_CHANGE_OPERATION")));
|
||||
.setTableName(tableName);
|
||||
|
||||
x.remove("SYS_CHANGE_VERSION");
|
||||
x.remove("SYS_CHANGE_CREATION_VERSION");
|
||||
x.remove("SYS_CHANGE_OPERATION");
|
||||
x.remove("SYS_CHANGE_COLUMNS");
|
||||
x.remove("SYS_CHANGE_CONTEXT");
|
||||
Long sysChangeVersion = UtilityHashMap.<Long>getValueIfExists(x, "SYS_CHANGE_VERSION");
|
||||
detectedChangeDataDTO.setSysChangeVersion(sysChangeVersion);
|
||||
|
||||
|
||||
Long sysChangeCreationVersion = UtilityHashMap.<Long>getValueIfExists(x, "SYS_CHANGE_CREATION_VERSION");
|
||||
detectedChangeDataDTO.setSysChangeCreationVersion(sysChangeCreationVersion);
|
||||
|
||||
detectedChangeDataDTO.setSysChangeOperation(DetectedChangeDataDTO.Operation.from(UtilityHashMap.<String>getValueIfExists(x, "SYS_CHANGE_OPERATION")));
|
||||
|
||||
List<String> keysToRemove = new ArrayList<>();
|
||||
for (String colName : x.keySet()) {
|
||||
if (colName.startsWith("SYS_"))
|
||||
keysToRemove.add(colName);
|
||||
}
|
||||
|
||||
for (String colName : keysToRemove) {
|
||||
x.remove(colName);
|
||||
}
|
||||
|
||||
detectedChangeDataDTO.setPrimaryKey(x);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.util.HashMap;
|
||||
public class DetectedChangeDataDTO {
|
||||
|
||||
private long sysChangeVersion;
|
||||
private long sysChangeCreationVersion;
|
||||
private Long sysChangeCreationVersion;
|
||||
private Operation sysChangeOperation;
|
||||
|
||||
private String tableName;
|
||||
@@ -24,11 +24,11 @@ public class DetectedChangeDataDTO {
|
||||
return this;
|
||||
}
|
||||
|
||||
public long getSysChangeCreationVersion() {
|
||||
public Long getSysChangeCreationVersion() {
|
||||
return sysChangeCreationVersion;
|
||||
}
|
||||
|
||||
public DetectedChangeDataDTO setSysChangeCreationVersion(long sysChangeCreationVersion) {
|
||||
public DetectedChangeDataDTO setSysChangeCreationVersion(Long sysChangeCreationVersion) {
|
||||
this.sysChangeCreationVersion = sysChangeCreationVersion;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@ import it.integry.ems_model.entity.WtbGestSetupUser;
|
||||
import it.integry.ems_model.exception.DataConverterNotFoundException;
|
||||
import it.integry.ems_model.utility.UtilityDB;
|
||||
import it.integry.ems_model.utility.UtilityQuery;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -34,6 +36,8 @@ import java.util.stream.Collectors;
|
||||
@Component
|
||||
public class EntityCacheComponent implements ApplicationListener {
|
||||
|
||||
private final Logger logger = LogManager.getLogger();
|
||||
|
||||
private final DbmsChangeTrackerComponent dbmsChangeTrackerComponent;
|
||||
private final EntityPropertyHolder entityPropertyHolder;
|
||||
|
||||
@@ -67,6 +71,11 @@ public class EntityCacheComponent implements ApplicationListener {
|
||||
|
||||
ConcurrentHashMap<HashMap<String, Object>, EntityBase> entities = retrieveEntityList(conn, tableName, clazz);
|
||||
entityCache.get(customerDB).put(tableName, entities);
|
||||
|
||||
logger.trace(String.format("[%s] Cached %d records for entity %s",
|
||||
customerDB.getValue(),
|
||||
entities.size(),
|
||||
clazz.getSimpleName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user