214 | | // if both are new, select the one with all the DB nodes |
215 | | boolean areNewNodes = false; |
216 | | for (Node n : selection.get(0).getNodes()) { |
217 | | if (n.isNew()) { |
218 | | areNewNodes = true; |
219 | | } |
220 | | } |
221 | | idxNew = areNewNodes ? 0 : 1; |
222 | | overrideNewCheck = true; |
223 | | for (Node n : selection.get(1 - idxNew).getNodes()) { |
224 | | if (n.isNew()) { |
225 | | overrideNewCheck = false; |
226 | | } |
227 | | } |
| 214 | // if both are new, select the one with DB nodes if the other has none |
| 215 | boolean hasOldS0 = selection.get(0).getNodes().stream().anyMatch(n->!n.isNew()); |
| 216 | boolean hasOldS1 = selection.get(1).getNodes().stream().anyMatch(n->!n.isNew()); |
| 217 | if (hasOldS0 != hasOldS1) { |
| 218 | overrideNewCheck = true; |
| 219 | if (hasOldS0) { |
| 220 | idxNew = 1; |
| 221 | } |
| 222 | } |