Search in sources :

Example 1 with NegativeSeverityFilter

use of org.opennms.web.alarm.filter.NegativeSeverityFilter in project opennms by OpenNMS.

the class AlarmUtil method getFilter.

/**
     * <p>getFilter</p>
     *
     * @param filterString a {@link java.lang.String} object.
     * @return a {@link org.opennms.web.filter.Filter} object.
     */
public static Filter getFilter(String filterString, ServletContext servletContext) {
    if (filterString == null) {
        throw new IllegalArgumentException("Cannot take null parameters.");
    }
    Filter filter = null;
    String[] tempTokens = filterString.split("=");
    String type;
    String value;
    try {
        type = tempTokens[0];
        String[] values = (String[]) ArrayUtils.remove(tempTokens, 0);
        value = org.apache.commons.lang.StringUtils.join(values, "=");
    } catch (NoSuchElementException e) {
        throw new IllegalArgumentException("Could not tokenize filter string: " + filterString);
    }
    if (type.equals(SeverityFilter.TYPE)) {
        filter = new SeverityFilter(OnmsSeverity.get(WebSecurityUtils.safeParseInt(value)));
    } else if (type.equals(NodeFilter.TYPE)) {
        filter = new NodeFilter(WebSecurityUtils.safeParseInt(value), servletContext);
    } else if (type.equals(NodeNameLikeFilter.TYPE)) {
        filter = new NodeNameLikeFilter(value);
    } else if (type.equals(InterfaceFilter.TYPE)) {
        filter = new InterfaceFilter(InetAddressUtils.addr(value));
    } else if (type.equals(ServiceFilter.TYPE)) {
        filter = new ServiceFilter(WebSecurityUtils.safeParseInt(value), servletContext);
    } else if (type.equals(PartialUEIFilter.TYPE)) {
        filter = new PartialUEIFilter(value);
    } else if (type.equals(ExactUEIFilter.TYPE)) {
        filter = new ExactUEIFilter(value);
    } else if (type.equals(AcknowledgedByFilter.TYPE)) {
        filter = new AcknowledgedByFilter(value);
    } else if (type.equals(NegativeSeverityFilter.TYPE)) {
        filter = new NegativeSeverityFilter(OnmsSeverity.get(WebSecurityUtils.safeParseInt(value)));
    } else if (type.equals(NegativeNodeFilter.TYPE)) {
        filter = new NegativeNodeFilter(WebSecurityUtils.safeParseInt(value), servletContext);
    } else if (type.equals(NegativeInterfaceFilter.TYPE)) {
        filter = new NegativeInterfaceFilter(InetAddressUtils.addr(value));
    } else if (type.equals(NegativeServiceFilter.TYPE)) {
        filter = new NegativeServiceFilter(WebSecurityUtils.safeParseInt(value), servletContext);
    } else if (type.equals(NegativePartialUEIFilter.TYPE)) {
        filter = new NegativePartialUEIFilter(value);
    } else if (type.equals(NegativeExactUEIFilter.TYPE)) {
        filter = new NegativeExactUEIFilter(value);
    } else if (type.equals(NegativeAcknowledgedByFilter.TYPE)) {
        filter = new NegativeAcknowledgedByFilter(value);
    } else if (type.equals(IPAddrLikeFilter.TYPE)) {
        filter = new IPAddrLikeFilter(value);
    } else if (type.equals(LogMessageSubstringFilter.TYPE)) {
        filter = new LogMessageSubstringFilter(value);
    } else if (type.equals(LogMessageMatchesAnyFilter.TYPE)) {
        filter = new LogMessageMatchesAnyFilter(value);
    } else if (type.equals(BeforeLastEventTimeFilter.TYPE)) {
        filter = new BeforeLastEventTimeFilter(WebSecurityUtils.safeParseLong(value));
    } else if (type.equals(BeforeFirstEventTimeFilter.TYPE)) {
        filter = new BeforeFirstEventTimeFilter(WebSecurityUtils.safeParseLong(value));
    } else if (type.equals(AfterLastEventTimeFilter.TYPE)) {
        filter = new AfterLastEventTimeFilter(WebSecurityUtils.safeParseLong(value));
    } else if (type.equals(AfterFirstEventTimeFilter.TYPE)) {
        filter = new AfterFirstEventTimeFilter(WebSecurityUtils.safeParseLong(value));
    } else if (type.equals(EventParmLikeFilter.TYPE)) {
        filter = new EventParmLikeFilter(value);
    } else if (type.equals(NegativeEventParmLikeFilter.TYPE)) {
        filter = new NegativeEventParmLikeFilter(value);
    } else if (type.equals(LocationFilter.TYPE)) {
        filter = new LocationFilter(value);
    } else if (type.equals(NegativeLocationFilter.TYPE)) {
        filter = new NegativeLocationFilter(value);
    } else if (type.equals(NodeLocationFilter.TYPE)) {
        filter = new NodeLocationFilter(value);
    } else if (type.equals(NegativeNodeLocationFilter.TYPE)) {
        filter = new NegativeNodeLocationFilter(value);
    }
    return filter;
}
Also used : NegativeServiceFilter(org.opennms.web.alarm.filter.NegativeServiceFilter) ServiceFilter(org.opennms.web.alarm.filter.ServiceFilter) NegativeInterfaceFilter(org.opennms.web.alarm.filter.NegativeInterfaceFilter) InterfaceFilter(org.opennms.web.alarm.filter.InterfaceFilter) NegativePartialUEIFilter(org.opennms.web.alarm.filter.NegativePartialUEIFilter) LogMessageSubstringFilter(org.opennms.web.alarm.filter.LogMessageSubstringFilter) NegativePartialUEIFilter(org.opennms.web.alarm.filter.NegativePartialUEIFilter) PartialUEIFilter(org.opennms.web.alarm.filter.PartialUEIFilter) AfterLastEventTimeFilter(org.opennms.web.alarm.filter.AfterLastEventTimeFilter) LogMessageMatchesAnyFilter(org.opennms.web.alarm.filter.LogMessageMatchesAnyFilter) BeforeLastEventTimeFilter(org.opennms.web.alarm.filter.BeforeLastEventTimeFilter) NegativeSeverityFilter(org.opennms.web.alarm.filter.NegativeSeverityFilter) NegativeServiceFilter(org.opennms.web.alarm.filter.NegativeServiceFilter) NegativeAcknowledgedByFilter(org.opennms.web.alarm.filter.NegativeAcknowledgedByFilter) NodeNameLikeFilter(org.opennms.web.alarm.filter.NodeNameLikeFilter) IPAddrLikeFilter(org.opennms.web.alarm.filter.IPAddrLikeFilter) NegativeNodeFilter(org.opennms.web.alarm.filter.NegativeNodeFilter) NegativeAcknowledgedByFilter(org.opennms.web.alarm.filter.NegativeAcknowledgedByFilter) AcknowledgedByFilter(org.opennms.web.alarm.filter.AcknowledgedByFilter) NegativeExactUEIFilter(org.opennms.web.alarm.filter.NegativeExactUEIFilter) ExactUEIFilter(org.opennms.web.alarm.filter.ExactUEIFilter) NegativeEventParmLikeFilter(org.opennms.web.alarm.filter.NegativeEventParmLikeFilter) EventParmLikeFilter(org.opennms.web.alarm.filter.EventParmLikeFilter) NegativeInterfaceFilter(org.opennms.web.alarm.filter.NegativeInterfaceFilter) NegativeSeverityFilter(org.opennms.web.alarm.filter.NegativeSeverityFilter) SeverityFilter(org.opennms.web.alarm.filter.SeverityFilter) NegativeNodeLocationFilter(org.opennms.web.alarm.filter.NegativeNodeLocationFilter) NodeLocationFilter(org.opennms.web.alarm.filter.NodeLocationFilter) NegativeLocationFilter(org.opennms.web.alarm.filter.NegativeLocationFilter) NegativeNodeLocationFilter(org.opennms.web.alarm.filter.NegativeNodeLocationFilter) NegativeExactUEIFilter(org.opennms.web.alarm.filter.NegativeExactUEIFilter) IPAddrLikeFilter(org.opennms.web.alarm.filter.IPAddrLikeFilter) ExactUEIFilter(org.opennms.web.alarm.filter.ExactUEIFilter) NegativeLocationFilter(org.opennms.web.alarm.filter.NegativeLocationFilter) NegativeServiceFilter(org.opennms.web.alarm.filter.NegativeServiceFilter) LogMessageMatchesAnyFilter(org.opennms.web.alarm.filter.LogMessageMatchesAnyFilter) NegativeInterfaceFilter(org.opennms.web.alarm.filter.NegativeInterfaceFilter) AfterLastEventTimeFilter(org.opennms.web.alarm.filter.AfterLastEventTimeFilter) NegativeEventParmLikeFilter(org.opennms.web.alarm.filter.NegativeEventParmLikeFilter) NegativeSeverityFilter(org.opennms.web.alarm.filter.NegativeSeverityFilter) LogMessageSubstringFilter(org.opennms.web.alarm.filter.LogMessageSubstringFilter) NegativePartialUEIFilter(org.opennms.web.alarm.filter.NegativePartialUEIFilter) ServiceFilter(org.opennms.web.alarm.filter.ServiceFilter) AfterFirstEventTimeFilter(org.opennms.web.alarm.filter.AfterFirstEventTimeFilter) NegativeNodeFilter(org.opennms.web.alarm.filter.NegativeNodeFilter) EventParmLikeFilter(org.opennms.web.alarm.filter.EventParmLikeFilter) InterfaceFilter(org.opennms.web.alarm.filter.InterfaceFilter) SeverityFilter(org.opennms.web.alarm.filter.SeverityFilter) Filter(org.opennms.web.filter.Filter) NegativeAcknowledgedByFilter(org.opennms.web.alarm.filter.NegativeAcknowledgedByFilter) PartialUEIFilter(org.opennms.web.alarm.filter.PartialUEIFilter) NegativeNodeLocationFilter(org.opennms.web.alarm.filter.NegativeNodeLocationFilter) NodeFilter(org.opennms.web.alarm.filter.NodeFilter) NodeLocationFilter(org.opennms.web.alarm.filter.NodeLocationFilter) NodeNameLikeFilter(org.opennms.web.alarm.filter.NodeNameLikeFilter) BeforeLastEventTimeFilter(org.opennms.web.alarm.filter.BeforeLastEventTimeFilter) AcknowledgedByFilter(org.opennms.web.alarm.filter.AcknowledgedByFilter) LocationFilter(org.opennms.web.alarm.filter.LocationFilter) BeforeFirstEventTimeFilter(org.opennms.web.alarm.filter.BeforeFirstEventTimeFilter) NegativeLocationFilter(org.opennms.web.alarm.filter.NegativeLocationFilter) NegativeNodeLocationFilter(org.opennms.web.alarm.filter.NegativeNodeLocationFilter) NodeLocationFilter(org.opennms.web.alarm.filter.NodeLocationFilter) LocationFilter(org.opennms.web.alarm.filter.LocationFilter) NegativeExactUEIFilter(org.opennms.web.alarm.filter.NegativeExactUEIFilter) AfterFirstEventTimeFilter(org.opennms.web.alarm.filter.AfterFirstEventTimeFilter) NegativeEventParmLikeFilter(org.opennms.web.alarm.filter.NegativeEventParmLikeFilter) NoSuchElementException(java.util.NoSuchElementException) BeforeFirstEventTimeFilter(org.opennms.web.alarm.filter.BeforeFirstEventTimeFilter) NegativeNodeFilter(org.opennms.web.alarm.filter.NegativeNodeFilter) NodeFilter(org.opennms.web.alarm.filter.NodeFilter)

