[Fix] Add Regex for Entity FQn matches (#14946)

* Add Regex for Entity FQn matches

* Removing Reports app to be installed by default
This commit is contained in:
Mohit Yadav 2024-01-30 15:15:55 +05:30 committed by GitHub
parent 78c33317b2
commit 5940d7219a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 15 deletions

View File

@ -190,9 +190,9 @@ public final class AlertUtil {
List<String> resource,
CreateEventSubscription.AlertType alertType,
AlertFilteringInput input) {
if (resource.size() > 1) {
if (resource.size() != 1) {
throw new BadRequestException(
"Only one resource can be specified. Multiple resources are not supported.");
"One resource can be specified. Zero or Multiple resources are not supported.");
}
if (alertType.equals(CreateEventSubscription.AlertType.NOTIFICATION)) {

View File

@ -15,6 +15,8 @@ import static org.openmetadata.service.Entity.USER;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import lombok.extern.slf4j.Slf4j;
import org.openmetadata.schema.EntityInterface;
import org.openmetadata.schema.Function;
@ -134,7 +136,9 @@ public class AlertsRuleEvaluator {
EntityInterface entity = getEntity(changeEvent);
for (String name : entityNames) {
if (entity.getFullyQualifiedName().equals(name)) {
Pattern pattern = Pattern.compile(name);
Matcher matcher = pattern.matcher(entity.getFullyQualifiedName());
if (matcher.find()) {
return true;
}
}
@ -249,7 +253,9 @@ public class AlertsRuleEvaluator {
EntityInterface entity = getEntity(changeEvent);
for (String name : tableNameList) {
if (entity.getFullyQualifiedName().contains(name)) {
Pattern pattern = Pattern.compile(name);
Matcher matcher = pattern.matcher(entity.getFullyQualifiedName());
if (matcher.find()) {
return true;
}
}

View File

@ -1,11 +0,0 @@
{
"name": "DataInsightsReportApplication",
"displayName": "Data Insights Report",
"appConfiguration": {
"sendToAdmins": true,
"sendToTeams": true
},
"appSchedule": {
"scheduleType": "Weekly"
}
}