Minor : Fix enum cleanup not triggering when all enum keys are removed (#21258)

This commit is contained in:
sonika-shah 2025-05-18 19:55:46 +05:30 committed by GitHub
parent 7a73598a93
commit b61cdd940d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -443,30 +443,30 @@ public class TypeRepository extends EntityRepository<Type> {
String fieldName = getCustomField(origProperty, "customPropertyConfig");
if (previous == null || !previous.getVersion().equals(updated.getVersion())) {
validatePropertyConfigUpdate(entity, origProperty, updatedProperty);
}
if (recordChange(
fieldName,
origProperty.getCustomPropertyConfig(),
updatedProperty.getCustomPropertyConfig())) {
String customPropertyFQN =
getCustomPropertyFQN(entity.getName(), updatedProperty.getName());
EntityReference propertyType =
updatedProperty.getPropertyType(); // Don't store entity reference
String customPropertyJson = JsonUtils.pojoToJson(updatedProperty.withPropertyType(null));
updatedProperty.withPropertyType(propertyType); // Restore entity reference
daoCollection
.fieldRelationshipDAO()
.upsert(
customPropertyFQN,
updatedProperty.getPropertyType().getName(),
customPropertyFQN,
updatedProperty.getPropertyType().getName(),
Entity.TYPE,
Entity.TYPE,
Relationship.HAS.ordinal(),
"customProperty",
customPropertyJson);
postUpdateCustomPropertyConfig(entity, origProperty, updatedProperty);
if (recordChange(
fieldName,
origProperty.getCustomPropertyConfig(),
updatedProperty.getCustomPropertyConfig())) {
String customPropertyFQN =
getCustomPropertyFQN(entity.getName(), updatedProperty.getName());
EntityReference propertyType =
updatedProperty.getPropertyType(); // Don't store entity reference
String customPropertyJson = JsonUtils.pojoToJson(updatedProperty.withPropertyType(null));
updatedProperty.withPropertyType(propertyType); // Restore entity reference
daoCollection
.fieldRelationshipDAO()
.upsert(
customPropertyFQN,
updatedProperty.getPropertyType().getName(),
customPropertyFQN,
updatedProperty.getPropertyType().getName(),
Entity.TYPE,
Entity.TYPE,
Relationship.HAS.ordinal(),
"customProperty",
customPropertyJson);
postUpdateCustomPropertyConfig(entity, origProperty, updatedProperty);
}
}
}
@ -505,7 +505,7 @@ public class TypeRepository extends EntityRepository<Type> {
HashSet<String> addedKeys = new HashSet<>(updatedKeys);
addedKeys.removeAll(origKeys);
if (!removedKeys.isEmpty() && addedKeys.isEmpty()) {
if (!removedKeys.isEmpty()) {
List<String> removedEnumKeys = new ArrayList<>(removedKeys);
try {