}
public static TenantUsage retrieveTenantUsage(ServletRequest request,
ServletConfig config, HttpSession session) throws Exception {
try {
UsageServiceClient serviceClient = new UsageServiceClient(config, session);
String yearMonth = request.getParameter("year-month");
if (yearMonth == null) {
// get the current year month
yearMonth = getCurrentYearMonth();
}
String tenantIdStr = request.getParameter("tenant-id");
if (tenantIdStr == null) {
tenantIdStr = "0";
}
return serviceClient.retrieveTenantUsage(yearMonth, Integer.parseInt(tenantIdStr));
} catch (Exception e) {
String msg = "Failed to get tenant usages.";
log.error(msg, e);
throw new UIException(msg, e);
}