Class DbNotificationPreferenceFilter<T extends NotificationPreferenceBase>
java.lang.Object
io.leandev.appfuse.notification.preference.DbNotificationPreferenceFilter<T>
- Type Parameters:
T- 應用宣告的具體偏好 entity(繼承NotificationPreferenceBase)
- All Implemented Interfaces:
NotificationPreferenceFilter
public class DbNotificationPreferenceFilter<T extends NotificationPreferenceBase>
extends Object
implements NotificationPreferenceFilter
DB-backed 通知偏好過濾(Phase 2 預設,opt-out 模型)
查 NotificationPreferenceBase 的具體實作:有列用其 enabled,無列視為啟用(opt-out)。收件人無
userId 時無從查、一律啟用。
依 ADR-017:泛型化於
NotificationPreferenceBase,依賴 NotificationPreferenceRepositoryBase。查詢不帶 tenantId——
租戶範圍由應用 entity 的 @TenantId filter 於 Session 建構時自動限縮(決策三)。isEnabled 的
tenantId 參數保留於 SPI 相容,不參與查詢。
- Since:
- 4.0.0
-
Constructor Summary
ConstructorsConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionbooleanisEnabled(String type, Recipient recipient, ChannelType channel, String tenantId) 此收件人是否願意以此通道收到此型別的通知
-
Constructor Details
-
DbNotificationPreferenceFilter
- Parameters:
repository- 偏好 repository(應用宣告的具體型別)
-
-
Method Details
-
isEnabled
Description copied from interface:NotificationPreferenceFilter此收件人是否願意以此通道收到此型別的通知- Specified by:
isEnabledin interfaceNotificationPreferenceFilter- Parameters:
type- 通知型別鍵recipient- 收件人(userId為 null 時通常無從查偏好,實作宜回 true)channel- 通道tenantId- 所屬租戶(可為 null)- Returns:
- true = 送;false = 略過此收件人×通道
-