Skip to content

Commit

Permalink
Support ObjectName patterns in excludeObjectNameAttributes
Browse files Browse the repository at this point in the history
Signed-off-by: kgedminas <kgedminas@eisgroup.com>
  • Loading branch information
kgedminas committed Dec 5, 2023
1 parent 8e4e62f commit d91e138
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,23 @@ public void add(ObjectName objectName, String attributeName) {
public boolean exclude(ObjectName objectName, String attributeName) {
boolean result = false;

// concrete objectName definition gets precedence
if (excludeObjectNameAttributesMap.size() > 0) {
Set<String> attributeNameSet = excludeObjectNameAttributesMap.get(objectName);
if (attributeNameSet != null) {
result = attributeNameSet.contains(attributeName);
return attributeNameSet.contains(attributeName);
}
}
for (Map.Entry<ObjectName, Set<String>> objectNameSetEntry :
excludeObjectNameAttributesMap.entrySet()) {
if (objectNameSetEntry.getKey().isPattern()
&& objectNameSetEntry.getKey().apply(objectName)) {
// if exclusion found - return
// otherwise keep searching as checked object may match multiple patterns
// and checked attribute may be defined only under one of them
if (objectNameSetEntry.getValue().contains(attributeName)) {
return true;
}
}
}

Expand Down

0 comments on commit d91e138

Please sign in to comment.