protected AuditLog getBundleCreationAuditLog(final UUID bundleId, final AccountAuditLogs accountAuditLogs) throws OSGIServiceNotAvailable { final List<AuditLog> auditLogsForBundle = accountAuditLogs.getAuditLogsForBundle(bundleId); for (final AuditLog auditLog : auditLogsForBundle) { if (auditLog.getChangeType().equals(ChangeType.INSERT)) { return auditLog; } } logService.log(LogService.LOG_WARNING, "Unable to find Bundle creation audit log for id " + bundleId); return null; }
public BundleTimelineJson(final SubscriptionBundleTimeline bundleTimeline, @Nullable final AccountAuditLogs accountAuditLogs) { super(toAuditLogJson(accountAuditLogs == null ? null : accountAuditLogs.getAuditLogsForBundle(bundleTimeline.getBundleId()))); this.accountId = bundleTimeline.getAccountId(); this.bundleId = bundleTimeline.getBundleId(); this.externalKey = bundleTimeline.getExternalKey(); this.events = new LinkedList<EventSubscriptionJson>(); for (final SubscriptionEvent subscriptionEvent : bundleTimeline.getSubscriptionEvents()) { this.events.add(new EventSubscriptionJson(subscriptionEvent, accountAuditLogs)); } }
public BundleJson(final SubscriptionBundle bundle, @Nullable final Currency currency, @Nullable final AccountAuditLogs accountAuditLogs) throws CatalogApiException { super(toAuditLogJson(accountAuditLogs == null ? null : accountAuditLogs.getAuditLogsForBundle(bundle.getId()))); this.accountId = bundle.getAccountId(); this.bundleId = bundle.getId(); this.externalKey = bundle.getExternalKey(); this.subscriptions = new LinkedList<SubscriptionJson>(); for (final Subscription subscription : bundle.getSubscriptions()) { this.subscriptions.add(new SubscriptionJson(subscription, currency, accountAuditLogs)); } this.timeline = new BundleTimelineJson(bundle.getTimeline(), accountAuditLogs); }
private List<AuditLog> getAuditLogsForBundle(final UUID bundleId, final TenantContext context) { try { final SubscriptionBundle bundle = subscriptionApi.getSubscriptionBundle(bundleId, context); return auditUserApi.getAccountAuditLogs(bundle.getAccountId(), AuditLevel.FULL, context).getAuditLogsForBundle(bundle.getId()); } catch (final SubscriptionApiException e) { Assert.fail(e.toString()); return null; } }