@Override public Block displayFilter(NotificationFilter filter, NotificationFilterPreference preference) throws NotificationException { /** * Try to find a {@link NotificationFilterDisplayer} that corresponds to the given filter. * If no renderer is found, fallback on the default one. */ try { List<NotificationFilterDisplayer> renderers = componentManager.getInstanceList(NotificationFilterDisplayer.class); for (NotificationFilterDisplayer renderer : renderers) { if (renderer.getSupportedFilters().contains(filter.getName())) { return renderer.display(filter, preference); } } return defaultNotificationFilterDisplayer.display(filter, preference); } catch (ComponentLookupException e) { throw new NotificationException(String.format( "Unable get a list of NotificationFilterDisplayer for filter [%s].", filter), e); } } }
@Override public Block display(NotificationFilter filter, NotificationFilterPreference preference) throws NotificationException { try { setUpContext(scriptContextManager, filter, preference); // If we have no template defined, fallback on the default displayer if (filterTemplate == null) { return ((NotificationFilterDisplayer) componentManager.getInstance(NotificationFilterDisplayer.class)) .display(filter, preference); } return templateManager.execute(filterTemplate); } catch (Exception e) { throw new NotificationException( String.format("Unable to display the notification filter template for the filters [%s].", componentHint), e); } finally { cleanUpContext(); } }