Class AlertSignal

java.lang.Object
com.kingsrook.qqq.backend.core.alerts.AlertSignal
All Implemented Interfaces:
Serializable

public class AlertSignal extends Object implements 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 Details

  • Constructor Details

    • AlertSignal

      public AlertSignal()
      Constructor
    • AlertSignal

      public AlertSignal(String alertTypeName)
      Constructor
  • Method Details

    • getEffectiveDedupKey

      public String getEffectiveDedupKey()
      The dedup key to use: the one given, or the type name (one alert per type).
    • getEffectiveCount

      public Integer getEffectiveCount()
      The record count this signal describes: count when set, otherwise the number of record refs (null when there are none).
    • getAlertTypeName

      public String getAlertTypeName()
      Getter for alertTypeName
    • setAlertTypeName

      public void setAlertTypeName(String alertTypeName)
      Setter for alertTypeName
    • withAlertTypeName

      public AlertSignal withAlertTypeName(String alertTypeName)
      Fluent setter for alertTypeName
    • getDedupKey

      public String getDedupKey()
      Getter for dedupKey
    • setDedupKey

      public void setDedupKey(String dedupKey)
      Setter for dedupKey
    • withDedupKey

      public AlertSignal withDedupKey(String dedupKey)
      Fluent setter for dedupKey - a stable key, so repeats update one open alert.
    • getSeverity

      public AlertSeverity getSeverity()
      Getter for severity
    • setSeverity

      public void setSeverity(AlertSeverity severity)
      Setter for severity
    • withSeverity

      public AlertSignal withSeverity(AlertSeverity severity)
      Fluent setter for severity (optional; defaults to the type's severity)
    • getTitle

      public String getTitle()
      Getter for title
    • setTitle

      public void setTitle(String title)
      Setter for title
    • withTitle

      public AlertSignal withTitle(String title)
      Fluent setter for title (external-safe: no personal data)
    • getSummary

      public String getSummary()
      Getter for summary
    • setSummary

      public void setSummary(String summary)
      Setter for summary
    • withSummary

      public AlertSignal withSummary(String summary)
      Fluent setter for summary (external-safe: no personal data)
    • getDetails

      public String getDetails()
      Getter for details
    • setDetails

      public void setDetails(String details)
      Setter for details
    • withDetails

      public AlertSignal withDetails(String details)
      Fluent setter for details (internal: in-app only, never sent externally)
    • getRecordRefs

      public List<AlertRecordRef> getRecordRefs()
      Getter for recordRefs
    • setRecordRefs

      public void setRecordRefs(List<AlertRecordRef> recordRefs)
      Setter for recordRefs
    • withRecordRefs

      public AlertSignal withRecordRefs(Collection<AlertRecordRef> recordRefs)
      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

      public AlertSignal withRecordRef(AlertRecordRef recordRef)
      Add one record ref.
    • getLinks

      public List<AlertLink> getLinks()
      Getter for links
    • setLinks

      public void setLinks(List<AlertLink> links)
      Setter for links
    • withLink

      public AlertSignal withLink(AlertLink link)
      Add a link to where the problem is fixed.
    • getAttributes

      public Map<String,String> getAttributes()
      Getter for attributes
    • setAttributes

      public void setAttributes(Map<String,String> attributes)
      Setter for attributes
    • withAttribute

      public AlertSignal withAttribute(String key, String value)
      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

      public Instant getOccurredAt()
      Getter for occurredAt
    • setOccurredAt

      public void setOccurredAt(Instant occurredAt)
      Setter for occurredAt
    • withOccurredAt

      public AlertSignal withOccurredAt(Instant occurredAt)
      Fluent setter for occurredAt (default: when QAlerts.raise is called)
    • getCount

      public Integer getCount()
      Getter for count
    • setCount

      public void setCount(Integer count)
      Setter for count
    • withCount

      public AlertSignal withCount(Integer count)
      Fluent setter for count - for aggregate alerts, e.g. "37 records".