Class ElementUtil


  • public abstract class ElementUtil
    extends java.lang.Object

    ElementUtil class.

    Since:
    1.8.1
    Version:
    $Id: $
    Author:
    ranger
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int DEFAULT_TRUNCATE_THRESHOLD
      Constant DEFAULT_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.String getIfStatusString​(int ifStatusNum)  
      static java.lang.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, java.lang.String ipInterfaceIdParam, java.lang.String nodeIdParam, java.lang.String ipAddrParam, javax.servlet.ServletContext servletContext)
      getInterfaceByParams
      static Interface getInterfaceByParams​(javax.servlet.http.HttpServletRequest request, javax.servlet.ServletContext servletContext)
      getInterfaceByParams
      static java.lang.String getInterfaceStatusString​(char c)
      Return the human-readable name for a interface status character, may be null.
      static java.lang.String getInterfaceStatusString​(Interface intf)
      Return the human-readable name for a interface's status, may be null.
      static java.lang.String getIpRouteProtocolString​(int iprouteprotocol)  
      static java.lang.String getIpRouteTypeString​(int iproutetype)  
      static OnmsNode getNodeByParams​(javax.servlet.http.HttpServletRequest request, java.lang.String nodeLookupParam, javax.servlet.ServletContext servletContext)
      getNodeByParams
      static OnmsNode getNodeByParams​(javax.servlet.http.HttpServletRequest request, javax.servlet.ServletContext servletContext)
      getNodeByParams
      static java.lang.String getNodeStatusString​(OnmsNode node)
      Return the human-readable name for a node's status, may be null.
      static java.lang.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, java.lang.String ifServiceIdParam, java.lang.String nodeIdParam, java.lang.String ipAddrParam, java.lang.String serviceIdParam, javax.servlet.ServletContext servletContext)
      getServiceByParams
      static Service getServiceByParams​(javax.servlet.http.HttpServletRequest request, javax.servlet.ServletContext servletContext)
      getServiceByParams
      static 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)
      getServicesOnNodeByParams
      static java.lang.String getServiceStatusString​(char c)
      Return the human-readable name for a service status character, may be null.
      static java.lang.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, 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 Interface getSnmpInterfaceByParams​(javax.servlet.http.HttpServletRequest request, javax.servlet.ServletContext servletContext)
      Return interface from snmpinterface table given a servlet request.
      static java.lang.String getSnmpInterfaceStatusString​(char c)
      Return the human-readable name for a interface status character, may be null.
      static java.lang.String getSnmpInterfaceStatusString​(Interface intf)
      Return the human-readable name for an SNMP interface's status, may be null.
      static boolean hasLocallyMonitoredServices​(Service[] svcs)
      hasLocallyMonitoredServices
      static java.lang.String truncateLabel​(java.lang.String label)
      truncateLabel
      static java.lang.String truncateLabel​(java.lang.String label, int truncateThreshold)
      truncateLabel
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEFAULT_TRUNCATE_THRESHOLD

        public static final int DEFAULT_TRUNCATE_THRESHOLD
        Constant DEFAULT_TRUNCATE_THRESHOLD=28
        See Also:
        Constant Field Values
    • Constructor Detail

      • ElementUtil

        public ElementUtil()
    • 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 String object.
      • getNodeStatusString

        public static java.lang.String getNodeStatusString​(OnmsNode node)
        Return the human-readable name for a node's status, may be null.
        Parameters:
        node - a OnmsNode object.
        Returns:
        a String object.
      • 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 String object.
      • getInterfaceStatusString

        public static java.lang.String getInterfaceStatusString​(Interface intf)
        Return the human-readable name for a interface's status, may be null.
        Parameters:
        intf - a Interface object.
        Returns:
        a String object.
      • 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 String object.
      • 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 - a Interface object.
        Returns:
        a String object.
      • 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 String object.
      • getServiceStatusString

        public static java.lang.String getServiceStatusString​(Service svc)
        Return the human-readable name for a service's status, may be null.
        Parameters:
        svc - a Service object.
        Returns:
        a String object.
      • 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 String object.
      • hasLocallyMonitoredServices

        public static boolean hasLocallyMonitoredServices​(Service[] svcs)

        hasLocallyMonitoredServices

        Parameters:
        svcs - an array of Service objects.
        Returns:
        a boolean.
      • truncateLabel

        public static java.lang.String truncateLabel​(java.lang.String label)

        truncateLabel

        Parameters:
        label - a String object.
        Returns:
        a String object.
      • truncateLabel

        public static java.lang.String truncateLabel​(java.lang.String label,
                                                     int truncateThreshold)

        truncateLabel

        Parameters:
        label - a String object.
        truncateThreshold - a int.
        Returns:
        a String object.
      • getNodeByParams

        public static OnmsNode getNodeByParams​(javax.servlet.http.HttpServletRequest request,
                                               javax.servlet.ServletContext servletContext)
                                        throws javax.servlet.ServletException,
                                               java.sql.SQLException

        getNodeByParams

        Parameters:
        request - a HttpServletRequest object.
        Returns:
        a OnmsNode object.
        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 - a HttpServletRequest object.
        nodeLookupParam - a String object.
        Returns:
        a OnmsNode object.
        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 - a HttpServletRequest object.
        Returns:
        a Interface object.
        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 - a HttpServletRequest object.
        ipInterfaceIdParam - a String object.
        nodeIdParam - a String object.
        ipAddrParam - a String object.
        ifIndexParam - a String object.
        Returns:
        a Interface object.
        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 - a HttpServletRequest object.
        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 - a HttpServletRequest object.
        nodeIdParam - a String object.
        ifIndexParam - a String object.
        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 - a HttpServletRequest object.
        Returns:
        a Service object.
        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 - a HttpServletRequest object.
        ifServiceIdParam - a String object.
        nodeIdParam - a String object.
        ipAddrParam - a String object.
        serviceIdParam - a String object.
        Returns:
        a Service object.
        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 - a HttpServletRequest object.
        serviceId - a int.
        Returns:
        an array of Service objects.
        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