Package org.jbpm.casemgmt.impl.event

## Class CommentNotificationEventListener

- java.lang.Object
- - org.jbpm.casemgmt.impl.event.CommentNotificationEventListener

- All Implemented Interfaces:
    `EventListener`, `CaseEventListener`, `org.kie.internal.runtime.Cacheable`

      public class CommentNotificationEventListener
      extends Object
      implements CaseEventListener, org.kie.internal.runtime.Cacheable

  Event listener that allows to fire notification based on mentions in the case comments that refer to case roles - meaning all role assignments (users or groups) will be notified whenever mentioned.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static String` | `AUTHOR_PARAM` |
    `static String` | `CASE_ID_PARAM` |
    `static String` | `COMMENT_ID_PARAM` |
    `static String` | `COMMENT_PARAM` |
    `static String` | `CREATED_AT_PARAM` |
    `static String` | `DEFAULT_SENDER` |
    `static String` | `DEFAULT_SUBJECT` |
    `static String` | `DEFAULT_TEMPLATE` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `CommentNotificationEventListener()` |
    `CommentNotificationEventListener​(String sender, String template, String subject)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addPublisher​(org.kie.internal.utils.NotificationPublisher publisher)` |
    `void` | `afterCaseCommentAdded​(CaseCommentEvent event)` |
    `void` | `afterCaseCommentUpdated​(CaseCommentEvent event)` |
    `protected void` | `buildAndPublishNotification​(CaseCommentEvent event)` |
    `protected Map<String,​Object>` | `buildParams​(CaseCommentEvent event, StringBuilder commentContent)` |
    `void` | `close()` |
    `protected Set<org.kie.api.task.model.OrganizationalEntity>` | `collectOrgEntitiesByRole​(List<String> mentionedRoles, CaseCommentEvent event, StringBuilder commentContent)` |
    `protected List<String>` | `extractMentionedRoles​(String commentText)` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.jbpm.casemgmt.api.event.CaseEventListener

      `afterCaseCancelled, afterCaseClosed, afterCaseCommentRemoved, afterCaseDataAdded, afterCaseDataRemoved, afterCaseDestroyed, afterCaseReopen, afterCaseRoleAssignmentAdded, afterCaseRoleAssignmentRemoved, afterCaseStarted, afterDynamicProcessAdded, afterDynamicTaskAdded, beforeCaseCancelled, beforeCaseClosed, beforeCaseCommentAdded, beforeCaseCommentRemoved, beforeCaseCommentUpdated, beforeCaseDataAdded, beforeCaseDataRemoved, beforeCaseDestroyed, beforeCaseReopen, beforeCaseRoleAssignmentAdded, beforeCaseRoleAssignmentRemoved, beforeCaseStarted, beforeDynamicProcessAdded, beforeDynamicTaskAdded`

- - ### Field Detail

    - #### DEFAULT_SENDER

          public static final String DEFAULT_SENDER

      See Also:
        Constant Field Values

    - #### DEFAULT_TEMPLATE

          public static final String DEFAULT_TEMPLATE

      See Also:
        Constant Field Values

    - #### DEFAULT_SUBJECT

          public static final String DEFAULT_SUBJECT

      See Also:
        Constant Field Values

    - #### CASE_ID_PARAM

          public static final String CASE_ID_PARAM

      See Also:
        Constant Field Values

    - #### AUTHOR_PARAM

          public static final String AUTHOR_PARAM

      See Also:
        Constant Field Values

    - #### COMMENT_PARAM

          public static final String COMMENT_PARAM

      See Also:
        Constant Field Values

    - #### COMMENT_ID_PARAM

          public static final String COMMENT_ID_PARAM

      See Also:
        Constant Field Values

    - #### CREATED_AT_PARAM

          public static final String CREATED_AT_PARAM

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### CommentNotificationEventListener

          public CommentNotificationEventListener()

    - #### CommentNotificationEventListener

          public CommentNotificationEventListener​(String sender,
                                                  String template,
                                                  String subject)

  - ### Method Detail

    - #### afterCaseCommentAdded

          public void afterCaseCommentAdded​(CaseCommentEvent event)

      Specified by:
        `afterCaseCommentAdded` in interface `CaseEventListener`

    - #### afterCaseCommentUpdated

          public void afterCaseCommentUpdated​(CaseCommentEvent event)

      Specified by:
        `afterCaseCommentUpdated` in interface `CaseEventListener`

    - #### buildAndPublishNotification

          protected void buildAndPublishNotification​(CaseCommentEvent event)

    - #### extractMentionedRoles

          protected List<String> extractMentionedRoles​(String commentText)

    - #### collectOrgEntitiesByRole

          protected Set<org.kie.api.task.model.OrganizationalEntity> collectOrgEntitiesByRole​(List<String> mentionedRoles,
                                                                                              CaseCommentEvent event,
                                                                                              StringBuilder commentContent)

    - #### buildParams

          protected Map<String,​Object> buildParams​(CaseCommentEvent event,
                                                         StringBuilder commentContent)

    - #### addPublisher

          public void addPublisher​(org.kie.internal.utils.NotificationPublisher publisher)

    - #### close

          public void close()

      Specified by:
        `close` in interface `org.kie.internal.runtime.Cacheable`