use of org.jowidgets.cap.common.api.plugin.IBeanDtoCustomFilterPlugin in project jo-client-platform by jo-source.
the class BeanDtoFilterImpl method acceptCustom.
private boolean acceptCustom(final IBeanDto beanDto, final ICustomFilter filter) {
Assert.paramNotEmpty(filter.getFilterType(), "filter.getFilterType()");
final IPluginPropertiesBuilder propertiesBuilder = PluginToolkit.pluginPropertiesBuilder();
propertiesBuilder.add(IBeanDtoCustomFilterPlugin.FILTER_TYPE_PROPERTY_KEY, filter.getFilterType());
final List<IBeanDtoCustomFilterPlugin> plugins;
plugins = PluginProvider.getPlugins(IBeanDtoCustomFilterPlugin.ID, propertiesBuilder.build());
if (plugins.size() == 0) {
throw new IllegalStateException("No '" + IBeanDtoCustomFilterPlugin.class.getName() + "' implementation found for the filter type '" + filter.getFilterType() + "'");
}
for (final IBeanDtoCustomFilterPlugin plugin : plugins) {
// plug in has to negate result itself if filter is inverted
if (!plugin.accept(beanDto, filter)) {
return false;
}
}
return true;
}
Aggregations