Search in sources :

Example 1 with UserFilter

use of org.opennms.web.notification.filter.UserFilter in project opennms by OpenNMS.

the class WebNotificationRepositoryFilterIT method testUserFilter.

@Test
@Transactional
public void testUserFilter() {
    UserFilter filter = new UserFilter("TestUser");
    assert1Result(filter);
}
Also used : UserFilter(org.opennms.web.notification.filter.UserFilter) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with UserFilter

use of org.opennms.web.notification.filter.UserFilter in project opennms by OpenNMS.

the class NoticeUtil method getFilter.

/**
     * <p>getFilter</p>
     *
     * @param filterString a {@link java.lang.String} object.
     * @return a org$opennms$web$filter$Filter object.
     */
public static org.opennms.web.filter.Filter getFilter(String filterString, ServletContext servletContext) {
    Filter filter = null;
    StringTokenizer tokens = new StringTokenizer(filterString, "=");
    String type = tokens.nextToken();
    String value;
    try {
        value = tokens.nextToken();
    } catch (NoSuchElementException e) {
        // No value was specified, return null for this filter
        return null;
    }
    if (type.equals(AcknowledgedByFilter.TYPE)) {
        filter = new AcknowledgedByFilter(value);
    } else if (type.equals(InterfaceFilter.TYPE)) {
        filter = new InterfaceFilter(value);
    } else if (type.equals(NodeFilter.TYPE)) {
        filter = new NodeFilter(WebSecurityUtils.safeParseInt(value));
    } else if (type.equals(NegativeNodeFilter.TYPE)) {
        filter = new NegativeNodeFilter(WebSecurityUtils.safeParseInt(value), servletContext);
    } else if (type.equals(NotificationIdFilter.TYPE)) {
        filter = new NotificationIdFilter(WebSecurityUtils.safeParseInt(value));
    } else if (type.equals(ResponderFilter.TYPE)) {
        filter = new ResponderFilter(value);
    } else if (type.equals(ServiceFilter.TYPE)) {
        filter = new ServiceFilter(WebSecurityUtils.safeParseInt(value), servletContext);
    } else if (type.equals(UserFilter.TYPE)) {
        filter = new UserFilter(value);
    } else if (type.equals(SeverityFilter.TYPE)) {
        filter = new SeverityFilter(OnmsSeverity.get(value));
    } else if (type.equals(LocationFilter.TYPE)) {
        filter = new LocationFilter(WebSecurityUtils.sanitizeString(value));
    } else if (type.equals(NegativeLocationFilter.TYPE)) {
        filter = new NegativeLocationFilter(WebSecurityUtils.sanitizeString(value));
    } else if (type.equals(NodeLocationFilter.TYPE)) {
        filter = new NodeLocationFilter(WebSecurityUtils.sanitizeString(value));
    } else if (type.equals(NegativeNodeLocationFilter.TYPE)) {
        filter = new NegativeNodeLocationFilter(WebSecurityUtils.sanitizeString(value));
    }
    return filter;
}
Also used : ResponderFilter(org.opennms.web.notification.filter.ResponderFilter) ServiceFilter(org.opennms.web.notification.filter.ServiceFilter) InterfaceFilter(org.opennms.web.notification.filter.InterfaceFilter) NotificationIdFilter(org.opennms.web.notification.filter.NotificationIdFilter) NegativeNodeFilter(org.opennms.web.notification.filter.NegativeNodeFilter) UserFilter(org.opennms.web.notification.filter.UserFilter) AcknowledgedByFilter(org.opennms.web.notification.filter.AcknowledgedByFilter) SeverityFilter(org.opennms.web.notification.filter.SeverityFilter) NodeLocationFilter(org.opennms.web.notification.filter.NodeLocationFilter) NegativeNodeLocationFilter(org.opennms.web.notification.filter.NegativeNodeLocationFilter) StringTokenizer(java.util.StringTokenizer) NegativeLocationFilter(org.opennms.web.notification.filter.NegativeLocationFilter) NegativeNodeLocationFilter(org.opennms.web.notification.filter.NegativeNodeLocationFilter) AcknowledgedByFilter(org.opennms.web.notification.filter.AcknowledgedByFilter) Filter(org.opennms.web.filter.Filter) InterfaceFilter(org.opennms.web.notification.filter.InterfaceFilter) SeverityFilter(org.opennms.web.notification.filter.SeverityFilter) NegativeLocationFilter(org.opennms.web.notification.filter.NegativeLocationFilter) NodeFilter(org.opennms.web.notification.filter.NodeFilter) NotificationIdFilter(org.opennms.web.notification.filter.NotificationIdFilter) NegativeNodeFilter(org.opennms.web.notification.filter.NegativeNodeFilter) ServiceFilter(org.opennms.web.notification.filter.ServiceFilter) LocationFilter(org.opennms.web.notification.filter.LocationFilter) NodeLocationFilter(org.opennms.web.notification.filter.NodeLocationFilter) ResponderFilter(org.opennms.web.notification.filter.ResponderFilter) NegativeNodeLocationFilter(org.opennms.web.notification.filter.NegativeNodeLocationFilter) UserFilter(org.opennms.web.notification.filter.UserFilter) NegativeLocationFilter(org.opennms.web.notification.filter.NegativeLocationFilter) LocationFilter(org.opennms.web.notification.filter.LocationFilter) NodeLocationFilter(org.opennms.web.notification.filter.NodeLocationFilter) NegativeNodeLocationFilter(org.opennms.web.notification.filter.NegativeNodeLocationFilter) NoSuchElementException(java.util.NoSuchElementException) NodeFilter(org.opennms.web.notification.filter.NodeFilter) NegativeNodeFilter(org.opennms.web.notification.filter.NegativeNodeFilter)

Aggregations

UserFilter (org.opennms.web.notification.filter.UserFilter)2 NoSuchElementException (java.util.NoSuchElementException)1 StringTokenizer (java.util.StringTokenizer)1 Test (org.junit.Test)1 Filter (org.opennms.web.filter.Filter)1 AcknowledgedByFilter (org.opennms.web.notification.filter.AcknowledgedByFilter)1 InterfaceFilter (org.opennms.web.notification.filter.InterfaceFilter)1 LocationFilter (org.opennms.web.notification.filter.LocationFilter)1 NegativeLocationFilter (org.opennms.web.notification.filter.NegativeLocationFilter)1 NegativeNodeFilter (org.opennms.web.notification.filter.NegativeNodeFilter)1 NegativeNodeLocationFilter (org.opennms.web.notification.filter.NegativeNodeLocationFilter)1 NodeFilter (org.opennms.web.notification.filter.NodeFilter)1 NodeLocationFilter (org.opennms.web.notification.filter.NodeLocationFilter)1 NotificationIdFilter (org.opennms.web.notification.filter.NotificationIdFilter)1 ResponderFilter (org.opennms.web.notification.filter.ResponderFilter)1 ServiceFilter (org.opennms.web.notification.filter.ServiceFilter)1 SeverityFilter (org.opennms.web.notification.filter.SeverityFilter)1 Transactional (org.springframework.transaction.annotation.Transactional)1