summaryrefslogtreecommitdiffstats
path: root/v3po/translate-impl/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'v3po/translate-impl/src/main/java')
-rw-r--r--v3po/translate-impl/src/main/java/io/fd/honeycomb/v3po/translate/impl/write/CompositeListWriter.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/v3po/translate-impl/src/main/java/io/fd/honeycomb/v3po/translate/impl/write/CompositeListWriter.java b/v3po/translate-impl/src/main/java/io/fd/honeycomb/v3po/translate/impl/write/CompositeListWriter.java
index de1ac39d3..fe9e8d5e3 100644
--- a/v3po/translate-impl/src/main/java/io/fd/honeycomb/v3po/translate/impl/write/CompositeListWriter.java
+++ b/v3po/translate-impl/src/main/java/io/fd/honeycomb/v3po/translate/impl/write/CompositeListWriter.java
@@ -138,6 +138,16 @@ public class CompositeListWriter<D extends DataObject & Identifiable<K>, K exten
final Map<Object, D> dataBefore = listOfIdentifiableToMap(customizer.extract(currentId, parentDataBefore));
final Map<Object, D> dataAfter = listOfIdentifiableToMap(customizer.extract(currentId, parentDataAfter));
+ // The order of delete/write/update operations can have side-effects for devices like VPP
+ // TODO make it configurable
+
+ // First perform delete:
+ for (Object deletedNodeKey : Sets.difference(dataBefore.keySet(), dataAfter.keySet())) {
+ final D deleted = dataBefore.get(deletedNodeKey);
+ deleteCurrent(currentId, deleted, ctx);
+ }
+
+ // Then write/update:
for (Map.Entry<Object, D> after : dataAfter.entrySet()) {
final D before = dataBefore.get(after.getKey());
if(before == null) {
@@ -147,12 +157,6 @@ public class CompositeListWriter<D extends DataObject & Identifiable<K>, K exten
}
}
- // Delete the rest in dataBefore
- for (Object deletedNodeKey : Sets.difference(dataBefore.keySet(), dataAfter.keySet())) {
- final D deleted = dataBefore.get(deletedNodeKey);
- deleteCurrent(currentId, deleted, ctx);
- }
-
}
@Override