private LinkedList < SubscriptionEvent > computeSubscriptionBaseEvents ( final Iterable < Entitlement > entitlements , final InternalTenantContext internalTenantContext ) { final LinkedList < SubscriptionEvent > result = new LinkedList < SubscriptionEvent > ( ) ; for ( final Entitlement cur : entitlements ) { Preconditions . checkState ( cur instanceof DefaultEntitlement , "Entitlement %s is not a DefaultEntitlement" , cur ) ; final SubscriptionBase base = ( ( DefaultEntitlement ) cur ) . getSubscriptionBase ( ) ; final List < SubscriptionBaseTransition > baseTransitions = base . getAllTransitions ( ) ; for ( final SubscriptionBaseTransition tr : baseTransitions ) { final List < SubscriptionEventType > eventTypes = toEventTypes ( tr . getTransitionType ( ) ) ; for ( final SubscriptionEventType eventType : eventTypes ) { final SubscriptionEvent event = toSubscriptionEvent ( tr , eventType , internalTenantContext ) ; insertSubscriptionEvent ( event , result ) ; } } } return result ; }
Compute the initial stream of events based on the subscription base events