Github user joewitt commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/1564#discussion_r104316405
  
    --- Diff: 
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ScanAttribute.java
 ---
    @@ -207,36 +253,62 @@ public void onTrigger(final ProcessContext context, 
final ProcessSession session
     
             final boolean matchAll = 
context.getProperty(MATCHING_CRITERIA).getValue().equals(MATCH_CRITERIA_ALL);
     
    -        for (final FlowFile flowFile : flowFiles) {
    -            final boolean matched = matchAll ? allMatch(flowFile, 
attributePattern, dictionaryTerms) : anyMatch(flowFile, attributePattern, 
dictionaryTerms);
    -            final Relationship relationship = matched ? REL_MATCHED : 
REL_UNMATCHED;
    +        for  (FlowFile flowFile : flowFiles) {
    +            final Map<String,String> matched = (matchAll ? 
matchAll(flowFile, attributePattern, dictionaryTerms) : matchAny(flowFile, 
attributePattern, dictionaryTerms));
    +            flowFile = session.putAllAttributes(flowFile, matched);
    +
    +            final Relationship relationship = (((matched.size() == 
(attributeNameMatches.size() * 3) && matchAll) || (matched.size() > 0 && 
!matchAll))) ? REL_MATCHED : REL_UNMATCHED;
                 session.getProvenanceReporter().route(flowFile, relationship);
                 session.transfer(flowFile, relationship);
                 logger.info("Transferred {} to {}", new Object[]{flowFile, 
relationship});
             }
         }
     
    -    private boolean allMatch(final FlowFile flowFile, final Pattern 
attributePattern, final Set<String> dictionary) {
    -        for (final Map.Entry<String, String> entry : 
flowFile.getAttributes().entrySet()) {
    -            if (attributePattern == null || 
attributePattern.matcher(entry.getKey()).matches()) {
    -                if (!dictionary.contains(entry.getValue())) {
    -                    return false;
    +    private Map<String,String> matchAny(final FlowFile flowFile, final 
Pattern attributePattern, final Map<String,String> dictionary) {
    +        Map<String,String> dictionaryTermMatches = new 
HashMap<String,String>();
    --- End diff --
    
    please use diamond operator 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to