Revert to Snapshot action for Staging Area Snapshot panel

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4414 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2006-11-21 18:34:56 +00:00
parent 8fbaca99b9
commit dfa9efadbf

View File

@@ -50,6 +50,11 @@ import org.springframework.web.jsf.FacesContextUtils;
*/ */
public class UISandboxSnapshots extends SelfRenderingComponent public class UISandboxSnapshots extends SelfRenderingComponent
{ {
private static final String ACT_SNAPSHOT_PREVIEW = "snapshot_preview";
private static final String ACT_SNAPSHOT_REVERT = "snapshot_revert";
private static final String REQUEST_SNAPVERSION = "_snapVer";
private static Log logger = LogFactory.getLog(UISandboxSnapshots.class); private static Log logger = LogFactory.getLog(UISandboxSnapshots.class);
// snapshot date filters // snapshot date filters
@@ -192,6 +197,7 @@ public class UISandboxSnapshots extends SelfRenderingComponent
} }
versions = avmService.getAVMStoreVersions(sandbox, fromDate, toDate); versions = avmService.getAVMStoreVersions(sandbox, fromDate, toDate);
} }
Map requestMap = context.getExternalContext().getRequestMap();
for (VersionDescriptor item : versions) for (VersionDescriptor item : versions)
{ {
// only display snapshots with a valid tag - others are system generated snapshots // only display snapshots with a valid tag - others are system generated snapshots
@@ -209,15 +215,23 @@ public class UISandboxSnapshots extends SelfRenderingComponent
out.write(Integer.toString(item.getVersionID())); out.write(Integer.toString(item.getVersionID()));
out.write("</td><td><nobr>"); out.write("</td><td><nobr>");
// actions for the item // actions for the item
Map<String, String> params = new HashMap<String, String>(2, 1.0f); UIActionLink action = findAction(ACT_SNAPSHOT_REVERT, sandbox);
params.put("sandbox", sandbox); if (action == null)
params.put("version", Integer.toString(item.getVersionID())); {
Utils.encodeRecursive(context, aquireAction( Map<String, String> params = new HashMap<String, String>(2, 1.0f);
context, sandbox, "snapshot_revert", null, params.put("sandbox", sandbox);
"#{AVMBrowseBean.revertSnapshot}", null, null, params)); params.put("version", "#{" + REQUEST_SNAPVERSION + "}");
action = createAction(context, sandbox, ACT_SNAPSHOT_REVERT, null,
"#{AVMBrowseBean.revertSnapshot}", null, null, params);
}
requestMap.put(REQUEST_SNAPVERSION, Integer.toString(item.getVersionID()));
Utils.encodeRecursive(context, action);
requestMap.remove(REQUEST_SNAPVERSION);
out.write("&nbsp;"); out.write("&nbsp;");
Utils.encodeRecursive(context, aquireAction( Utils.encodeRecursive(context, aquireAction(
context, sandbox, "snapshot_preview", null, context, sandbox, ACT_SNAPSHOT_PREVIEW, null,
null, null)); null, null));
out.write("&nbsp;"); out.write("&nbsp;");