NIFI-496: Only update the updatedAttributes map if a value is changed

This commit is contained in:
Mark Payne 2015-04-09 09:31:20 -04:00
parent abd279c1e0
commit e8fde85914
1 changed files with 13 additions and 2 deletions

View File

@ -116,12 +116,23 @@ public class StandardRepositoryRecord implements RepositoryRecord {
public void setWorking(final FlowFileRecord flowFile, final String attributeKey, final String attributeValue) {
workingFlowFileRecord = flowFile;
updatedAttributes.put(attributeKey, attributeValue);
// If setting attribute to same value as original, don't add to updated attributes
final String currentValue = originalAttributes.get(attributeKey);
if ( currentValue == null || !currentValue.equals(attributeValue) ) {
updatedAttributes.put(attributeKey, attributeValue);
}
}
public void setWorking(final FlowFileRecord flowFile, final Map<String, String> updatedAttribs) {
workingFlowFileRecord = flowFile;
updatedAttributes.putAll(updatedAttribs);
for ( final Map.Entry<String, String> entry : updatedAttribs.entrySet() ) {
final String currentValue = originalAttributes.get(entry.getKey());
if ( currentValue == null || !currentValue.equals(entry.getValue()) ) {
updatedAttributes.put(entry.getKey(), entry.getValue());
}
}
}
@Override