mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-04 07:08:09 +00:00
This commit is contained in:
parent
369b8c3b31
commit
170cb529ea
@ -257,6 +257,11 @@ public final class ChangeEventParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static String getUpdateMessage(String updatedField, Object oldValue, Object newValue) {
|
private static String getUpdateMessage(String updatedField, Object oldValue, Object newValue) {
|
||||||
|
// New value should not be null in any case for an update
|
||||||
|
if (newValue == null) {
|
||||||
|
return StringUtils.EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
if (oldValue == null || oldValue.toString().isEmpty()) {
|
if (oldValue == null || oldValue.toString().isEmpty()) {
|
||||||
return String.format("Updated **%s** to %s", updatedField, getFieldValue(newValue));
|
return String.format("Updated **%s** to %s", updatedField, getFieldValue(newValue));
|
||||||
} else if (updatedField.contains("tags") || updatedField.contains("owner")) {
|
} else if (updatedField.contains("tags") || updatedField.contains("owner")) {
|
||||||
@ -265,6 +270,7 @@ public final class ChangeEventParser {
|
|||||||
// if old value is not empty, and is of type array or object, the updates can be across multiple keys
|
// if old value is not empty, and is of type array or object, the updates can be across multiple keys
|
||||||
// Example: [{name: "col1", dataType: "varchar", dataLength: "20"}]
|
// Example: [{name: "col1", dataType: "varchar", dataLength: "20"}]
|
||||||
|
|
||||||
|
if (!newValue.toString().isEmpty()) {
|
||||||
try {
|
try {
|
||||||
// Check if field value is a json string
|
// Check if field value is a json string
|
||||||
JsonValue newJson = JsonUtils.readJson(newValue.toString());
|
JsonValue newJson = JsonUtils.readJson(newValue.toString());
|
||||||
@ -292,10 +298,11 @@ public final class ChangeEventParser {
|
|||||||
return getObjectUpdateMessage(updatedField, oldJsonObject, newJsonObject);
|
return getObjectUpdateMessage(updatedField, oldJsonObject, newJsonObject);
|
||||||
}
|
}
|
||||||
} catch (JsonParsingException ex) {
|
} catch (JsonParsingException ex) {
|
||||||
// update is of String type
|
// update is of type String
|
||||||
return getPlainTextUpdateMessage(updatedField, oldValue.toString(), newValue.toString());
|
// ignore this exception and process update message for plain text
|
||||||
}
|
}
|
||||||
return StringUtils.EMPTY;
|
}
|
||||||
|
return getPlainTextUpdateMessage(updatedField, oldValue.toString(), newValue.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String getPlaintextDiff(String oldValue, String newValue) {
|
private static String getPlaintextDiff(String oldValue, String newValue) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user