public static void manageReverseRemove(InvocationContext ctx, NodeSPI childNode, boolean reverseRemoveCheck, List createdNodes, CommandsFactory commandsFactory)
{
if (ctx.getGlobalTransaction() != null) //if no tx then reverse remove does not make sense
{
Fqn fqn = childNode.getFqn();
TransactionContext transactionContext = ctx.getTransactionContext();
boolean needToReverseRemove = reverseRemoveCheck && childNode.isDeleted() && transactionContext != null && transactionContext.getRemovedNodes().contains(fqn);
if (!needToReverseRemove) return;
childNode.markAsDeleted(false);
//if we'll rollback the tx data should be added to the node again
Map oldData = new HashMap(childNode.getDataDirect());
PutDataMapCommand command = commandsFactory.buildPutDataMapCommand(ctx.getGlobalTransaction(), fqn, oldData);
// txTable.get(gtx).addUndoOperation(command); --- now need to make sure this is added to the normal mods list instead
transactionContext.addModification(command);
//we're prepared for rollback, now reset the node
childNode.clearDataDirect();
if (createdNodes != null)
{
createdNodes.add(childNode);