Aggregations

NoSuchElementException (java.util.NoSuchElementException)1 AcknowledgedByFilter (org.opennms.web.alarm.filter.AcknowledgedByFilter)1 AfterFirstEventTimeFilter (org.opennms.web.alarm.filter.AfterFirstEventTimeFilter)1 AfterLastEventTimeFilter (org.opennms.web.alarm.filter.AfterLastEventTimeFilter)1 BeforeFirstEventTimeFilter (org.opennms.web.alarm.filter.BeforeFirstEventTimeFilter)1 BeforeLastEventTimeFilter (org.opennms.web.alarm.filter.BeforeLastEventTimeFilter)1 EventParmLikeFilter (org.opennms.web.alarm.filter.EventParmLikeFilter)1 ExactUEIFilter (org.opennms.web.alarm.filter.ExactUEIFilter)1 IPAddrLikeFilter (org.opennms.web.alarm.filter.IPAddrLikeFilter)1 InterfaceFilter (org.opennms.web.alarm.filter.InterfaceFilter)1 LocationFilter (org.opennms.web.alarm.filter.LocationFilter)1 LogMessageMatchesAnyFilter (org.opennms.web.alarm.filter.LogMessageMatchesAnyFilter)1 LogMessageSubstringFilter (org.opennms.web.alarm.filter.LogMessageSubstringFilter)1 NegativeAcknowledgedByFilter (org.opennms.web.alarm.filter.NegativeAcknowledgedByFilter)1 NegativeEventParmLikeFilter (org.opennms.web.alarm.filter.NegativeEventParmLikeFilter)1 NegativeExactUEIFilter (org.opennms.web.alarm.filter.NegativeExactUEIFilter)1 NegativeInterfaceFilter (org.opennms.web.alarm.filter.NegativeInterfaceFilter)1 NegativeLocationFilter (org.opennms.web.alarm.filter.NegativeLocationFilter)1 NegativeNodeFilter (org.opennms.web.alarm.filter.NegativeNodeFilter)1 NegativeNodeLocationFilter (org.opennms.web.alarm.filter.NegativeNodeLocationFilter)1