⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 editoutage.jsp

📁 opennms得相关源码 请大家看看
💻 JSP
📖 第 1 页 / 共 3 页
字号:
	                                thisKey.removeOutageCalendar(theOutage.getName());	                        }	                }	        }			keys=collectionOutages.keySet().iterator();	        while(keys.hasNext()) {	                org.opennms.netmgt.config.collectd.Package thisKey=(org.opennms.netmgt.config.collectd.Package)keys.next();	                Collection collectPackage=(Collection)collectionOutages.get(thisKey);			String name="collect-"+thisKey.getName();			if(enabledOutages.contains(name)) {        	                if(!collectPackage.contains(theOutage.getName())) {	                                thisKey.addOutageCalendar(theOutage.getName());	                        }	                } else {	                        if(collectPackage.contains(theOutage.getName())) {	                                thisKey.removeOutageCalendar(theOutage.getName());	                        }	                }	        }		//Save to disk			pollFactory.saveCurrent();			NotifdConfigFactory.getInstance().saveCurrent();		ThreshdConfigFactory.getInstance().saveCurrent();		CollectdConfigFactory.getInstance().saveCurrent();		PollerConfigFactory.getInstance().saveCurrent();		sendOutagesChangedEvent();		//forward the request for proper display		RequestDispatcher dispatcher = this.getServletContext().getRequestDispatcher("/admin/sched-outages/index.jsp");		dispatcher.forward( request, response );	} else if (request.getParameter("addNodeButton")!=null) {		try {			int newNodeId=Integer.parseInt(request.getParameter("newNode"));			org.opennms.netmgt.config.poller.Node newNode=new org.opennms.netmgt.config.poller.Node();			newNode.setId(newNodeId);			if(!theOutage.getNodeCollection().contains(newNode)) {				theOutage.addNode(newNode);				theOutage.removeInterface(matchAnyInterface); //Just arbitrarily try and remove it.  If it's not there, this will do nothing			}		} catch (NumberFormatException e) {			//Just ignore it - we can't add the node, why should we care?		}	} else if (request.getParameter("addInterfaceButton")!=null) {		org.opennms.netmgt.config.poller.Interface newInterface=new org.opennms.netmgt.config.poller.Interface();		newInterface.setAddress(request.getParameter("newInterface"));		if(!theOutage.getInterfaceCollection().contains(newInterface)) {			theOutage.addInterface(newInterface);			theOutage.removeInterface(matchAnyInterface); //Just arbitrarily try and remove it.  If it's not there, this will do nothing		}	} else if (request.getParameter("matchAny") != null) {		//To turn on matchAny, all normal nodes and interfaces are removed		theOutage.clearInterface();		theOutage.clearNode();		theOutage.addInterface(matchAnyInterface);	} else if (request.getParameter("addSpecificTime")!=null) {		Time newTime=new Time();		StringBuffer beginsTime=new StringBuffer(17);		beginsTime.append(request.getParameter("startNewDate"));		beginsTime.append("-");		beginsTime.append(request.getParameter("startNewMonth"));		beginsTime.append("-");		beginsTime.append(request.getParameter("startNewYear"));		beginsTime.append(" ");		beginsTime.append(request.getParameter("startNewSpecificHour"));		beginsTime.append(":");		beginsTime.append(request.getParameter("startNewSpecificMinute"));		beginsTime.append(":");		beginsTime.append(request.getParameter("startNewSpecificSecond"));		newTime.setBegins(beginsTime.toString());		StringBuffer endsTime=new StringBuffer(17);		endsTime.append(request.getParameter("endNewDate"));		endsTime.append("-");		endsTime.append(request.getParameter("endNewMonth"));		endsTime.append("-");		endsTime.append(request.getParameter("endNewYear"));		endsTime.append(" ");		endsTime.append(request.getParameter("endNewSpecificHour"));		endsTime.append(":");		endsTime.append(request.getParameter("endNewSpecificMinute"));		endsTime.append(":");		endsTime.append(request.getParameter("endNewSpecificSecond"));		newTime.setEnds(endsTime.toString());		theOutage.addTime(newTime);	} else if (request.getParameter("addDayTime")!=null) {		Time newTime=new Time();		String dayValue="1"; //Default to something vaguely acceptable 		if("monthly".compareToIgnoreCase(theOutage.getType())==0) {			dayValue=request.getParameter("startNewDayNum");			} else if ("weekly".compareToIgnoreCase(theOutage.getType())==0) {			dayValue=request.getParameter("startNewDayTxt");		}		newTime.setDay(dayValue);		StringBuffer beginsTime=new StringBuffer(8);		beginsTime.append(request.getParameter("startNewHour"));                beginsTime.append(":");                beginsTime.append(request.getParameter("startNewMinute"));                beginsTime.append(":");                beginsTime.append(request.getParameter("startNewSecond"));                newTime.setBegins(beginsTime.toString());		StringBuffer endsTime=new StringBuffer(8);                endsTime.append(request.getParameter("endNewHour"));                endsTime.append(":");                endsTime.append(request.getParameter("endNewMinute"));                endsTime.append(":");                endsTime.append(request.getParameter("endNewSecond"));                newTime.setEnds(endsTime.toString());			theOutage.addTime(newTime);		} else {		//Look for deleteNode or deleteInterface or deleteTime prefix		Enumeration paramEnum=request.getParameterNames();		boolean found=false;		while(paramEnum.hasMoreElements() && !found) {			String paramName=(String)paramEnum.nextElement();			if(paramName.startsWith("deleteNode")) {				found=true;				String indexStr=paramName.substring("deleteNode".length(), paramName.indexOf("."));				try {					int index=Integer.parseInt(indexStr);					theOutage.removeNode(theOutage.getNode(index));						} catch (NumberFormatException e) {										//Ignore - nothing we can do				}			} else if (paramName.startsWith("deleteInterface")) {				found=true;				String indexStr=paramName.substring("deleteInterface".length(), paramName.indexOf("."));				try {					int index=Integer.parseInt(indexStr);					theOutage.removeInterface(theOutage.getInterface(index));						} catch (NumberFormatException e) {					//Ignore - nothing we can do				}			} else if (paramName.startsWith("deleteTime")) {				found=true;				String indexStr=paramName.substring("deleteTime".length(), paramName.indexOf("."));				try {					int index=Integer.parseInt(indexStr);					theOutage.removeTime(theOutage.getTime(index));				} catch (NumberFormatException e) {					//Ignore - nothing we can do				}			}		}	}   } //end if form submissionboolean hasMatchAny=theOutage.getInterfaceCollection().contains(matchAnyInterface);//for(int i=0; i<theOutage.getInterfaceCount(); i++) {//	if(theOutage.getInterface(i).getAddress().equals("match-any")) {//		hasMatchAny=true;//		break; //out of for loop//	}//}theOutage.getInterfaceCollection().contains("match-any");%>    <html><head><title>Scheduled Outage administration</title><base href="<%=org.opennms.web.Util.calculateUrlBase( request )%>" /><link rel="stylesheet" type="text/css" href="includes/styles.css" /><style>TD {        font-size: 0.8em;}</style><script>function outageTypeChanged(selectElement) {	var isSpecific=selectElement.options(selectElement.selectedIndex).value=="specific";	var isMonthly=selectElement.options(selectElement.selectedIndex).value=="monthly";	document.getElementById("newSpecificTimeTR").style.display=((isSpecific)?'':'none');	document.getElementById("newDayTimeTR").style.display=((isSpecific)?'none':'');	document.getElementById("startNewDayTxt").style.display=((isMonthly)?'none':'');	document.getElementById("startNewDayNum").style.display=((isMonthly)?'':'none');}</script></head><body><% String breadcrumb1 = "<a href='admin/index.jsp'>Admin</a>"; %><% String breadcrumb2 = "<a href='admin/sched-outages/index.jsp'>Manage Scheduled Outages</a>"; %><% String breadcrumb3 = "Edit Outages"; %><jsp:include page="/includes/header.jsp" flush="false" >  <jsp:param name="title" value="Edit outage" />  <jsp:param name="location" value="admin" />  <jsp:param name="breadcrumb" value="<%=breadcrumb1%>" />  <jsp:param name="breadcrumb" value="<%=breadcrumb2%>" />  <jsp:param name="breadcrumb" value="<%=breadcrumb3%>" /></jsp:include><%Enumeration enumList=request.getParameterNames();while(enumList.hasMoreElements()) {	String paramName=(String)enumList.nextElement();	%><!--	<%=paramName%>=<%=request.getParameter(paramName)%><BR>  -->	<%} %><form action="admin/sched-outages/editoutage.jsp" method="POST"><input type="hidden" name="formSubmission" value="<%=true%>"/><table border="0"><tr><td><b>Name:</b></td><td><%=theOutage.getName()%></td><td></td></tr><tr><td><b>Type:</b> </td><td><select name="outageType" onChange="outageTypeChanged(this);">	<option value="specific" <%=("specific".compareToIgnoreCase(theOutage.getType())==0)?"selected":""%>>Specific</option>	<option value="weekly" <%=("weekly".compareToIgnoreCase(theOutage.getType())==0)?"selected":""%>>Weekly</option>	<option value="monthly" <%=("monthly".compareToIgnoreCase(theOutage.getType())==0)?"selected":""%>>Monthly</option></select></td><td colspan="2"></td></tr><tr><td colspan=6><hr></td></tr><tr><td colspan=3 valign="top"><b>Nodes:</b><BR><select name="newNode">	<% 	org.opennms.web.element.Node[] allNodes=NetworkElementFactory.getAllNodes();	for(int j=0; j<allNodes.length; j++) {%>		<option value="<%=allNodes[j].getNodeId()%>"><%=allNodes[j].getLabel()%></option>        <%}%></select><input type="submit" value="Add" name="addNodeButton" /><table border=1><% org.opennms.netmgt.config.poller.Node[] nodeList=theOutage.getNode();for(int i=0; i<nodeList.length; i++) {	int nodeId=nodeList[i].getId();	org.opennms.web.element.Node thisNode=NetworkElementFactory.getNode(nodeId);	%><tr><%	if(thisNode!=null) { %>		<td><%=thisNode.getLabel()%></td>	<% } else { %>		<td>Can't find node with id:<%=nodeId%></td>	<% } %>	<td><input type="image" src="images/redcross.gif" name="deleteNode<%=i%>"/></td>	</tr><% } %></tr></table></td><td valign="top"><b>Interfaces:</b><BR><select name="newInterface">        <%	org.opennms.web.element.Interface[] allInterfaces=NetworkElementFactory.getAllInterfaces(false);	Arrays.sort(allInterfaces, new Comparator() {		public int compare(Object o1, Object o2) {			org.opennms.web.element.Interface i1=(org.opennms.web.element.Interface)o1;			org.opennms.web.element.Interface i2=(org.opennms.web.element.Interface)o2;			String h1=i1.getHostname();			String h2=i2.getHostname();			if(h1==null) {				if(h2==null) {					return 0; //two nulls - the same				} else {					return -1; //null is less than something				}			} else if(h2==null) {				//h1 is not null, by definition				return 1; //h2 is null, h1 is not, so return a positive number			}			return h1.compareTo(h2);		}	});	for(int j=0; j<allInterfaces.length; j++) {		org.opennms.web.element.Interface thisInterface=allInterfaces[j];		String ipaddress=thisInterface.getIpAddress();

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -