Package com.collibra.workflow.notifications.api.notification

# Interface NotificationBuilder

public interface NotificationBuilder
Fluent builder for composing a notification request.

A notification requires at least a `subject`, `content`, and at least one recipient (via `recipientUsers` or `recipientGroups`). A `resource` is optional.

### Guardrails

- Content blocks are limited to 20; blocks beyond the limit are silently dropped.
- All literal text values and translation key params are trimmed to 250 characters.
- Translation key params are limited to 10 per block.

See Also:
  - `NotificationApi.send(Consumer)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `NotificationBuilder`
  `content(Consumer<ContentBlockBuilder> configurer)`
  Configures the content body of the notification.
  `NotificationBuilder`
  `recipientGroups(Collection<UUID> groupIds)`
  Adds the given group IDs to the set of recipients for this notification.
  `NotificationBuilder`
  `recipientUsers(Collection<UUID> userIds)`
  Adds the given user IDs to the set of recipients for this notification.
  `NotificationBuilder`
  `resource(UUID id, String name, String type)`
  Associates a resource with this notification, without a navigation path.
  `NotificationBuilder`
  `resource(UUID id, String name, String type, String path)`
  Associates a resource with this notification, including a navigation path.
  `NotificationBuilder`
  `subject(Consumer<TextContentBuilder> configurer)`
  Configures the subject line of the notification.

- ## Method Details

  - ### recipientUsers

    NotificationBuilder recipientUsers(Collection<UUID> userIds)
    Adds the given user IDs to the set of recipients for this notification.

    Calling this method more than once is cumulative — each invocation adds to the existing set of recipient users rather than replacing it.

    Parameters:
      `userIds` - user IDs to notify; must not be `null`
    Returns:
      this builder

  - ### recipientGroups

    NotificationBuilder recipientGroups(Collection<UUID> groupIds)
    Adds the given group IDs to the set of recipients for this notification. All members of the specified groups will receive the notification.

    Calling this method more than once is cumulative — each invocation adds to the existing set of recipient groups rather than replacing it.

    Parameters:
      `groupIds` - group IDs whose members should be notified; must not be `null`
    Returns:
      this builder

  - ### subject

    NotificationBuilder subject(Consumer<TextContentBuilder> configurer)
    Configures the subject line of the notification.

    The subject is required. The configurer receives a `TextContentBuilder` to set the subject text via `text` or `textKey`.

    Calling this method more than once replaces the previously set subject.

    Parameters:
      `configurer` - consumer that configures the subject content; must not be `null`
    Returns:
      this builder

  - ### content

    NotificationBuilder content(Consumer<ContentBlockBuilder> configurer)
    Configures the content body of the notification.

    The content is required. The configurer receives a `ContentBlockBuilder` to compose an ordered list of content blocks (text, bold, italic, links, new lines).

    Calling this method more than once replaces the previously set content.

    Parameters:
      `configurer` - consumer that configures the content blocks; must not be `null`
    Returns:
      this builder
    See Also:
      - `ContentBlockBuilder`

  - ### resource

    NotificationBuilder resource(UUID id, String name, String type)
    Associates a resource with this notification, without a navigation path.

    The resource provides context about which entity the notification relates to. Calling this method more than once replaces the previously set resource.

    Parameters:
      `id` - the unique identifier of the resource; must not be `null`
      `name` - the display name of the resource; must not be `null`
      `type` - the resource type — one of `Asset`, `Community`, `Domain`, `User`, `Assessment`, or `DataQualityJob`; must not be `null`
    Returns:
      this builder

  - ### resource

    NotificationBuilder resource(UUID id, String name, String type, String path)
    Associates a resource with this notification, including a navigation path.

    The resource provides context about which entity the notification relates to. Calling this method more than once replaces the previously set resource.

    Parameters:
      `id` - the unique identifier of the resource; must not be `null`
      `name` - the display name of the resource; must not be `null`
      `type` - the resource type — one of `Asset`, `Community`, `Domain`, `User`, `Assessment`, or `DataQualityJob`; must not be `null`
      `path` - optional relative URL path, resolved against the application's base URL, used to deep-link to the resource in the UI (e.g. `"/asset/{id}"` or `"/domain/{id}?commentId={commentId}"`); may be `null`
    Returns:
      this builder