* @param session HttpSession
* @throws Exception , if error in updating the tenant
*/
public static void updateTenantConfigBean(HttpServletRequest request, ServletConfig config,
HttpSession session) throws Exception {
TenantInfoBean tenantInfoBean = new TenantInfoBean();
try {
String tenantIdStr = request.getParameter("tenantId");
int tenantId;
try {
tenantId = Integer.parseInt(tenantIdStr);
} catch (Exception e) {
String msg = "Error in converting tenant id: " + tenantIdStr + " to a number.";
log.error(msg);
throw new Exception(msg, e);
}
tenantInfoBean.setTenantId(tenantId);
tenantInfoBean.setAdmin(request.getParameter("admin"));
tenantInfoBean.setFirstname(request.getParameter("admin-firstname"));
tenantInfoBean.setLastname(request.getParameter("admin-lastname"));
tenantInfoBean.setAdminPassword(request.getParameter("admin-password"));
tenantInfoBean.setTenantDomain(request.getParameter("domain"));
tenantInfoBean.setEmail(request.getParameter("admin-email"));
tenantInfoBean.setUsagePlan(request.getParameter("usage-plan-name"));
TenantServiceClient serviceClient = new TenantServiceClient(config, session);
serviceClient.updateTenant(tenantInfoBean);
//UsagePlanClient usagePlanClient = new UsagePlanClient(config, session);
//update usage plan(subscription) per tenant
//usagePlanClient.updateUsagePlan(tenantInfoBean);
} catch (Exception e) {
String msg = "Failed to update the tenant config. tenant-domain: "
+ tenantInfoBean.getTenantDomain() + ", " + "tenant-admin: "
+ tenantInfoBean.getAdmin() + ".";
log.error(msg, e);
throw new Exception(msg, e);
}
}