@Override
public void replaceAttributes(Attributes oldAttributes, Attributes newAttributes) {
Component component =
MessageFactoryHelper.createDocumentOperationComponent();
ReplaceAttributes replace =
MessageFactoryHelper.createDocumentReplaceAttributes();
if (oldAttributes.isEmpty() && newAttributes.isEmpty()) {
replace.setEmpty(true);
} else {
for (Map.Entry<String, String> e : oldAttributes.entrySet()) {
replace.addOldAttribute(createKeyValuePair(e.getKey(), e.getValue()));
}
for (Map.Entry<String, String> e : newAttributes.entrySet()) {
replace.addNewAttribute(createKeyValuePair(e.getKey(), e.getValue()));
}
}
component.setReplaceAttributes(replace);
mutation.addComponent(component);
}