use of org.opennms.web.notification.filter.NodeFilter in project opennms by OpenNMS.
the class WebNotificationRepositoryFilterIT method testNodeFilter.
@Test
// Relies on specific IDs so we need a fresh database
@JUnitTemporaryDatabase
public void testNodeFilter() {
NodeFilter filter = new NodeFilter(1);
assert1Result(filter);
}
use of org.opennms.web.notification.filter.NodeFilter 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;
}
Aggregations