private boolean allowGlobal(final SupportedListener listener, final SessionInfo sessionInfo) { final boolean override = listener.overrideGlobalGag(); return override || getCounter(sessionInfo).allow(); }
private boolean shouldNotify(final SupportedListener listener, final SessionInfo sessionInfo) { final boolean global = allowGlobal(listener, sessionInfo); return global && getSpecificCounter(sessionInfo, listener).allow(); }
private boolean isEnabledInSettings(final SupportedListener listener) { final String propName = getCompositePropertyName(listener, "enabled"); return this.isEnabledInSettings() && config.readBoolean(target, propName, false); }
@Override public <T extends Event> Stream<EventListenerSupplier<T>> findListeners(final Class<T> eventType) { final NotificationEventListenerSupplier<T> l = new NotificationEventListenerSupplier<>(eventType); final long tenants = getTenantConfigurations() .peek(config -> config.registerListener(l)) .count(); if (tenants > 0) { return Stream.of(Target.values()).map(e -> () -> l.apply(e)); } else { return Stream.empty(); } } }
public BalanceUnderMinimumEventListener(final SupportedListener listener, final AbstractTargetHandler handler) { super(listener, handler); this.minimumBalance = handler.getListenerSpecificIntProperty(SupportedListener.BALANCE_UNDER_MINIMUM, "minimumBalance", 200); }
private OptionalInt getListenerSpecificIntProperty(final SupportedListener listener, final String property) { return config.readInt(target, getCompositePropertyName(listener, property)); }
boolean isEnabled(final SupportedListener listener) { final boolean noLongerDelinquentEnabled = listener == SupportedListener.LOAN_NO_LONGER_DELINQUENT && enableNoLongerDelinquentNotifications(); if (noLongerDelinquentEnabled || listener == SupportedListener.TESTING) { // testing is always enabled so that notification testing in the installer has something to work with return true; } else { return isEnabledInSettings(listener); } }
public RefreshableConfigStorage(final URL source) { this.source = source; /* * force the code to have a value right away. this is done to ensure that even the event listeners initialized * immediately after this call have notification properties available - otherwise initial emails of the platform * wouldn't have been sent until this Refreshable has had time to initialize. this has been a problem in the * installer already, as evidenced by https://github.com/RoboZonky/robozonky/issues/216. */ run(); }
@Override public <T extends Event> Stream<EventListenerSupplier<T>> findListeners(final Class<T> eventType) { final NotificationEventListenerSupplier<T> l = new NotificationEventListenerSupplier<>(eventType); final long tenants = getTenantConfigurations() .peek(config -> config.registerListener(l)) .count(); if (tenants > 0) { return Stream.of(Target.values()).map(e -> () -> l.apply(e)); } else { return Stream.empty(); } } }
private boolean allowGlobal(final SupportedListener listener, final SessionInfo sessionInfo) { final boolean override = listener.overrideGlobalGag(); return override || getCounter(sessionInfo).allow(); }
private boolean shouldNotify(final SupportedListener listener, final SessionInfo sessionInfo) { final boolean global = allowGlobal(listener, sessionInfo); return global && getSpecificCounter(sessionInfo, listener).allow(); }
private boolean isEnabledInSettings(final SupportedListener listener) { final String propName = getCompositePropertyName(listener, "enabled"); return this.isEnabledInSettings() && config.readBoolean(target, propName, false); }
public BalanceOnTargetEventListener(final SupportedListener listener, final AbstractTargetHandler handler) { super(listener, handler); this.targetBalance = handler.getListenerSpecificIntProperty(SupportedListener.BALANCE_ON_TARGET, "targetBalance", 200); }
private OptionalInt getListenerSpecificIntProperty(final SupportedListener listener, final String property) { return config.readInt(target, getCompositePropertyName(listener, property)); }
boolean isEnabled(final SupportedListener listener) { final boolean noLongerDelinquentEnabled = listener == SupportedListener.LOAN_NO_LONGER_DELINQUENT && enableNoLongerDelinquentNotifications(); if (noLongerDelinquentEnabled || listener == SupportedListener.TESTING) { // testing is always enabled so that notification testing in the installer has something to work with return true; } else { return isEnabledInSettings(listener); } }
public RefreshableConfigStorage(final URL source) { this.source = source; /* * force the code to have a value right away. this is done to ensure that even the event listeners initialized * immediately after this call have notification properties available - otherwise initial emails of the platform * wouldn't have been sent until this Refreshable has had time to initialize. this has been a problem in the * installer already, as evidenced by https://github.com/RoboZonky/robozonky/issues/216. */ run(); }
public BalanceUnderMinimumEventListener(final SupportedListener listener, final AbstractTargetHandler handler) { super(listener, handler); this.minimumBalance = handler.getListenerSpecificIntProperty(SupportedListener.BALANCE_UNDER_MINIMUM, "minimumBalance", 200); }
public BalanceOnTargetEventListener(final SupportedListener listener, final AbstractTargetHandler handler) { super(listener, handler); this.targetBalance = handler.getListenerSpecificIntProperty(SupportedListener.BALANCE_ON_TARGET, "targetBalance", 200); }