solve the issue for mutually exclusive tags validation for PUT API (#11428)

* solve the issue for mutually exclusive tags validation for PUT API

* checkstyle

---------

Co-authored-by: Himank Mehta <himankmehta@Himanks-MacBook-Air.local>
This commit is contained in:
07Himank 2023-05-08 15:06:42 +05:30 committed by GitHub
parent 2c9ba537eb
commit 9d61d63ce4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1453,14 +1453,15 @@ public abstract class EntityRepository<T extends EntityInterface> {
return; // Nothing to update
}
// Remove current entity tags in the database. It will be added back later from the merged tag list.
daoCollection.tagUsageDAO().deleteTagsByTarget(fqn);
if (operation.isPut()) {
// PUT operation merges tags in the request with what already exists
EntityUtil.mergeTags(updatedTags, origTags);
checkMutuallyExclusive(updatedTags);
}
// Remove current entity tags in the database. It will be added back later from the merged tag list.
daoCollection.tagUsageDAO().deleteTagsByTarget(fqn);
List<TagLabel> addedTags = new ArrayList<>();
List<TagLabel> deletedTags = new ArrayList<>();
recordListChange(fieldName, origTags, updatedTags, addedTags, deletedTags, tagLabelMatch);