<%-- IBM Confidential OCO Source Material --%> <%-- 5724-J34 (C) COPYRIGHT International Business Machines Corp. 2005, 2011 --%> <%-- 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 import="com.ibm.ws.sm.workspace.*"%> <%@ page import="com.ibm.ws.workspace.query.*"%> <%@ page import="com.ibm.ws.console.core.*"%> <%@ page import="java.util.*,com.ibm.ws.security.core.SecurityContext,com.ibm.websphere.product.*"%> <%@ page language="java" import="org.apache.struts.util.MessageResources,org.apache.struts.action.Action"%> <%@ page import="com.ibm.websphere.models.config.workclass.WorkClassType"%> <%@ page import="com.ibm.ws.*"%> <%@ page import="com.ibm.wsspi.*"%> <%@ page import="com.ibm.ws.console.core.item.CollectionItem"%> <%@ page import="com.ibm.ws.console.core.selector.*"%> <%@ page import="com.ibm.ws.console.core.ConfigFileHelper"%> <%@ page import="com.ibm.websphere.management.metadata.ManagedObjectMetadataAccessor"%> <%@ page import="com.ibm.websphere.management.metadata.ManagedObjectMetadataAccessorFactory"%> <%@ page import="com.ibm.ws.console.workclass.form.MatchRuleCollectionForm"%> <%@ page import="com.ibm.ws.console.workclass.form.MatchRuleDetailForm"%> <%@ page import="com.ibm.ws.console.workclass.form.RuleBuilderConditionForm" %> <%@ page import="com.ibm.ws.console.workclass.form.WorkClassCollectionForm"%> <%@ page import="com.ibm.ws.console.workclass.form.WorkClassDetailForm"%> <%@ page import="com.ibm.ws.console.workclass.util.Constants"%> <%@ page import="com.ibm.ws.console.workclass.util.WorkClassConfigUtils"%> <%@ page import="com.ibm.ws.xd.config.workclass.util.WorkClassConstants"%> <%@ page import="com.ibm.ws.xd.config.workclass.util.WorkClassXDUtil"%> <%@ page import="com.ibm.ws.xd.config.workclass.util.MiddlewareAppUtil" %> <%@ 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" %> <%@ taglib uri="/WEB-INF/ibmcommon.tld" prefix="ibmcommon" %> <%@ page import="java.util.*" %> <%@ page import="java.net.*" %> <%@ page import="com.ibm.ws.console.core.ConfigFileHelper" %> <% int chkcounter = 0; int rowindex = 0; boolean debug = false; try { %> <% String contextType=(String)request.getAttribute("contextType"); contextType = "ServicePolicy"; String cellname = null; String nodename = null; String token = null; java.util.Properties props= null; java.util.ArrayList collectionList_ext = new java.util.ArrayList(); for(int i=0;i0)){ // if(contextId!=null && contextId!="nocontext"){ // props = ConfigFileHelper.getNodeMetadataProperties((String)contextId); //213515 // } props = ConfigFileHelper.getAdditionalAdaptiveProperties(request, props, formName); } if(extensions!=null && extensions.length>0){ collectionList_ext = CollectionItemSelector.getCollectionItems(extensions,collectionList_ext,props); } pageContext.setAttribute("collectionList_ext",collectionList_ext); %> <% int wcscope = -1; int wcview = -1; String scopeName = ""; String labelext = ""; MatchRuleCollectionForm collectionForm = null; String wcName = (String)request.getAttribute(Constants.KEY_WORKCLASS_NAME); String encodedWCName = URLEncoder.encode(wcName, "UTF-8"); if (debug) System.out.println("matchRuleLayout.jsp: name attribute: " +wcName); WorkClassCollectionForm wccf = (WorkClassCollectionForm)request.getSession().getAttribute(Constants.KEY_WORKCLASS_COLLECTION_FORM); if (debug) System.out.println("matchRuleLayout.jsp: WorkClassCollectionForm attribute: " +wccf); RuleBuilderConditionForm conditionForm = (RuleBuilderConditionForm)request.getSession().getAttribute(Constants.KEY_RULEBUILDER_CONDITION_DETAIL_FORM); if (conditionForm == null) { conditionForm = new RuleBuilderConditionForm("rulebuilder.clientipv4"); request.getSession().setAttribute(Constants.KEY_RULEBUILDER_CONDITION_DETAIL_FORM, conditionForm); } WorkClassDetailForm wcdf = null; if (wccf != null) { // Retrieve the Scope and View for this collection. This determines the layout of this page. wcview = wccf.getWCView(); // View is either Service or Routing Policy wcscope = wccf.getWCScope(); // Scope is either App or ODR if (wcview == WorkClassConstants.WCVIEW_ROUTING) { labelext = ".routing"; } else { labelext = ""; } wcdf = WorkClassConfigUtils.getWorkClassDetailForm(wcName, wccf); if (wcdf != null) { collectionForm = WorkClassConfigUtils.getMatchRuleCollectionForm(wcName, wccf); if (debug) System.out.println("matchRuleLayout.jsp: collectionForm: " +collectionForm); //collectionForm = wcdf.getMatchRuleCollectionForm(); request.getSession().setAttribute("MatchRuleCollectionForm", collectionForm); // Used for iterate loop later. } else { System.out.println("matchRuleLayout.jsp: Couldn't get WorkClassDetailForm for attribute: " +wcName +"WorkClassDetailForm"); } } else { System.out.println("matchRuleLayout.jsp: Couldn't get WorkClassCollectionForm for attribute WorkClassCollectionForm"); } WorkSpace wksp = (WorkSpace)session.getAttribute(com.ibm.ws.console.core.Constants.WORKSPACE_KEY); ArrayList tcNames = new ArrayList(); ArrayList editionNames = new ArrayList(); ArrayList clusterNames = new ArrayList(); ArrayList routeTypes = new ArrayList(); String[] actionList = {"permit", "permit sticky", "redirect", "reject","permitMaint","permitAffMaint"}; String noactionLabel = ""; String permitLabel = ""; String permitStickyLabel= ""; String rejectLabel = ""; String redirectLabel = ""; String labelkey = ""; String scriptedResize = ""; String permitMaintLabel = ""; String permitMaintAff = ""; if (wcview == WorkClassConstants.WCVIEW_ROUTING) { // Move this list to a Util. // Ordering of this list matters. We are using mapping arrays between the display text and the action type. // 0 - permit // 1 - permit sticky // 2 - redirect // 3 - reject //routTypes = wcdf.getActions(wksp, wcview); MessageResources messages = MessageResources.getMessageResources("com.ibm.ws.console.core.resources.ConsoleAppResources"); //noactionLabel = messages.getMessage(request.getLocale(),"workclass.matchrule.routing.label.action"); //routeTypes.add(noactionLabel); permitLabel = messages.getMessage(request.getLocale(),"workclass.matchrule.routing.label.permit"); routeTypes.add(permitLabel); permitStickyLabel = messages.getMessage(request.getLocale(),"workclass.matchrule.routing.label.permitsticky"); routeTypes.add(permitStickyLabel); redirectLabel = messages.getMessage(request.getLocale(),"workclass.matchrule.routing.label.redirect"); routeTypes.add(redirectLabel); rejectLabel = messages.getMessage(request.getLocale(),"workclass.matchrule.routing.label.reject"); routeTypes.add(rejectLabel); permitMaintLabel = messages.getMessage(request.getLocale(),"workclass.matchrule.routing.label.maintenance"); routeTypes.add(permitMaintLabel); permitMaintAff = messages.getMessage(request.getLocale(),"workclass.matchrule.routing.label.affinity"); routeTypes.add(permitMaintAff); //String appName = (String)session.getAttribute("appName"); String appName = wccf.getApplicationName(); //System.out.println("requestLayout.jsp: appName = " +appName); if ((appName != null) && (!appName.equals(""))) { String normalizedAppName = WorkClassXDUtil.normalizeAppName(appName); if (wcscope == WorkClassConstants.WCSCOPE_MWA) { editionNames = (ArrayList) MiddlewareAppUtil.listApplicationEditions(appName, wksp); } else if (wcscope == WorkClassConstants.WCSCOPE_CU) { editionNames.add(appName); } else { editionNames = wcdf.getEditions(wksp, normalizedAppName); } } clusterNames = wcdf.getGSClusters(wksp); } else { tcNames = wcdf.getTCs(wksp, wcscope); } //String selectedTC = detailForm.getSelectedTC(); pageContext.setAttribute(iterationName, collectionForm); pageContext.setAttribute("MatchRuleCollectionForm", collectionForm); pageContext.setAttribute("editionNamesBean", editionNames); pageContext.setAttribute("gscNamesBean", clusterNames); pageContext.setAttribute("routeTypesBean", routeTypes); pageContext.setAttribute("tcNamesBean", tcNames); String tableSummary = "workclass" + labelext + ".rules.title"; String legendTxt = "workclass.matchrule.column.rule" + labelext; %> <%-- 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_" --%> <bean:message key="workclass.matchrule.name"/> <%@ include file="/secure/layouts/filterSetup.jspf" %>
<% if (showCheckBoxes.equals ("true")) { %> <% } %> <% columnField = (String)cellItem.getColumnField(); String tmpName = cellItem.getTooltip(); // hack to change the rule column name if (tmpName.endsWith("column.rule")) { tmpName = tmpName + labelext; } String columnName = translatedText.getMessage(request.getLocale(),tmpName); %> <% chkcounter = chkcounter + 1; %> <% int prioritycounter = 1; rowindex = 0; String editClickString = ""; %> <% if (showCheckBoxes.equals("true")) { String multiboxId = refId + "_" + rowindex; %> <% } else { %> <% } %> <% columnField = (String)cellItem.getColumnField(); String colwidth = "1%"; if (columnField.equalsIgnoreCase("rule")) { colwidth = "50%"; } %> <% prioritycounter = prioritycounter + 1; rowindex = rowindex + 1; %>
<% if ( !SecurityContext.isSecurityEnabled() || (request.isUserInRole("administrator") || request.isUserInRole("configurator") || request.isUserInRole("deployer")) ) { %> " class="buttons_functions"/> " class="buttons_functions"/> " class="buttons_functions"/> " class="buttons_functions"/> <% } %>
<%=columnName%>
  <% if (cellItem.getIcon()!=null && cellItem.getIcon().length() > 0) { %>   <% } else if (columnField.equalsIgnoreCase("priority")) { // Need to customize this column to handle a text field and a pulldown menu. %> <%=prioritycounter%> <% } else if (columnField.equalsIgnoreCase("rule")) { %> <% String handShow = "none"; String quickEdit = "block"; if (matchExpression.equals("")) { handShow = "block"; quickEdit = "none"; } %>
"> <% String matchExpressionId = "matchExpression" + rowindex; %>
<% //String href = "/ibm/console/com.ibm.ws.console.workclass.forwardCmd.do?forwardName=workclass.rulebuilder.condition.detail.panel"; %> <% String href = "/ibm/console/com.ibm.ws.console.workclass.forwardCmd.do?forwardName=workclass.rulebuilder.condition.detail.panel&isNewSession=true&wcName="+wcName + "&closeURL=javascript:self.close()&csrfid=" + session.getAttribute("com.ibm.ws.console.CSRFToken"); String imgId = "allSPsImg" + rowindex; %> [ Open in new window ]
<% labelkey = "workclass.matchrule" +labelext +".label.class"; %> <% String descriptionkey = "workclass.matchrule" +labelext +".label.class.description"; %> <% String tcListId = "tcList" + rowindex; %> <% String selectionChanged = "initVars(this);" +"showSection(" + "this.value" +",'" + refId + "')"; String selectedItem = ""; String selectProperty = ""; String selectPropertyId = ""; String selectList = ""; String displayField = "display:none"; String selectedType = ""; if (wcview == WorkClassConstants.WCVIEW_ROUTING) { selectProperty = "selectedType"; selectedItem = ((MatchRuleDetailForm) listcheckbox).getSelectedType(); selectedType = selectedItem; if ( (selectedType != null) && (!selectedType.equals("")) ) { routeTypes.remove(noactionLabel); } selectList = "routeTypesBean"; } else { // Never show the other fields. selectionChanged = ""; selectProperty = "selectedTC"; selectedItem = ((MatchRuleDetailForm) listcheckbox).getSelectedTC(); selectedType = selectedItem; selectList = "tcNamesBean"; } %>
<% // Start of routing block - not needed for service policies if (wcview == WorkClassConstants.WCVIEW_ROUTING) { // permit routing with affinity to generic server cluster or app edition // both permit and permit sticky actions will use this selection list. String docId = actionList[0] +refId; if (wcscope == WorkClassConstants.WCSCOPE_ODR) { selectProperty = "selectedGSCluster"; selectedItem = ((MatchRuleDetailForm) listcheckbox).getSelectedGSCluster(); selectList = "gscNamesBean"; if ( (selectedType == null) || (selectedType.equals("")) ) { // The default selected type will be permit so display this field too. displayField = "display:block"; } else if ( selectedType.equalsIgnoreCase(permitLabel) || selectedType.equalsIgnoreCase(permitStickyLabel) ) { displayField = "display:block"; } else { displayField = "display:none"; } labelkey = "workclass.matchrule.routing.label.gsc"; } else { selectProperty = "selectedEdition"; selectedItem = ((MatchRuleDetailForm) listcheckbox).getSelectedEdition(); selectList = "editionNamesBean"; if ( (selectedType == null) || (selectedType.equals("")) ) { // The default selected type will be permit so display this field too. displayField = "display:block"; } else if ( selectedType.equalsIgnoreCase(permitLabel) || selectedType.equalsIgnoreCase(permitStickyLabel) ) { displayField = "display:block"; } else { displayField = "display:none"; } labelkey = "workclass.matchrule.routing.label.edition"; } selectPropertyId = selectProperty + rowindex; %>
<% // redirect to URL docId = actionList[2] +refId; selectProperty = "redirectURL"; selectPropertyId = selectProperty + rowindex; selectedItem = ((MatchRuleDetailForm) listcheckbox).getRedirectURL(); if ( (selectedType != null) && (selectedType.equalsIgnoreCase(redirectLabel)) ) { displayField = "display:block"; } else { displayField = "display:none"; } labelkey = "workclass.matchrule.routing.label.uri"; %>
<% // reject with return code docId = actionList[3] +refId; selectProperty = "rejectCode"; selectPropertyId = selectProperty + rowindex; selectedItem = ((MatchRuleDetailForm) listcheckbox).getRejectCode(); if ( (selectedType != null) && (selectedType.equalsIgnoreCase(rejectLabel)) ) { displayField = "display:block"; } else { displayField = "display:none"; } labelkey = "workclass.matchrule.routing.label.returncode"; %>
<% // permit to servers in maint. mode docId = actionList[4] +refId; selectProperty = "serverMode"; selectedItem = ((MatchRuleDetailForm) listcheckbox).getServerMode(); if ( (selectedType != null) && (selectedType.equalsIgnoreCase(permitMaintLabel)) ) { displayField = "display:block"; } else { displayField = "display:none"; } labelkey = "workclass.matchrule.routing.label.maintenance"; %>
<% // permit to servers in aff. maint. mode docId = actionList[5] +refId; selectProperty = "serverMode"; selectedItem = ((MatchRuleDetailForm) listcheckbox).getServerMode(); if ( (selectedType != null) && (selectedType.equalsIgnoreCase(permitMaintAff)) ) { displayField = "display:block"; } else { displayField = "display:none"; } labelkey = "workclass.matchrule.routing.label.affinity"; %>
<% } // End of routing block String rowString = new Integer(rowindex).toString(); String patternClick = "applyButtonClicked('" +rowString +"')"; editClickString = patternClick; %>
" class="buttons_other" ONCLICK="showSectionParent('<%=rowindex%>')"/>
<% if (matchExpression.equals("")) { %>
<% if (!SecurityContext.isSecurityEnabled() || (request.isUserInRole("administrator") || request.isUserInRole("configurator") || request.isUserInRole("deployer"))) { %> [ ] <% } %>
<% } else { String routingAction = ""; String matchActionItem = ""; %> <%=matchExpression%>
<% if (wcview == WorkClassConstants.WCVIEW_SERVICE) {%> <% } else { %> <% routingAction = ((MatchRuleDetailForm) listcheckbox).getSelectedType(); matchActionItem = ((MatchRuleDetailForm) listcheckbox).getMatchAction(); int i = matchActionItem.indexOf(":"); matchActionItem = matchActionItem.substring(i+1); thenExpression = routingAction+" "+matchActionItem; } %> <%=thenExpression%>
<% if (!SecurityContext.isSecurityEnabled() || (request.isUserInRole("administrator") || request.isUserInRole("configurator") || request.isUserInRole("deployer"))) { %> [ ] <% } %>
<% }%>
<% } %>
<% } catch (Exception e) {e.printStackTrace(); } %> <% ServletContext servletContext = (ServletContext)pageContext.getServletContext(); MessageResources messages = (MessageResources)servletContext.getAttribute(Action.MESSAGES_KEY); String nonefound = messages.getMessage(request.getLocale(),"Persistence.none"); if (rowindex == 0) { out.println(""); out.println("
"+nonefound+"
"); } %>