use of org.killbill.billing.jaxrs.json.TenantKeyJson in project killbill by killbill.
the class TenantResource method getUserKeyValue.
@TimedResource
@GET
@Path("/" + USER_KEY_VALUE + "/{keyName:" + ANYTHING_PATTERN + "}")
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Retrieve a per tenant user key/value", response = TenantKeyJson.class)
@ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid tenantId supplied") })
public Response getUserKeyValue(@PathParam("keyName") final String key, @javax.ws.rs.core.Context final HttpServletRequest request) throws TenantApiException {
final TenantContext tenantContext = context.createContext(request);
final List<String> values = tenantApi.getTenantValuesForKey(key, tenantContext);
final TenantKeyJson result = new TenantKeyJson(key, values);
return Response.status(Status.OK).entity(result).build();
}
use of org.killbill.billing.jaxrs.json.TenantKeyJson in project killbill by killbill.
the class TenantResource method getAllPluginConfiguration.
@TimedResource
@GET
@Path("/" + UPLOAD_PER_TENANT_CONFIG + "/{keyPrefix:" + ANYTHING_PATTERN + "}" + "/" + SEARCH)
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Retrieve a per tenant key value based on key prefix", response = TenantKeyJson.class)
@ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid tenantId supplied") })
public Response getAllPluginConfiguration(@PathParam("keyPrefix") final String keyPrefix, @javax.ws.rs.core.Context final HttpServletRequest request) throws TenantApiException {
final TenantContext tenantContext = context.createContext(request);
final Map<String, List<String>> apiResult = tenantApi.searchTenantKeyValues(keyPrefix, tenantContext);
final List<TenantKeyJson> result = new ArrayList<TenantKeyJson>();
for (final String cur : apiResult.keySet()) {
result.add(new TenantKeyJson(cur, apiResult.get(cur)));
}
return Response.status(Status.OK).entity(result).build();
}
use of org.killbill.billing.jaxrs.json.TenantKeyJson in project killbill by killbill.
the class TenantResource method getTenantKey.
private Response getTenantKey(final TenantKey key, @Nullable final String keyPostfix, final HttpServletRequest request) throws TenantApiException {
final TenantContext tenantContext = context.createContext(request);
final String tenantKey = keyPostfix != null ? key.toString() + keyPostfix : key.toString();
final List<String> values = tenantApi.getTenantValuesForKey(tenantKey, tenantContext);
final TenantKeyJson result = new TenantKeyJson(tenantKey, values);
return Response.status(Status.OK).entity(result).build();
}
Aggregations