for (NodeInfoExt node : adds) {
System.out.println("add: " + pathString(node));
// Edit session doesn't care.
// Broadcast to clients.
MutationImpl mutation =
MutationImpl.make().setMutationType(Mutation.Type.ADD).setNewPath(pathString(node));
/*
* Do not strip the node; in the case of a newly scanned directory (e.g. recursive copy), its
* children to not get their own mutations, it's just a single tree.
*/
mutation.setNewNodeInfo((TreeNodeInfoImpl) node);
broadcast.getMutations().add(mutation);
}
for (NodeInfoExt node : removes) {
System.out.println("del: " + pathString(node));
// Edit session wants deletes.
messageDelete.addString(node.getFileEditSessionKey());
// Broadcast to clients.
MutationImpl mutation =
MutationImpl.make().setMutationType(Mutation.Type.DELETE).setOldPath(pathString(node));
broadcast.getMutations().add(mutation);
}
for (ExpectedMove move : completedMoves) {
System.out.println("mov: " + pathString(move.oldNode) + " to: " + pathString(move.newNode));
// Edit session doesn't care.
// Broadcast to clients.
MutationImpl mutation = MutationImpl.make()
.setMutationType(Mutation.Type.MOVE).setNewPath(pathString(move.newNode))
.setOldPath(pathString(move.oldNode));
// Strip the node; the client should already have the children.
mutation.setNewNodeInfo(stripChildren(move.newNode));
broadcast.getMutations().add(mutation);
}
for (NodeInfoExt node : modifies) {
System.out.println("mod: " + pathString(node));
// Edit session wants modifies.