KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > extensions > itemactions > UpdateExtensionAction


1 /**
2  *
3  */

4 package com.sslexplorer.extensions.itemactions;
5
6 import com.sslexplorer.extensions.ExtensionBundleItem;
7 import com.sslexplorer.policyframework.Permission;
8 import com.sslexplorer.policyframework.PolicyConstants;
9 import com.sslexplorer.security.SessionInfo;
10 import com.sslexplorer.table.AvailableTableItemAction;
11 import com.sslexplorer.table.TableItemAction;
12 import com.sslexplorer.tasks.TaskUtil;
13
14 public final class UpdateExtensionAction extends TableItemAction {
15     
16     public UpdateExtensionAction() {
17         super("updateExtension", "extensions", 300, "", true, SessionInfo.MANAGEMENT_CONSOLE_CONTEXT, PolicyConstants.EXTENSIONS_RESOURCE_TYPE, new Permission[]{ PolicyConstants.PERM_CHANGE});
18     }
19
20     public boolean isEnabled(AvailableTableItemAction availableItem) {
21         ExtensionBundleItem item = (ExtensionBundleItem)availableItem.getRowItem();
22         return !item.getBundle().isDevExtension() && item.getBundle().isUpdateable() && item.getSubFormName().equals("updateableExtensionsForm");
23     }
24
25     @Override JavaDoc
26     public String JavaDoc getOnClick(AvailableTableItemAction availableItem) {
27         return TaskUtil.getTaskPath(getPath(availableItem), "extensions", "updateExtension", availableItem.getRequest().getSession(), 440, 100);
28     }
29
30     public String JavaDoc getPath(AvailableTableItemAction availableItem) {
31         ExtensionBundleItem item = (ExtensionBundleItem)availableItem.getRowItem();
32         return "/showExtensionStore.do?actionTarget=update&id=" + item.getBundle().getId()+"&version="+ item.getVersion().toString() + "&subForm=" + item.getSubFormName();
33     }
34 }
Popular Tags