use of org.killbill.billing.jaxrs.json.TagDefinitionJson in project killbill by killbill.
the class TagDefinitionResource method getTagDefinition.
@TimedResource
@GET
@Path("/{tagDefinitionId:" + UUID_PATTERN + "}")
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Retrieve a tag definition", response = TagDefinitionJson.class)
@ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid tagDefinitionId supplied") })
public Response getTagDefinition(@PathParam("tagDefinitionId") final String tagDefId, @QueryParam(QUERY_AUDIT) @DefaultValue("NONE") final AuditMode auditMode, @javax.ws.rs.core.Context final HttpServletRequest request) throws TagDefinitionApiException {
final TenantContext tenantContext = context.createContext(request);
final TagDefinition tagDefinition = tagUserApi.getTagDefinition(UUID.fromString(tagDefId), tenantContext);
final List<AuditLog> auditLogs = auditUserApi.getAuditLogs(tagDefinition.getId(), ObjectType.TAG_DEFINITION, auditMode.getLevel(), tenantContext);
final TagDefinitionJson json = new TagDefinitionJson(tagDefinition, auditLogs);
return Response.status(Status.OK).entity(json).build();
}
use of org.killbill.billing.jaxrs.json.TagDefinitionJson in project killbill by killbill.
the class TagDefinitionResource method getTagDefinitions.
@TimedResource
@GET
@Produces(APPLICATION_JSON)
@ApiOperation(value = "List tag definitions", response = TagDefinitionJson.class, responseContainer = "List")
@ApiResponses(value = {})
public Response getTagDefinitions(@javax.ws.rs.core.Context final HttpServletRequest request, @QueryParam(QUERY_AUDIT) @DefaultValue("NONE") final AuditMode auditMode) {
final TenantContext tenantContext = context.createTenantContextNoAccountId(request);
final List<TagDefinition> tagDefinitions = tagUserApi.getTagDefinitions(tenantContext);
final Collection<TagDefinitionJson> result = new LinkedList<TagDefinitionJson>();
for (final TagDefinition tagDefinition : tagDefinitions) {
final List<AuditLog> auditLogs = auditUserApi.getAuditLogs(tagDefinition.getId(), ObjectType.TAG_DEFINITION, auditMode.getLevel(), tenantContext);
result.add(new TagDefinitionJson(tagDefinition, auditLogs));
}
return Response.status(Status.OK).entity(result).build();
}
use of org.killbill.billing.jaxrs.json.TagDefinitionJson in project killbill by killbill.
the class TagDefinitionResource method getTagDefinition.
@TimedResource
@GET
@Path("/{tagDefinitionId:" + UUID_PATTERN + "}")
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Retrieve a tag definition", response = TagDefinitionJson.class)
@ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid tagDefinitionId supplied") })
public Response getTagDefinition(@PathParam("tagDefinitionId") final UUID tagDefId, @QueryParam(QUERY_AUDIT) @DefaultValue("NONE") final AuditMode auditMode, @javax.ws.rs.core.Context final HttpServletRequest request) throws TagDefinitionApiException {
final TenantContext tenantContext = context.createTenantContextNoAccountId(request);
final TagDefinition tagDefinition = tagUserApi.getTagDefinition(tagDefId, tenantContext);
final List<AuditLog> auditLogs = auditUserApi.getAuditLogs(tagDefinition.getId(), ObjectType.TAG_DEFINITION, auditMode.getLevel(), tenantContext);
final TagDefinitionJson json = new TagDefinitionJson(tagDefinition, auditLogs);
return Response.status(Status.OK).entity(json).build();
}
Aggregations