Package org.opennms.web.element
Class ElementUtil
- java.lang.Object
-
- org.opennms.web.element.ElementUtil
-
public abstract class ElementUtil extends Object
ElementUtil class.
- Since:
- 1.8.1
- Version:
- $Id: $
- Author:
- ranger
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_TRUNCATE_THRESHOLD
ConstantDEFAULT_TRUNCATE_THRESHOLD=28
-
Constructor Summary
Constructors Constructor Description ElementUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
getIfStatusString(int ifStatusNum)
static String
getIfTypeString(int ifTypeNum)
Return the human-readable name for a interface type, should never be null.static Interface
getInterfaceByParams(javax.servlet.http.HttpServletRequest request, String ipInterfaceIdParam, String nodeIdParam, String ipAddrParam, javax.servlet.ServletContext servletContext)
getInterfaceByParamsstatic Interface
getInterfaceByParams(javax.servlet.http.HttpServletRequest request, javax.servlet.ServletContext servletContext)
getInterfaceByParamsstatic String
getInterfaceStatusString(char c)
Return the human-readable name for a interface status character, may be null.static String
getInterfaceStatusString(Interface intf)
Return the human-readable name for a interface's status, may be null.static String
getIpRouteProtocolString(int iprouteprotocol)
static String
getIpRouteTypeString(int iproutetype)
static OnmsNode
getNodeByParams(javax.servlet.http.HttpServletRequest request, String nodeLookupParam, javax.servlet.ServletContext servletContext)
getNodeByParamsstatic OnmsNode
getNodeByParams(javax.servlet.http.HttpServletRequest request, javax.servlet.ServletContext servletContext)
getNodeByParamsstatic String
getNodeStatusString(OnmsNode node)
Return the human-readable name for a node's status, may be null.static String
getNodeStatusString(OnmsNode.NodeType c)
Return the human-readable name for a interface status character, may be null.static Service
getServiceByParams(javax.servlet.http.HttpServletRequest request, String ifServiceIdParam, String nodeIdParam, String ipAddrParam, String serviceIdParam, javax.servlet.ServletContext servletContext)
getServiceByParamsstatic Service
getServiceByParams(javax.servlet.http.HttpServletRequest request, javax.servlet.ServletContext servletContext)
getServiceByParamsstatic Service[]
getServicesOnInterface(int nodeId, String ipAddr, javax.servlet.ServletContext servletContext)
static Service[]
getServicesOnNodeByParams(javax.servlet.http.HttpServletRequest request, int serviceId, javax.servlet.ServletContext servletContext)
getServicesOnNodeByParamsstatic String
getServiceStatusString(char c)
Return the human-readable name for a service status character, may be null.static String
getServiceStatusString(Service svc)
Return the human-readable name for a service's status, may be null.static Interface
getSnmpInterfaceByParams(javax.servlet.http.HttpServletRequest request, String nodeIdParam, String ifIndexParam, javax.servlet.ServletContext servletContext)
Return interface from snmpinterface table given a servlet request, nodeId param name and ifIndex param name.static Interface
getSnmpInterfaceByParams(javax.servlet.http.HttpServletRequest request, javax.servlet.ServletContext servletContext)
Return interface from snmpinterface table given a servlet request.static String
getSnmpInterfaceStatusString(char c)
Return the human-readable name for a interface status character, may be null.static String
getSnmpInterfaceStatusString(Interface intf)
Return the human-readable name for an SNMP interface's status, may be null.static boolean
hasLocallyMonitoredServices(Service[] svcs)
hasLocallyMonitoredServicesstatic String
truncateLabel(String label)
truncateLabelstatic String
truncateLabel(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 String getIpRouteProtocolString(int iprouteprotocol)
-
getIpRouteTypeString
public static String getIpRouteTypeString(int iproutetype)
-
getIfStatusString
public static String getIfStatusString(int ifStatusNum)
-
getIfTypeString
public static String getIfTypeString(int ifTypeNum)
Return the human-readable name for a interface type, should never be null.- Parameters:
int
- ifTypeNum.- Returns:
- a
String
object.
-
getNodeStatusString
public static String getNodeStatusString(OnmsNode node)
Return the human-readable name for a node's status, may be null.
-
getNodeStatusString
public static String getNodeStatusString(OnmsNode.NodeType c)
Return the human-readable name for a interface status character, may be null.- Parameters:
c
- a char.- Returns:
- a
String
object.
-
getInterfaceStatusString
public static String getInterfaceStatusString(Interface intf)
Return the human-readable name for a interface's status, may be null.
-
getInterfaceStatusString
public static String getInterfaceStatusString(char c)
Return the human-readable name for a interface status character, may be null.- Parameters:
c
- a char.- Returns:
- a
String
object.
-
getSnmpInterfaceStatusString
public static String getSnmpInterfaceStatusString(Interface intf)
Return the human-readable name for an SNMP interface's status, may be null.
-
getSnmpInterfaceStatusString
public static String getSnmpInterfaceStatusString(char c)
Return the human-readable name for a interface status character, may be null.- Parameters:
c
- a char.- Returns:
- a
String
object.
-
getServiceStatusString
public static String getServiceStatusString(Service svc)
Return the human-readable name for a service's status, may be null.
-
getServiceStatusString
public static String getServiceStatusString(char c)
Return the human-readable name for a service status character, may be null.- Parameters:
c
- a char.- Returns:
- a
String
object.
-
hasLocallyMonitoredServices
public static boolean hasLocallyMonitoredServices(Service[] svcs)
hasLocallyMonitoredServices
- Parameters:
svcs
- an array ofService
objects.- Returns:
- a boolean.
-
truncateLabel
public static String truncateLabel(String label, int truncateThreshold)
truncateLabel
-
getNodeByParams
public static OnmsNode getNodeByParams(javax.servlet.http.HttpServletRequest request, javax.servlet.ServletContext servletContext) throws javax.servlet.ServletException, SQLException
getNodeByParams
- Parameters:
request
- aHttpServletRequest
object.- Returns:
- a
OnmsNode
object. - Throws:
javax.servlet.ServletException
- if any.SQLException
- if any.
-
getNodeByParams
public static OnmsNode getNodeByParams(javax.servlet.http.HttpServletRequest request, String nodeLookupParam, javax.servlet.ServletContext servletContext) throws javax.servlet.ServletException, SQLException
getNodeByParams
- Parameters:
request
- aHttpServletRequest
object.nodeLookupParam
- aString
object.- Returns:
- a
OnmsNode
object. - Throws:
javax.servlet.ServletException
- if any.SQLException
- if any.
-
getInterfaceByParams
public static Interface getInterfaceByParams(javax.servlet.http.HttpServletRequest request, javax.servlet.ServletContext servletContext) throws javax.servlet.ServletException, SQLException
getInterfaceByParams
- Parameters:
request
- aHttpServletRequest
object.- Returns:
- a
Interface
object. - Throws:
javax.servlet.ServletException
- if any.SQLException
- if any.
-
getInterfaceByParams
public static Interface getInterfaceByParams(javax.servlet.http.HttpServletRequest request, String ipInterfaceIdParam, String nodeIdParam, String ipAddrParam, javax.servlet.ServletContext servletContext) throws javax.servlet.ServletException, SQLException
getInterfaceByParams
-
getSnmpInterfaceByParams
public static Interface getSnmpInterfaceByParams(javax.servlet.http.HttpServletRequest request, javax.servlet.ServletContext servletContext) throws javax.servlet.ServletException, SQLException
Return interface from snmpinterface table given a servlet request. Intended for use with non-ip interfaces.- Parameters:
request
- aHttpServletRequest
object.- Returns:
- Interface
- Throws:
SQLException
- if any.javax.servlet.ServletException
-
getSnmpInterfaceByParams
public static Interface getSnmpInterfaceByParams(javax.servlet.http.HttpServletRequest request, String nodeIdParam, String ifIndexParam, javax.servlet.ServletContext servletContext) throws javax.servlet.ServletException, 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
- aHttpServletRequest
object.nodeIdParam
- aString
object.ifIndexParam
- aString
object.- Returns:
- Interface
- Throws:
SQLException
- if any.javax.servlet.ServletException
-
getServiceByParams
public static Service getServiceByParams(javax.servlet.http.HttpServletRequest request, javax.servlet.ServletContext servletContext) throws javax.servlet.ServletException, SQLException
getServiceByParams
- Parameters:
request
- aHttpServletRequest
object.- Returns:
- a
Service
object. - Throws:
javax.servlet.ServletException
- if any.SQLException
- if any.
-
getServiceByParams
public static Service getServiceByParams(javax.servlet.http.HttpServletRequest request, String ifServiceIdParam, String nodeIdParam, String ipAddrParam, String serviceIdParam, javax.servlet.ServletContext servletContext) throws javax.servlet.ServletException, SQLException
getServiceByParams
-
getServicesOnNodeByParams
public static Service[] getServicesOnNodeByParams(javax.servlet.http.HttpServletRequest request, int serviceId, javax.servlet.ServletContext servletContext) throws SQLException
getServicesOnNodeByParams
- Parameters:
request
- aHttpServletRequest
object.serviceId
- a int.- Returns:
- an array of
Service
objects. - Throws:
SQLException
- if any.
-
getServicesOnInterface
public static Service[] getServicesOnInterface(int nodeId, String ipAddr, javax.servlet.ServletContext servletContext) throws SQLException
- Throws:
SQLException
-
-