1 19 20 package com.sslexplorer.policyframework.itemactions; 21 22 import com.sslexplorer.policyframework.NoPermissionException; 23 import com.sslexplorer.policyframework.Permission; 24 import com.sslexplorer.policyframework.PolicyConstants; 25 import com.sslexplorer.policyframework.ResourceItem; 26 import com.sslexplorer.policyframework.ResourceUtil; 27 import com.sslexplorer.table.AvailableTableItemAction; 28 29 31 public class MoveResourceUpAction extends AbstractPathAction { 32 34 public static final String TABLE_ITEM_ACTION_ID = "moveUp"; 35 36 41 public MoveResourceUpAction(int navigationContext, String messageResourcesKey) { 42 this(navigationContext, messageResourcesKey, "{2}.do?actionTarget=moveUp&selectedResource={0}"); 43 } 44 45 50 public MoveResourceUpAction(int navigationContext, String messageResourcesKey, String requiredPath) { 51 super(TABLE_ITEM_ACTION_ID, messageResourcesKey, 180, false, navigationContext, requiredPath); 52 } 53 54 58 public boolean isEnabled(AvailableTableItemAction availableItem) { 59 try { 60 ResourceItem item = (ResourceItem) availableItem.getRowItem(); 61 Permission[] permissions = new Permission[] { PolicyConstants.PERM_EDIT_AND_ASSIGN }; 62 ResourceUtil.checkResourceManagementRights(item.getResource(), availableItem.getSessionInfo(), permissions); 63 return true; 64 } catch (NoPermissionException e) { 65 return false; 66 } 67 } 68 } 69 | Popular Tags |