mirror of https://github.com/apache/nifi.git
NIFI-496: Only update the updatedAttributes map if a value is changed
This commit is contained in:
parent
abd279c1e0
commit
e8fde85914
|
@ -116,12 +116,23 @@ public class StandardRepositoryRecord implements RepositoryRecord {
|
||||||
|
|
||||||
public void setWorking(final FlowFileRecord flowFile, final String attributeKey, final String attributeValue) {
|
public void setWorking(final FlowFileRecord flowFile, final String attributeKey, final String attributeValue) {
|
||||||
workingFlowFileRecord = flowFile;
|
workingFlowFileRecord = flowFile;
|
||||||
|
|
||||||
|
// 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);
|
updatedAttributes.put(attributeKey, attributeValue);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setWorking(final FlowFileRecord flowFile, final Map<String, String> updatedAttribs) {
|
public void setWorking(final FlowFileRecord flowFile, final Map<String, String> updatedAttribs) {
|
||||||
workingFlowFileRecord = flowFile;
|
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
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue