Skip to content

Commit

Permalink
task: Rename eventProperty to eventField [DHIS2-18549]
Browse files Browse the repository at this point in the history
  • Loading branch information
muilpp committed Dec 3, 2024
1 parent a94ac7f commit 43ee250
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public Set<Pair<String, Class<?>>> getFilterableFields() {
}

private <T> void logIfChanged(
String fieldName,
String field,
Function<Event, T> valueExtractor,
Function<T, String> formatter,
Event currentEvent,
Expand All @@ -148,27 +148,27 @@ private <T> void logIfChanged(

EventChangeLog eventChangeLog =
new EventChangeLog(
event, null, fieldName, currentValue, newValue, changeLogType, new Date(), userName);
event, null, field, currentValue, newValue, changeLogType, new Date(), userName);

hibernateEventChangeLogStore.addEventChangeLog(eventChangeLog);
}
}

private ChangeLogType getChangeLogType(String oldValue, String newValue) {
if (isNewField(oldValue, newValue)) {
if (isFieldCreated(oldValue, newValue)) {
return ChangeLogType.CREATE;
} else if (isUpdateField(oldValue, newValue)) {
} else if (isFieldUpdated(oldValue, newValue)) {
return ChangeLogType.UPDATE;
} else {
return ChangeLogType.DELETE;
}
}

private boolean isNewField(String originalValue, String payloadValue) {
private boolean isFieldCreated(String originalValue, String payloadValue) {
return originalValue == null && payloadValue != null;
}

private boolean isUpdateField(String originalValue, String payloadValue) {
private boolean isFieldUpdated(String originalValue, String payloadValue) {
return originalValue != null && payloadValue != null;
}

Expand Down

0 comments on commit 43ee250

Please sign in to comment.