use of org.killbill.billing.util.audit.AccountAuditLogsForObjectType in project killbill by killbill.
the class JaxRsResourceBase method createTagResponse.
protected Response createTagResponse(final UUID accountId, final List<Tag> tags, final AuditMode auditMode, final TenantContext context) throws TagDefinitionApiException {
final AccountAuditLogsForObjectType tagsAuditLogs = auditUserApi.getAccountAuditLogs(accountId, ObjectType.TAG, auditMode.getLevel(), context);
final Map<UUID, TagDefinition> tagDefinitionsCache = new HashMap<UUID, TagDefinition>();
final Collection<TagJson> result = new LinkedList<TagJson>();
for (final Tag tag : tags) {
if (tagDefinitionsCache.get(tag.getTagDefinitionId()) == null) {
tagDefinitionsCache.put(tag.getTagDefinitionId(), tagUserApi.getTagDefinition(tag.getTagDefinitionId(), context));
}
final TagDefinition tagDefinition = tagDefinitionsCache.get(tag.getTagDefinitionId());
final List<AuditLog> auditLogs = tagsAuditLogs.getAuditLogs(tag.getId());
result.add(new TagJson(tag, tagDefinition, auditLogs));
}
return Response.status(Response.Status.OK).entity(result).build();
}
use of org.killbill.billing.util.audit.AccountAuditLogsForObjectType in project killbill by killbill.
the class TestDefaultAuditDao method testRetrieveAuditsViaHistory.
@Test(groups = "slow")
public void testRetrieveAuditsViaHistory() throws Exception {
addTag();
for (final AuditLevel level : AuditLevel.values()) {
final List<AuditLog> auditLogs = auditDao.getAuditLogsForId(TableName.TAG, tag.getId(), level, internalCallContext);
verifyAuditLogsForTag(auditLogs, level);
final AccountAuditLogs accountAuditLogs = auditDao.getAuditLogsForAccountRecordId(level, internalCallContext);
verifyAuditLogsForTag(accountAuditLogs.getAuditLogs(ObjectType.TAG).getAuditLogs(tag.getId()), level);
final AccountAuditLogsForObjectType accountAuditLogsForObjectType = auditDao.getAuditLogsForAccountRecordId(TableName.TAG, level, internalCallContext);
verifyAuditLogsForTag(accountAuditLogsForObjectType.getAuditLogs(tag.getId()), level);
}
}
Aggregations