KickJava   Java API By Example, From Geeks To Geeks.

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


1 /**
2  *
3  */

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