Class JpaNotificationStateUtility

java.lang.Object
com.broadleafcommerce.data.tracking.jpa.messaging.notification.JpaNotificationStateUtility

public final class JpaNotificationStateUtility extends Object
Utility class focused on easing the requirements for retrieving a list of NotificationState instances from the API of a domain class. This is primarily used to fulfill the contract of Trackable.getNotificationStates(), but can apply to any domain class implementing NotificationStateAware.
Author:
Jeff Fischer
  • Method Details

    • get

      public static <T> List<T> get(List<T> memberCollection, com.broadleafcommerce.common.messaging.notification.domain.NotificationStateAware entity)
      Retrieve the list of associated NotificationState instances from the persistence store.
      Type Parameters:
      T - The generic type for the notification states
      Parameters:
      memberCollection - The transient member collection from the entity instance. If this value is not null, this method will simply pass it back and not attempt to perform a retrieval.
      entity - The entity instance for which associated NotificationState instances should be retrieved.
      Returns:
      The list of retrieved notification states, or the passed in collection if the passed in collection was not null
    • wrapNotificationCollection

      public static <T> List<T> wrapNotificationCollection(List<T> starting)
      Wrap a starting collection in a dirty detection proxy. This proxy will keep track of mutating interactions that impact its size, or impact the state of one or more of the contained NotificationState instances.
      Type Parameters:
      T - The generic type for the notification states
      Parameters:
      starting - The list to wrap
      Returns:
      The wrapped collection