Package org.opennms.web.element
Class ElementUtil
- java.lang.Object
-
- org.opennms.web.element.ElementUtil
-
public abstract class ElementUtil extends java.lang.ObjectElementUtil class.
- Since:
- 1.8.1
- Version:
- $Id: $
- Author:
- ranger
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_TRUNCATE_THRESHOLDConstantDEFAULT_TRUNCATE_THRESHOLD=28
-
Constructor Summary
Constructors Constructor Description ElementUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringgetIfStatusString(int ifStatusNum)static java.lang.StringgetIfTypeString(int ifTypeNum)Return the human-readable name for a interface type, should never be null.static InterfacegetInterfaceByParams(javax.servlet.http.HttpServletRequest request, java.lang.String ipInterfaceIdParam, java.lang.String nodeIdParam, java.lang.String ipAddrParam, javax.servlet.ServletContext servletContext)getInterfaceByParamsstatic InterfacegetInterfaceByParams(javax.servlet.http.HttpServletRequest request, javax.servlet.ServletContext servletContext)getInterfaceByParamsstatic java.lang.StringgetInterfaceStatusString(char c)Return the human-readable name for a interface status character, may be null.static java.lang.StringgetInterfaceStatusString(Interface intf)Return the human-readable name for a interface's status, may be null.static java.lang.StringgetIpRouteProtocolString(int iprouteprotocol)static java.lang.StringgetIpRouteTypeString(int iproutetype)static OnmsNodegetNodeByParams(javax.servlet.http.HttpServletRequest request, java.lang.String nodeLookupParam, javax.servlet.ServletContext servletContext)getNodeByParamsstatic OnmsNodegetNodeByParams(javax.servlet.http.HttpServletRequest request, javax.servlet.ServletContext servletContext)getNodeByParamsstatic java.lang.StringgetNodeStatusString(OnmsNode node)Return the human-readable name for a node's status, may be null.static java.lang.StringgetNodeStatusString(OnmsNode.NodeType c)Return the human-readable name for a interface status character, may be null.static ServicegetServiceByParams(javax.servlet.http.HttpServletRequest request, java.lang.String ifServiceIdParam, java.lang.String nodeIdParam, java.lang.String ipAddrParam, java.lang.String serviceIdParam, javax.servlet.ServletContext servletContext)getServiceByParamsstatic ServicegetServiceByParams(javax.servlet.http.HttpServletRequest request, javax.servlet.ServletContext servletContext)getServiceByParamsstatic Service[]getServicesOnInterface(int nodeId, java.lang.String ipAddr, javax.servlet.ServletContext servletContext)static Service[]getServicesOnNodeByParams(javax.servlet.http.HttpServletRequest request, int serviceId, javax.servlet.ServletContext servletContext)getServicesOnNodeByParamsstatic java.lang.StringgetServiceStatusString(char c)Return the human-readable name for a service status character, may be null.static java.lang.StringgetServiceStatusString(Service svc)Return the human-readable name for a service's status, may be null.static InterfacegetSnmpInterfaceByParams(javax.servlet.http.HttpServletRequest request, java.lang.String nodeIdParam, java.lang.String ifIndexParam, javax.servlet.ServletContext servletContext)Return interface from snmpinterface table given a servlet request, nodeId param name and ifIndex param name.static InterfacegetSnmpInterfaceByParams(javax.servlet.http.HttpServletRequest request, javax.servlet.ServletContext servletContext)Return interface from snmpinterface table given a servlet request.static java.lang.StringgetSnmpInterfaceStatusString(char c)Return the human-readable name for a interface status character, may be null.static java.lang.StringgetSnmpInterfaceStatusString(Interface intf)Return the human-readable name for an SNMP interface's status, may be null.static booleanhasLocallyMonitoredServices(Service[] svcs)hasLocallyMonitoredServicesstatic java.lang.StringtruncateLabel(java.lang.String label)truncateLabelstatic java.lang.StringtruncateLabel(java.lang.String label, int truncateThreshold)truncateLabel
-
-
-
Field Detail
-
DEFAULT_TRUNCATE_THRESHOLD
public static final int DEFAULT_TRUNCATE_THRESHOLD
ConstantDEFAULT_TRUNCATE_THRESHOLD=28- See Also:
- Constant Field Values
-
-
Method Detail
-
getIpRouteProtocolString
public static java.lang.String getIpRouteProtocolString(int iprouteprotocol)
-
getIpRouteTypeString
public static java.lang.String getIpRouteTypeString(int iproutetype)
-
getIfStatusString
public static java.lang.String getIfStatusString(int ifStatusNum)
-
getIfTypeString
public static java.lang.String getIfTypeString(int ifTypeNum)
Return the human-readable name for a interface type, should never be null.- Parameters:
int- ifTypeNum.- Returns:
- a
Stringobject.
-
getNodeStatusString
public static java.lang.String getNodeStatusString(OnmsNode node)
Return the human-readable name for a node's status, may be null.- Parameters:
node- aOnmsNodeobject.- Returns:
- a
Stringobject.
-
getNodeStatusString
public static java.lang.String getNodeStatusString(OnmsNode.NodeType c)
Return the human-readable name for a interface status character, may be null.- Parameters:
c- a char.- Returns:
- a
Stringobject.
-
getInterfaceStatusString
public static java.lang.String getInterfaceStatusString(Interface intf)
Return the human-readable name for a interface's status, may be null.- Parameters:
intf- aInterfaceobject.- Returns:
- a
Stringobject.
-
getInterfaceStatusString
public static java.lang.String getInterfaceStatusString(char c)
Return the human-readable name for a interface status character, may be null.- Parameters:
c- a char.- Returns:
- a
Stringobject.
-
getSnmpInterfaceStatusString
public static java.lang.String getSnmpInterfaceStatusString(Interface intf)
Return the human-readable name for an SNMP interface's status, may be null.- Parameters:
intf- aInterfaceobject.- Returns:
- a
Stringobject.
-
getSnmpInterfaceStatusString
public static java.lang.String getSnmpInterfaceStatusString(char c)
Return the human-readable name for a interface status character, may be null.- Parameters:
c- a char.- Returns:
- a
Stringobject.
-
getServiceStatusString
public static java.lang.String getServiceStatusString(Service svc)
Return the human-readable name for a service's status, may be null.- Parameters:
svc- aServiceobject.- Returns:
- a
Stringobject.
-
getServiceStatusString
public static java.lang.String getServiceStatusString(char c)
Return the human-readable name for a service status character, may be null.- Parameters:
c- a char.- Returns:
- a
Stringobject.
-
hasLocallyMonitoredServices
public static boolean hasLocallyMonitoredServices(Service[] svcs)
hasLocallyMonitoredServices
- Parameters:
svcs- an array ofServiceobjects.- Returns:
- a boolean.
-
truncateLabel
public static java.lang.String truncateLabel(java.lang.String label)
truncateLabel
- Parameters:
label- aStringobject.- Returns:
- a
Stringobject.
-
truncateLabel
public static java.lang.String truncateLabel(java.lang.String label, int truncateThreshold)truncateLabel
- Parameters:
label- aStringobject.truncateThreshold- a int.- Returns:
- a
Stringobject.
-
getNodeByParams
public static OnmsNode getNodeByParams(javax.servlet.http.HttpServletRequest request, javax.servlet.ServletContext servletContext) throws javax.servlet.ServletException, java.sql.SQLException
getNodeByParams
- Parameters:
request- aHttpServletRequestobject.- Returns:
- a
OnmsNodeobject. - Throws:
javax.servlet.ServletException- if any.java.sql.SQLException- if any.
-
getNodeByParams
public static OnmsNode getNodeByParams(javax.servlet.http.HttpServletRequest request, java.lang.String nodeLookupParam, javax.servlet.ServletContext servletContext) throws javax.servlet.ServletException, java.sql.SQLException
getNodeByParams
- Parameters:
request- aHttpServletRequestobject.nodeLookupParam- aStringobject.- Returns:
- a
OnmsNodeobject. - Throws:
javax.servlet.ServletException- if any.java.sql.SQLException- if any.
-
getInterfaceByParams
public static Interface getInterfaceByParams(javax.servlet.http.HttpServletRequest request, javax.servlet.ServletContext servletContext) throws javax.servlet.ServletException, java.sql.SQLException
getInterfaceByParams
- Parameters:
request- aHttpServletRequestobject.- Returns:
- a
Interfaceobject. - Throws:
javax.servlet.ServletException- if any.java.sql.SQLException- if any.
-
getInterfaceByParams
public static Interface getInterfaceByParams(javax.servlet.http.HttpServletRequest request, java.lang.String ipInterfaceIdParam, java.lang.String nodeIdParam, java.lang.String ipAddrParam, javax.servlet.ServletContext servletContext) throws javax.servlet.ServletException, java.sql.SQLException
getInterfaceByParams
- Parameters:
request- aHttpServletRequestobject.ipInterfaceIdParam- aStringobject.nodeIdParam- aStringobject.ipAddrParam- aStringobject.ifIndexParam- aStringobject.- Returns:
- a
Interfaceobject. - Throws:
javax.servlet.ServletException- if any.java.sql.SQLException- if any.
-
getSnmpInterfaceByParams
public static Interface getSnmpInterfaceByParams(javax.servlet.http.HttpServletRequest request, javax.servlet.ServletContext servletContext) throws javax.servlet.ServletException, java.sql.SQLException
Return interface from snmpinterface table given a servlet request. Intended for use with non-ip interfaces.- Parameters:
request- aHttpServletRequestobject.- Returns:
- Interface
- Throws:
java.sql.SQLException- if any.javax.servlet.ServletException
-
getSnmpInterfaceByParams
public static Interface getSnmpInterfaceByParams(javax.servlet.http.HttpServletRequest request, java.lang.String nodeIdParam, java.lang.String ifIndexParam, javax.servlet.ServletContext servletContext) throws javax.servlet.ServletException, java.sql.SQLException
Return interface from snmpinterface table given a servlet request, nodeId param name and ifIndex param name. Intended for use with non-ip interfaces.- Parameters:
request- aHttpServletRequestobject.nodeIdParam- aStringobject.ifIndexParam- aStringobject.- Returns:
- Interface
- Throws:
java.sql.SQLException- if any.javax.servlet.ServletException
-
getServiceByParams
public static Service getServiceByParams(javax.servlet.http.HttpServletRequest request, javax.servlet.ServletContext servletContext) throws javax.servlet.ServletException, java.sql.SQLException
getServiceByParams
- Parameters:
request- aHttpServletRequestobject.- Returns:
- a
Serviceobject. - Throws:
javax.servlet.ServletException- if any.java.sql.SQLException- if any.
-
getServiceByParams
public static Service getServiceByParams(javax.servlet.http.HttpServletRequest request, java.lang.String ifServiceIdParam, java.lang.String nodeIdParam, java.lang.String ipAddrParam, java.lang.String serviceIdParam, javax.servlet.ServletContext servletContext) throws javax.servlet.ServletException, java.sql.SQLException
getServiceByParams
- Parameters:
request- aHttpServletRequestobject.ifServiceIdParam- aStringobject.nodeIdParam- aStringobject.ipAddrParam- aStringobject.serviceIdParam- aStringobject.- Returns:
- a
Serviceobject. - Throws:
javax.servlet.ServletException- if any.java.sql.SQLException- if any.
-
getServicesOnNodeByParams
public static Service[] getServicesOnNodeByParams(javax.servlet.http.HttpServletRequest request, int serviceId, javax.servlet.ServletContext servletContext) throws java.sql.SQLException
getServicesOnNodeByParams
- Parameters:
request- aHttpServletRequestobject.serviceId- a int.- Returns:
- an array of
Serviceobjects. - Throws:
java.sql.SQLException- if any.
-
getServicesOnInterface
public static Service[] getServicesOnInterface(int nodeId, java.lang.String ipAddr, javax.servlet.ServletContext servletContext) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
-