Class AlertSignal
java.lang.Object
com.kingsrook.qqq.backend.core.alerts.AlertSignal
- All Implemented Interfaces:
Serializable
One "this is a problem" signal from a producer, passed to QAlerts.raise.
Raising is idempotent on (alertTypeName, dedupKey): repeats refresh one open
alert, they never duplicate it.
Text fields have different reach. title and summary are external-safe: a
producer must write them without personal data, because they may be sent
to email or chat. details (and record ref labels) are internal: shown
in-app only, to users who can see the alert.
Bounds: at most MAX_RECORD_REFS record refs (extras are dropped, and count
keeps the true total) and MAX_ATTRIBUTES attributes (extras are ignored).
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGetter for alertTypeNameGetter for attributesgetCount()Getter for countGetter for dedupKeyGetter for detailsThe record count this signal describes: count when set, otherwise the number of record refs (null when there are none).The dedup key to use: the one given, or the type name (one alert per type).getLinks()Getter for linksGetter for occurredAtGetter for recordRefsGetter for severityGetter for summarygetTitle()Getter for titlevoidsetAlertTypeName(String alertTypeName) Setter for alertTypeNamevoidsetAttributes(Map<String, String> attributes) Setter for attributesvoidSetter for countvoidsetDedupKey(String dedupKey) Setter for dedupKeyvoidsetDetails(String details) Setter for detailsvoidSetter for linksvoidsetOccurredAt(Instant occurredAt) Setter for occurredAtvoidsetRecordRefs(List<AlertRecordRef> recordRefs) Setter for recordRefsvoidsetSeverity(AlertSeverity severity) Setter for severityvoidsetSummary(String summary) Setter for summaryvoidSetter for titlewithAlertTypeName(String alertTypeName) Fluent setter for alertTypeNamewithAttribute(String key, String value) Add a routing label (not displayed by default).Fluent setter for count - for aggregate alerts, e.g. "37 records".withDedupKey(String dedupKey) Fluent setter for dedupKey - a stable key, so repeats update one open alert.withDetails(String details) Fluent setter for details (internal: in-app only, never sent externally)Add a link to where the problem is fixed.withOccurredAt(Instant occurredAt) Fluent setter for occurredAt (default: when QAlerts.raise is called)withRecordRef(AlertRecordRef recordRef) Add one record ref.withRecordRefs(Collection<AlertRecordRef> recordRefs) Add record refs.withSeverity(AlertSeverity severity) Fluent setter for severity (optional; defaults to the type's severity)withSummary(String summary) Fluent setter for summary (external-safe: no personal data)Fluent setter for title (external-safe: no personal data)
-
Field Details
-
MAX_RECORD_REFS
public static final int MAX_RECORD_REFS- See Also:
-
MAX_ATTRIBUTES
public static final int MAX_ATTRIBUTES- See Also:
-
-
Constructor Details
-
AlertSignal
public AlertSignal()Constructor -
AlertSignal
Constructor
-
-
Method Details
-
getEffectiveDedupKey
The dedup key to use: the one given, or the type name (one alert per type). -
getEffectiveCount
The record count this signal describes: count when set, otherwise the number of record refs (null when there are none). -
getAlertTypeName
Getter for alertTypeName -
setAlertTypeName
Setter for alertTypeName -
withAlertTypeName
Fluent setter for alertTypeName -
getDedupKey
Getter for dedupKey -
setDedupKey
Setter for dedupKey -
withDedupKey
Fluent setter for dedupKey - a stable key, so repeats update one open alert. -
getSeverity
Getter for severity -
setSeverity
Setter for severity -
withSeverity
Fluent setter for severity (optional; defaults to the type's severity) -
getTitle
Getter for title -
setTitle
Setter for title -
withTitle
Fluent setter for title (external-safe: no personal data) -
getSummary
Getter for summary -
setSummary
Setter for summary -
withSummary
Fluent setter for summary (external-safe: no personal data) -
getDetails
Getter for details -
setDetails
Setter for details -
withDetails
Fluent setter for details (internal: in-app only, never sent externally) -
getRecordRefs
Getter for recordRefs -
setRecordRefs
Setter for recordRefs -
withRecordRefs
Add record refs. Beyond MAX_RECORD_REFS they are dropped, and count is set to the true total so the alert still says how many there were. -
withRecordRef
Add one record ref. -
getLinks
-
setLinks
-
withLink
Add a link to where the problem is fixed. -
getAttributes
-
setAttributes
-
withAttribute
Add a routing label (not displayed by default). At most MAX_ATTRIBUTES keys; a new key beyond that is ignored (replacing an existing key is fine). -
getOccurredAt
Getter for occurredAt -
setOccurredAt
Setter for occurredAt -
withOccurredAt
Fluent setter for occurredAt (default: when QAlerts.raise is called) -
getCount
Getter for count -
setCount
Setter for count -
withCount
Fluent setter for count - for aggregate alerts, e.g. "37 records".
-