@Override public AuditLogsForBundles getAuditLogsForBundles( final List<SubscriptionBundle> bundles, final AuditLevel auditLevel, final TenantContext context) { final Map<UUID, List<AuditLog>> bundlesAuditLogs = new HashMap<UUID, List<AuditLog>>(); final Map<UUID, List<AuditLog>> subscriptionsAuditLogs = new HashMap<UUID, List<AuditLog>>(); final Map<UUID, List<AuditLog>> subscriptionEventsAuditLogs = new HashMap<UUID, List<AuditLog>>(); for (final SubscriptionBundle bundle : bundles) { bundlesAuditLogs.put( bundle.getId(), getAuditLogs(bundle.getId(), ObjectType.BUNDLE, auditLevel, context)); for (final Subscription cur : bundle.getSubscriptions()) { final ImmutableList<SubscriptionEvent> events = ImmutableList.<SubscriptionEvent>copyOf( Collections2.filter( bundle.getTimeline().getSubscriptionEvents(), new Predicate<SubscriptionEvent>() { @Override public boolean apply(@Nullable final SubscriptionEvent input) { return input.getEntitlementId().equals(cur.getId()); } })); subscriptionsAuditLogs.put( cur.getId(), getAuditLogs(cur.getId(), ObjectType.SUBSCRIPTION, auditLevel, context)); for (final SubscriptionEvent event : events) { subscriptionEventsAuditLogs.put( event.getId(), getAuditLogs( event.getId(), event.getSubscriptionEventType().getObjectType(), auditLevel, context)); } } } return new DefaultAuditLogsForBundles( bundlesAuditLogs, subscriptionsAuditLogs, subscriptionEventsAuditLogs); }