<%-- IBM Confidential OCO Source Material --%> <%-- 5724-I63, 5724-H88, 5655-N01, 5733-W61 (C) COPYRIGHT International Business Machines Corp. 1997, 2013 --%> <%-- The source code for this program is not published or otherwise divested --%> <%-- of its trade secrets, irrespective of what has been deposited with the --%> <%-- U.S. Copyright Office. --%> <%@ page language="java" import="org.apache.struts.util.MessageResources,org.apache.struts.action.Action"%> <%@ page errorPage="/error.jsp" %> <%@ page import="java.util.*" %> <%@ page import="java.net.*" %> <%@ page import="org.apache.struts.util.MessageResources,org.apache.struts.action.Action" %> <%@ page import="com.ibm.wsspi.*"%> <%@ page import="com.ibm.websphere.management.authorizer.AdminAuthorizer" %> <%@ page import="com.ibm.websphere.management.metadata.*"%> <%@ page import="com.ibm.ws.console.core.ConfigFileHelper"%> <%@ page import="com.ibm.ws.console.core.Constants"%> <%@ page import="com.ibm.ws.console.core.form.ContextScopeForm"%> <%@ page import="com.ibm.ws.console.core.item.CollectionItem"%> <%@ page import="com.ibm.ws.console.core.selector.*"%> <%@ page import="com.ibm.ws.console.middlewarenodes.topology.MiddlewareNodeCollectionForm"%> <%@ page import="com.ibm.ws.xd.admin.utils.ConfigUtils"%> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> <%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %> <% MessageResources statusMessages = (MessageResources)application.getAttribute(org.apache.struts.Globals.MESSAGES_KEY); String statusAlt = statusMessages.getMessage(request.getLocale(),"accessibility.needs"); %> <% int chkcounter = 0; try { %> <% int wasVersion = ConfigUtils.getWASVersionInts()[0]; if(treatAdminSecurityManagerRoleAsMonitor==null) { treatAdminSecurityManagerRoleAsMonitor="true"; } String contextType=(String)request.getAttribute("contextType"); java.util.Properties props= null; java.util.ArrayList collectionList_ext = new java.util.ArrayList(); for(int i=0;i0) || (extensions_preferences!=null && extensions_preferences.length>0)){ if(contextId!=null && contextId!="nocontext"){ props = ConfigFileHelper.getNodeMetadataProperties((String)contextId); //213515 } } if(extensions!=null && extensions.length>0){ collectionList_ext = CollectionItemSelector.getCollectionItems(extensions,collectionList_ext,props); } pageContext.setAttribute("collectionList_ext",collectionList_ext); MiddlewareNodeCollectionForm middlewareNodeCollectionForm = (MiddlewareNodeCollectionForm) session.getAttribute(formName); String encoding = response.getCharacterEncoding(); if(encoding==null) encoding = "UTF-8"; %> <% if(extensions_preferences!=null && extensions_preferences.length>0){ collectionPreferenceList_ext = PreferenceSelector.getPreferences(extensions_preferences,collectionPreferenceList_ext,props); } %> <%-- Generate a map of roles--%> <% Map contextToRolesMap = new HashMap(); String contextUri = ConfigFileHelper.decodeContextUri(contextId); if (wasVersion >= 7) { %> <% String contextId_detail = contextUri + "/nodes/" + name; contextToRolesMap.put(contextId_detail, ConfigFileHelper.getRoles(contextId_detail)); %> <%-- We need to get ALL items in the collection so that we can display the correct values in the PreferenceFilter --%> <%-- It would be nice if there was a more efficient way to do that without looking through every item. (417407) --%> <% String contextId_detail = contextUri + "/nodes/" + name; contextToRolesMap.put(contextId_detail, ConfigFileHelper.getRoles(contextId_detail)); %> <% //The goal is to populate contextToRolesMap with // 1. The valid roles of all items in collection table // 2. The valid roles for current scope (if selected), or else for all possible scopes if "All Scopes" is selected if (contextId != null) { if (contextId.equals("none") || contextId.equals(Constants.ALLSCOPES)) { //try to get a list of scopes from a scope form ContextScopeForm scopeForm = (ContextScopeForm) session.getAttribute("contextScopeForm"); List allScopes = scopeForm.getAllscopes(); for (Iterator i = allScopes.iterator(); i.hasNext(); ) { String scopeContextId = (String) i.next(); contextToRolesMap.put(scopeContextId, ConfigFileHelper.getRoles(ConfigFileHelper.decodeContextUri(scopeContextId))); } } else if (contextId.equals("CONTEXT_NOT_SET")) { //This happens when using AbstractController ContextScopeForm scopeForm = (ContextScopeForm) session.getAttribute("contextScopeForm"); if (scopeForm.getCurrentScope().equals("All Scopes")) { List allScopes = scopeForm.getAllscopes(); for (Iterator i = allScopes.iterator(); i.hasNext(); ) { String scopeContextId = (String) i.next(); contextToRolesMap.put(scopeContextId, ConfigFileHelper.getRoles(ConfigFileHelper.decodeContextUri(scopeContextId))); } } else { contextToRolesMap.put(scopeForm.getCurrentScope(), ConfigFileHelper.getRoles(ConfigFileHelper.decodeContextUri(scopeForm.getCurrentScope()))); } } else { //context is set to a single scope--use that contextToRolesMap.put(contextId, ConfigFileHelper.getRoles(ConfigFileHelper.decodeContextUri(contextId))); } } } %> <%-- NOTES: The sorting icons are specified in defaultIconList. The icons are assumed to be located in the images folder. Checkboxes are NOT displayed for all objects whose refIds start with "builtin_" --%> <%@ include file="/secure/layouts/filterSetup.jspf" %> <% session.removeAttribute("preferences"); %> <% for (Iterator i = collectionPreferenceList_ext.iterator(); i.hasNext();) { preferences.add(i.next()); }%> <% if (request.getAttribute("role.filtering.disabled") == null) { %> <% } %> <%@ include file="/secure/layouts/tableControlsLayout.jspf" %>
<% if (showCheckBoxes.equals ("true")) { %> <% } %> <%-- --%> <% sortable = (String)cellItem.getIsSortable(); columnField = (String)cellItem.getColumnField(); String tmpName = (String)cellItem.getTooltip(); String columnName = translatedText.getMessage(request.getLocale(),tmpName); if (chkcounter == 0) { if (searchFilter.equals("")) { searchFilter = columnField; } } %> <% chkcounter = chkcounter + 1; %> <%@ include file="/secure/layouts/filterControlsLayout.jspf" %> <% chkcounter = 0; %> <% String prevRole = null; boolean roleFilteringEnabled = true; if (wasVersion >= 7) { if (request.getAttribute("role.filtering.disabled") != null) roleFilteringEnabled = false; } %> <%String builtIn = null;%> <%builtIn = builtIn_new;%> <% String primaryRole = null; if (wasVersion >= 7) { String nnn = contextUri + "/nodes/"+name; primaryRole = ConfigFileHelper.getAssumedRole((Set)contextToRolesMap.get(nnn)); //515386: Treat Admin security manager role as monitor if(primaryRole.equals(AdminAuthorizer.ADMINSECURITY_ROLE) && treatAdminSecurityManagerRoleAsMonitor.equals("true")) { primaryRole=AdminAuthorizer.MONITOR_ROLE; } if (roleFilteringEnabled) { if (prevRole == null || !primaryRole.equals(prevRole)) { prevRole = primaryRole; String roleMessageKey = "resource.access." + primaryRole; %> <% } } } %> <% if (showCheckBoxes.equals("true")) { if ((wasVersion >= 7 && "monitor".equals(primaryRole)) || (builtIn!=null && builtIn.equalsIgnoreCase("true"))) { //empty table cell where the check box normally would be %> <% } else { if ( ConfigFileHelper.isDeleteable(refId) == true) { String delId = (String)resourceUri + "#" + (String) refId ; } %> <% } } %> <% columnField = (String)cellItem.getColumnField(); %> <% chkcounter = chkcounter + 1; %>
<% if (sortIconLocation.equalsIgnoreCase ("right")) { %> <% } if (sortable.equals ("false")) { %> <% } if ((sortable.equals ("true")) && (!columnField.equals("status")) && (!columnField.equals("maintStatus")) && (!columnField.equals("syncStatus"))) { if (columnField.equals (sortedColumn)) { String nextOrder; if (order.equalsIgnoreCase ("ASC")) { nextOrder = "DSC"; } else { nextOrder = "ASC"; } %> <% if (order.equalsIgnoreCase ("ASC")) { %> <bean:message key="> <% } else if (order.equalsIgnoreCase ("DSC")) { %> <bean:message key="> <% } } else { %> <bean:message key="> <% } if (sortIconLocation.equalsIgnoreCase ("left")) { %> <% } if (sortable.equals ("false")) { %> <% } } %> <% //add refresh.gif after status column to refresh page if ( (columnField.equals("status")) || (columnField.equals("maintStatus")) || (columnField.equals("syncStatus")) ) { %> <bean:message key=" align="texttop" border="0"/> <% } if (!filterDisplay.equals("none")) { if (columnField.equals(searchFilter)) { %>
: <% } } %>
  <% if ( !idColumn.equals("") ) {%> <% if (cellItem.getIcon()!=null && cellItem.getIcon().length() > 0) { %>   <% } if (cellItem.getLink().length() > 0) { String hRef = cellItem.getLink()+ "&objectId=" + URLEncoder.encode((String) objectId,encoding) + "&refId="+URLEncoder.encode((String) refId,encoding) + "&contextId=" + URLEncoder.encode((String) contextId,encoding) + "&resourceUri="+URLEncoder.encode((String) resourceUri,encoding) + "&perspective=" + URLEncoder.encode((String) perspective,encoding); %> <% } %> <% if ( columnField.equalsIgnoreCase("syncStatus") ) { String xdstatusservlet = "/ibm/console/xdagentstatus"; String imageSrcLink = ""; String encodedStatusLink = ""; %> <% encodedStatusLink = xdstatusservlet + "?text=true&type=node&node=" + URLEncoder.encode((String)name, encoding); imageSrcLink = xdstatusservlet + "?type=node&node=" + URLEncoder.encode((String)name, encoding); %> <%=statusAlt%> <% } else if (columnField.equalsIgnoreCase("status")) { boolean isXDAgent = middlewareNodeCollectionForm.isXDAgent((String)name); String statusservlet = "/ibm/console/status"; String xdstatusservlet = "/ibm/console/xdagentstatus"; String imageSrcLink = ""; String encodedStatusLink = ""; String nodeServerType = ""; if(cellItem.getStatusServlet()!=null) statusservlet = cellItem.getStatusServlet(); if (isXDAgent) //if this is an XDAgent node { nodeServerType = "middlewareagent"; encodedStatusLink = xdstatusservlet + "?text=true&type=server&node=" + URLEncoder.encode((String)name, encoding) + "&name="+nodeServerType; imageSrcLink = xdstatusservlet + "?type=server&node=" + URLEncoder.encode((String)name, encoding) + "&name="+nodeServerType; } else { boolean isDmgr = middlewareNodeCollectionForm.isDmgr((String)name); if (isDmgr) nodeServerType = "dmgr"; else nodeServerType = "nodeagent"; encodedStatusLink = statusservlet + "?text=true&type=server&node=" + URLEncoder.encode((String)name, encoding) + "&name="+nodeServerType; imageSrcLink = statusservlet + "?type=server&node=" + URLEncoder.encode((String)name, encoding) + "&name="+nodeServerType; } %> <bean:message key=" TITLE=""> <% } else if (columnField.equalsIgnoreCase("maintStatus")) { String statusservlet = "/ibm/console/maintstatus"; if(cellItem.getStatusServlet()!=null) statusservlet = cellItem.getStatusServlet(); %> <% String encodedStatusLink = statusservlet + "?text=true&type=node&node=" + URLEncoder.encode((String)name, encoding); String imageSrcLink = statusservlet + "?type=node&node=" + URLEncoder.encode((String)name, encoding); %> <bean:message key=" TITLE=""> <% } else if (cellItem.getTranslate()) { %> <% } else { %>   <% } %> <% if (cellItem.getLink().length() > 0) { %> <% } %>
<% } catch (Exception e) { e.printStackTrace(); } ServletContext servletContext = (ServletContext)pageContext.getServletContext(); MessageResources messages = (MessageResources)servletContext.getAttribute(org.apache.struts.Globals.MESSAGES_KEY); String nonefound = messages.getMessage(request.getLocale(),"Persistence.none"); if (chkcounter == 0) { out.println("
"+nonefound+"
"); } %>