Skip to content

Commit

Permalink
delete all if the excludes list is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerjmchugh committed Jan 21, 2025
1 parent f4890d5 commit 7eb1d0d
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,18 @@ public void deleteMetadataOper(String metadataId, boolean skipAllReservedGroup)
/**
* Removes all operations stored for a metadata except for the operations of the groups in the exclude list.
* Used for preventing deletion of operations for reserved and restricted groups.
* If groupIdsToExclude is null or empty, all operations are deleted.
*
* @param metadataId Metadata identifier
* @param groupIdsToExclude List of group ids to exclude from deletion
*/
@Override
public void deleteMetadataOper(String metadataId, List<Integer> groupIdsToExclude) {
opAllowedRepo.deleteAllByMetadataIdExceptGroupId(Integer.parseInt(metadataId), groupIdsToExclude);
if (groupIdsToExclude == null || groupIdsToExclude.isEmpty()) {
opAllowedRepo.deleteAllByMetadataId(Integer.parseInt(metadataId));
} else {
opAllowedRepo.deleteAllByMetadataIdExceptGroupId(Integer.parseInt(metadataId), groupIdsToExclude);
}
}

/**
Expand Down

0 comments on commit 7eb1d0d

Please sign in to comment.