diff --git a/config/alfresco/action-services-context.xml b/config/alfresco/action-services-context.xml
index db79de5922..cd131c9bd6 100644
--- a/config/alfresco/action-services-context.xml
+++ b/config/alfresco/action-services-context.xml
@@ -444,4 +444,13 @@
false
+
+
+
+
+
+
+ false
+
+
diff --git a/config/alfresco/messages/action-config.properties b/config/alfresco/messages/action-config.properties
index 4f51e5c6fb..4f1cf4e20a 100644
--- a/config/alfresco/messages/action-config.properties
+++ b/config/alfresco/messages/action-config.properties
@@ -107,6 +107,10 @@ avm-revert-list.store.display-label=The name of the store being reverted, only n
avm-revert-list.staging.display-label=The name of the staging store to flatten to.
avm-revert-list.flatten-path.display-label=The store relative path that should be flattened.
+avm-undo-list.title=Make a list of Nodes in a store transparent to staging.
+avm-undo-list.description=This acts as a mistake eraser for a user's sandbox.
+avm-undo-list.node-list.display-label=The string encoded list of nodes to revert.
+
start-avm-workflow.title=Start a WCM Workflow
start-avm-workflow.description=Starts a workflow expecting an AVM workflow package
start-avm-workflow.store-name.display-label=Store name for start task
diff --git a/source/java/org/alfresco/repo/avm/AVMServiceImpl.java b/source/java/org/alfresco/repo/avm/AVMServiceImpl.java
index 60b3bcf089..788a815564 100644
--- a/source/java/org/alfresco/repo/avm/AVMServiceImpl.java
+++ b/source/java/org/alfresco/repo/avm/AVMServiceImpl.java
@@ -439,6 +439,21 @@ public class AVMServiceImpl implements AVMService
fAVMRepository.uncover(dirPath, name);
}
+ /**
+ * Make name in dirPath transparent to what was underneath it. That is, this
+ * removes the offending node from its layered directory parent's direct ownership.
+ * @param dirPath The path to the layered directory.
+ * @param name The name of the item to flatten.
+ */
+ public void flatten(String dirPath, String name)
+ {
+ if (dirPath == null || name == null)
+ {
+ throw new AVMBadArgumentException("Illegal null argument.");
+ }
+ fAVMRepository.flatten(dirPath, name);
+ }
+
/**
* Get the Latest Version ID for an AVMStore.
* @param repName The name of the AVMStore.
diff --git a/source/java/org/alfresco/repo/avm/AVMServiceTest.java b/source/java/org/alfresco/repo/avm/AVMServiceTest.java
index 941f3dee04..d2d94fd11c 100644
--- a/source/java/org/alfresco/repo/avm/AVMServiceTest.java
+++ b/source/java/org/alfresco/repo/avm/AVMServiceTest.java
@@ -34,6 +34,7 @@ import org.alfresco.model.ContentModel;
import org.alfresco.model.WCMModel;
import org.alfresco.repo.action.ActionImpl;
import org.alfresco.repo.avm.actions.AVMRevertListAction;
+import org.alfresco.repo.avm.actions.AVMUndoSandboxListAction;
import org.alfresco.repo.avm.actions.SimpleAVMPromoteAction;
import org.alfresco.repo.avm.actions.SimpleAVMSubmitAction;
import org.alfresco.repo.avm.util.BulkLoader;
@@ -282,6 +283,53 @@ public class AVMServiceTest extends AVMServiceTestBase
fail();
}
}
+
+ /**
+ * Test the undo list action.
+ */
+ public void testUndoListAction()
+ {
+ try
+ {
+ setupBasicTree();
+ fService.createAVMStore("area");
+ fService.createLayeredDirectory("main:/a", "area:/", "a");
+ fService.getFileOutputStream("area:/a/b/c/foo").close();
+ List diffs = fSyncService.compare(-1, "area:/a", -1, "main:/a");
+ assertEquals(1, diffs.size());
+ fSyncService.update(diffs, false, false, false, false, null, null);
+ fService.getFileOutputStream("area:/a/b/c/bar").close();
+ diffs = fSyncService.compare(-1, "area:/a", -1, "main:/a");
+ assertEquals(1, diffs.size());
+ final ActionImpl action = new ActionImpl(null,
+ GUID.generate(),
+ AVMUndoSandboxListAction.NAME);
+ VersionPathStuffer stuffer = new VersionPathStuffer();
+ stuffer.add(-1, "area:/a/b/c/bar");
+ String nodeList = stuffer.toString();
+ action.setParameterValue(AVMUndoSandboxListAction.PARAM_NODE_LIST, nodeList);
+ final AVMUndoSandboxListAction revert = (AVMUndoSandboxListAction)fContext.getBean("avm-undo-list");
+ class TxnWork implements TransactionUtil.TransactionWork