import java.text.SimpleDateFormat;
import java.util.*;
-
+/** The FilterEngine manages a list of all filters and filter groups.
+ * Use the testPosting() method to apply all filters on an
+ * Entity (for ex. an article or a comment)
+ */
public class FilterEngine {
private Map filterTypes;
private List filterTypeIds;
dateFormat.setTimeZone(TimeZone.getTimeZone(configuration.getString("Mir.DefaultTimezone")));
reload();
}
-
+ /** applies all filters from all filter groups to an Entity.
+ * The entity may be, for example, an article, or a comment.
+ */
public Filter testPosting(Entity anEntity, Request aRequest) {
Iterator i = filterGroups.iterator();
while (i.hasNext()) {
throw new RuntimeException("can't get article actions");
}
}
-
+ /** This class reflects a row of the filter_group
+ * database table. Filters groups allow you to organize
+ * your filters. For example: group1=spammer ,
+ * group2=nazis etc.
+ */
public class FilterGroup {
private List filters;
private Entity entity;
return entity.getFieldValue("name");
}
}
-
+ /** This class reflects a row of the filter database table.
+ * To actually run a filter on data, use the test() method.
+ * This class will automatically retreive and use the correct
+ * filter type.
+ */
public class Filter {
private Entity entity;
private FilterInstance instance;
\r
import mir.entity.Entity;\r
import mir.session.Request;\r
-\r
+/**\r
+ * Classes implementing this interface provide the test() method\r
+ * that actually does the filtering work (ie. matching the \r
+ * data). The description of a filter is found in classes \r
+ * implementing FilterType \r
+ */\r
public interface FilterInstance {\r
/**\r
* Must return <code>true</code> if the posting matches the filter.\r
/**
- * Interface to define filter types for the anti-abuse system
+ * Interface to define filter types for the anti-abuse system.
+ * Implementing classes provide a description of the filter.
+ * The actual filtering work is done by classes implementing
+ * the FilterInstance interface. That class is provided by the
+ * constructFilterInstance method
*/
public interface FilterType {