1 19 20 package com.sslexplorer.policyframework.actions; 21 22 import java.util.List ; 23 24 import javax.servlet.http.HttpServletRequest ; 25 import javax.servlet.http.HttpServletResponse ; 26 27 import org.apache.struts.action.ActionForm; 28 import org.apache.struts.action.ActionForward; 29 import org.apache.struts.action.ActionMapping; 30 31 import com.sslexplorer.navigation.MenuTree; 32 import com.sslexplorer.policyframework.PolicyConstants; 33 import com.sslexplorer.policyframework.PolicyDatabaseFactory; 34 import com.sslexplorer.policyframework.ResourceItem; 35 import com.sslexplorer.policyframework.forms.PoliciesForm; 36 import com.sslexplorer.security.LogonControllerFactory; 37 import com.sslexplorer.security.SessionInfo; 38 39 40 46 public class PoliciesDispatchAction extends AbstractResourcesDispatchAction { 47 48 51 public PoliciesDispatchAction() { 52 super(PolicyConstants.POLICY_RESOURCE_TYPE, PolicyConstants.POLICY_RESOURCE_TYPE); 53 } 54 55 58 public ActionForward list(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) 59 throws Exception { 60 PoliciesForm policyForm = (PoliciesForm) form; 61 List policies = PolicyDatabaseFactory.getInstance().getPolicies(getSessionInfo(request).getUser().getRealm()); 62 policyForm.initialize(policies, ResourceItem.class, request.getSession(), "name"); 63 return super.list(mapping, form, request, response); 64 } 65 66 69 public int getNavigationContext(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { 70 return SessionInfo.MANAGEMENT_CONSOLE_CONTEXT | SessionInfo.USER_CONSOLE_CONTEXT; 71 } 72 73 @Override 74 protected void doRemove(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { 75 super.doRemove(mapping, form, request, response); 76 LogonControllerFactory.getInstance().applyMenuItemChanges(request); 78 } 79 80 } | Popular Tags |