use of org.opennms.web.event.filter.BeforeDateFilter in project opennms by OpenNMS.
the class EventUtil method getFilter.
/**
* <p>getFilter</p>
*
* @param filterString a {@link java.lang.String} object.
* @return a 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;
StringTokenizer tokens = new StringTokenizer(filterString, "=");
String type;
String value;
try {
type = tokens.nextToken();
value = tokens.nextToken();
} catch (NoSuchElementException e) {
throw new IllegalArgumentException("Could not tokenize filter string: " + filterString);
}
if (type.equals(SeverityFilter.TYPE)) {
filter = new SeverityFilter(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(value);
} else if (type.equals(ServiceFilter.TYPE)) {
filter = new ServiceFilter(WebSecurityUtils.safeParseInt(value), servletContext);
} else if (type.equals(IfIndexFilter.TYPE)) {
filter = new IfIndexFilter(WebSecurityUtils.safeParseInt(value));
} 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(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(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(EventIdFilter.TYPE)) {
filter = new EventIdFilter(WebSecurityUtils.safeParseInt(value));
} else if (type.equals(EventIdFilter.TYPE)) {
filter = new EventIdFilter(WebSecurityUtils.safeParseInt(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(BeforeDateFilter.TYPE)) {
filter = new BeforeDateFilter(WebSecurityUtils.safeParseLong(value));
} else if (type.equals(AfterDateFilter.TYPE)) {
filter = new AfterDateFilter(WebSecurityUtils.safeParseLong(value));
} else if (type.equals(AlarmIDFilter.TYPE)) {
filter = new AlarmIDFilter(WebSecurityUtils.safeParseInt(value));
} else if (type.equals(LocationFilter.TYPE)) {
filter = new LocationFilter(WebSecurityUtils.sanitizeString(value));
} else if (type.equals(SystemIdFilter.TYPE)) {
filter = new SystemIdFilter(WebSecurityUtils.sanitizeString(value));
} else if (type.equals(NegativeLocationFilter.TYPE)) {
filter = new NegativeLocationFilter(WebSecurityUtils.sanitizeString(value));
} else if (type.equals(NegativeSystemIdFilter.TYPE)) {
filter = new NegativeSystemIdFilter(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