Cleaned up a seriously unnecessary ugliness.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4378 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2006-11-17 00:57:31 +00:00
parent 4287b291d4
commit 992bd82b9e
3 changed files with 14 additions and 19 deletions

View File

@@ -252,11 +252,11 @@ public class AVMServiceTest extends AVMServiceTestBase
final ActionImpl action = new ActionImpl(null, final ActionImpl action = new ActionImpl(null,
GUID.generate(), GUID.generate(),
AVMRevertListAction.NAME); AVMRevertListAction.NAME);
VersionPathStuffer stuffer = new VersionPathStuffer(); List<Pair<Integer, String>> versionPaths =
stuffer.add(-1, "area:/a/b"); new ArrayList<Pair<Integer, String>>();
String nodeList = stuffer.toString(); versionPaths.add(new Pair<Integer, String>(-1, "area:/a/b"));
action.setParameterValue(AVMRevertListAction.PARAM_VERSION, fService.getLatestSnapshotID("area")); action.setParameterValue(AVMRevertListAction.PARAM_VERSION, fService.getLatestSnapshotID("area"));
action.setParameterValue(AVMRevertListAction.PARAM_NODE_LIST, nodeList); action.setParameterValue(AVMRevertListAction.PARAM_NODE_LIST, (Serializable)versionPaths);
action.setParameterValue(AVMRevertListAction.PARAM_FLATTEN, true); action.setParameterValue(AVMRevertListAction.PARAM_FLATTEN, true);
action.setParameterValue(AVMRevertListAction.PARAM_STORE, "area"); action.setParameterValue(AVMRevertListAction.PARAM_STORE, "area");
action.setParameterValue(AVMRevertListAction.PARAM_STAGING, "main"); action.setParameterValue(AVMRevertListAction.PARAM_STAGING, "main");
@@ -304,10 +304,10 @@ public class AVMServiceTest extends AVMServiceTestBase
final ActionImpl action = new ActionImpl(null, final ActionImpl action = new ActionImpl(null,
GUID.generate(), GUID.generate(),
AVMUndoSandboxListAction.NAME); AVMUndoSandboxListAction.NAME);
VersionPathStuffer stuffer = new VersionPathStuffer(); List<Pair<Integer, String>> versionPaths =
stuffer.add(-1, "area:/a/b/c/bar"); new ArrayList<Pair<Integer, String>>();
String nodeList = stuffer.toString(); versionPaths.add(new Pair<Integer, String>(-1, "area:/a/b/c/bar"));
action.setParameterValue(AVMUndoSandboxListAction.PARAM_NODE_LIST, nodeList); action.setParameterValue(AVMUndoSandboxListAction.PARAM_NODE_LIST, (Serializable)versionPaths);
final AVMUndoSandboxListAction revert = (AVMUndoSandboxListAction)fContext.getBean("avm-undo-list"); final AVMUndoSandboxListAction revert = (AVMUndoSandboxListAction)fContext.getBean("avm-undo-list");
class TxnWork implements TransactionUtil.TransactionWork<Object> class TxnWork implements TransactionUtil.TransactionWork<Object>
{ {

View File

@@ -8,7 +8,6 @@ import java.util.List;
import org.alfresco.repo.action.ParameterDefinitionImpl; import org.alfresco.repo.action.ParameterDefinitionImpl;
import org.alfresco.repo.action.executer.ActionExecuterAbstractBase; import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
import org.alfresco.repo.avm.util.VersionPathUnstuffer;
import org.alfresco.service.cmr.action.Action; import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.action.ParameterDefinition; import org.alfresco.service.cmr.action.ParameterDefinition;
import org.alfresco.service.cmr.avmsync.AVMDifference; import org.alfresco.service.cmr.avmsync.AVMDifference;
@@ -62,9 +61,8 @@ public class AVMRevertListAction extends ActionExecuterAbstractBase
protected void executeImpl(Action action, NodeRef actionedUponNodeRef) protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
{ {
int revertVersion = (Integer)action.getParameterValue(PARAM_VERSION); int revertVersion = (Integer)action.getParameterValue(PARAM_VERSION);
String packedNodes = (String)action.getParameterValue(PARAM_NODE_LIST); List<Pair<Integer, String>> versionPaths =
VersionPathUnstuffer unstuffer = new VersionPathUnstuffer(packedNodes); (List<Pair<Integer, String>>)action.getParameterValue(PARAM_NODE_LIST);
List<Pair<Integer, String>> versionPaths = unstuffer.getVersionPaths();
List<AVMDifference> diffs = new ArrayList<AVMDifference>(); List<AVMDifference> diffs = new ArrayList<AVMDifference>();
for (Pair<Integer, String> item : versionPaths) for (Pair<Integer, String> item : versionPaths)
{ {
@@ -99,7 +97,7 @@ public class AVMRevertListAction extends ActionExecuterAbstractBase
getParamDisplayLabel(PARAM_VERSION))); getParamDisplayLabel(PARAM_VERSION)));
paramList.add( paramList.add(
new ParameterDefinitionImpl(PARAM_NODE_LIST, new ParameterDefinitionImpl(PARAM_NODE_LIST,
DataTypeDefinition.TEXT, DataTypeDefinition.ANY,
true, true,
getParamDisplayLabel(PARAM_NODE_LIST))); getParamDisplayLabel(PARAM_NODE_LIST)));
paramList.add( paramList.add(

View File

@@ -8,12 +8,10 @@ import java.util.List;
import org.alfresco.repo.action.ParameterDefinitionImpl; import org.alfresco.repo.action.ParameterDefinitionImpl;
import org.alfresco.repo.action.executer.ActionExecuterAbstractBase; import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
import org.alfresco.repo.avm.AVMNodeConverter; import org.alfresco.repo.avm.AVMNodeConverter;
import org.alfresco.repo.avm.util.VersionPathUnstuffer;
import org.alfresco.service.cmr.action.Action; import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.action.ParameterDefinition; import org.alfresco.service.cmr.action.ParameterDefinition;
import org.alfresco.service.cmr.avm.AVMNodeDescriptor; import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
import org.alfresco.service.cmr.avm.AVMService; import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.avmsync.AVMSyncService;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition; import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.util.Pair; import org.alfresco.util.Pair;
@@ -49,9 +47,8 @@ public class AVMUndoSandboxListAction extends ActionExecuterAbstractBase
@Override @Override
protected void executeImpl(Action action, NodeRef actionedUponNodeRef) protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
{ {
String packedNodes = (String)action.getParameterValue(PARAM_NODE_LIST); List<Pair<Integer, String>> versionPaths =
VersionPathUnstuffer unstuffer = new VersionPathUnstuffer(packedNodes); (List<Pair<Integer, String>>)action.getParameterValue(PARAM_NODE_LIST);
List<Pair<Integer, String>> versionPaths = unstuffer.getVersionPaths();
for (Pair<Integer, String> item : versionPaths) for (Pair<Integer, String> item : versionPaths)
{ {
AVMNodeDescriptor desc = fAVMService.lookup(-1, item.getSecond(), true); AVMNodeDescriptor desc = fAVMService.lookup(-1, item.getSecond(), true);
@@ -80,7 +77,7 @@ public class AVMUndoSandboxListAction extends ActionExecuterAbstractBase
{ {
paramList.add( paramList.add(
new ParameterDefinitionImpl(PARAM_NODE_LIST, new ParameterDefinitionImpl(PARAM_NODE_LIST,
DataTypeDefinition.TEXT, DataTypeDefinition.ANY,
true, true,
getParamDisplayLabel(PARAM_NODE_LIST))); getParamDisplayLabel(PARAM_NODE_LIST)));
} }