Examples of TenantInfoBean


Examples of org.apache.stratos.tenant.register.stub.beans.xsd.TenantInfoBean

     * @return String
     * @throws UIException
     */
    public static String registerTenantConfigBean(HttpServletRequest request,
                                                  ServletConfig config, HttpSession session) throws UIException {
        TenantInfoBean tenantInfoBean = new TenantInfoBean();
        CaptchaInfoBean captchaInfoBean = new CaptchaInfoBean();

        try {
            // filling tenant info.
            tenantInfoBean.setFirstname(request.getParameter("admin-firstname"));
            tenantInfoBean.setLastname(request.getParameter("admin-lastname"));
            tenantInfoBean.setAdmin(request.getParameter("admin"));
            tenantInfoBean.setAdminPassword(request.getParameter("admin-password"));
            tenantInfoBean.setTenantDomain(resolveDomainName(request.getParameter("domain")));
            tenantInfoBean.setEmail(request.getParameter("admin-email"));
            tenantInfoBean.setSuccessKey((String) session.getAttribute("validate-domain-success-key"));
            tenantInfoBean.setUsagePlan(request.getParameter("selectedUsagePlan"));
            tenantInfoBean.setOriginatedService(TenantConfigUtil.base64Decode((String) session.getAttribute(
                    StratosConstants.ORIGINATED_SERVICE)));
            tenantInfoBean.setCreatedDate(Calendar.getInstance());
            // filling captcha info
            captchaInfoBean.setSecretKey(request.getParameter("captcha-secret-key"));
            captchaInfoBean.setUserAnswer(request.getParameter("captcha-user-answer"));

            TenantSelfRegistrationClient selfRegistrationClient =
                    new TenantSelfRegistrationClient(config, session);

            String returnText = selfRegistrationClient.registerTenant(tenantInfoBean, captchaInfoBean);

            return returnText;

        } catch (Exception e) {
            AxisFault fault = new AxisFault(e.getMessage());
            String msg = fault.getReason() + " Failed to add tenant config. tenant-domain: " +
                    tenantInfoBean.getTenantDomain() + ", " +
                    "tenant-admin: " + tenantInfoBean.getAdmin() + ".";
            log.error(msg, e);
            // we are preserving the original message.
            throw new UIException(e.getMessage(), e);
        }
    }
View Full Code Here

Examples of org.wso2.carbon.tenant.mgt.beans.TenantInfoBean

     * @return tenantInfoBean
     * @throws Exception , exception in getting the adminUserName from tenantId
     */
    public static TenantInfoBean initializeTenantInfoBean(
            int tenantId, Tenant tenant) throws Exception {
        TenantInfoBean bean = new TenantInfoBean();
        if (tenant != null) {
           bean.setAdmin(ClaimsMgtUtil.getAdminUserNameFromTenantId(
                     TenantMgtServiceComponent.getRealmService(), tenantId));
             bean.setTenantId(tenantId);
             bean.setTenantDomain(tenant.getDomain());
             bean.setEmail(tenant.getEmail());
             bean.setActive(tenant.isActive());
             Calendar createdDate = Calendar.getInstance();
             createdDate.setTimeInMillis(tenant.getCreatedDate().getTime());
             bean.setCreatedDate(createdDate);
        }
        return bean;
    }
View Full Code Here

Examples of org.wso2.carbon.tenant.mgt.beans.TenantInfoBean

            throw new Exception(msg, e);
        }

        List<TenantInfoBean> tenantList = new ArrayList<TenantInfoBean>();
        for (Tenant tenant : tenants) {
            TenantInfoBean bean = TenantMgtUtil.initializeTenantInfoBean(tenant.getId(), tenant);
            tenantList.add(bean);
        }
        return tenantList;
    }
View Full Code Here

Examples of org.wso2.carbon.tenant.mgt.beans.TenantInfoBean

            String msg = "Error in retrieving the tenant from the tenant manager.";
            log.error(msg);
            throw new Exception(msg, e);
        }

        TenantInfoBean bean = TenantMgtUtil.initializeTenantInfoBean(tenantId, tenant);

        // retrieve first and last names from the UserStoreManager
        bean.setFirstname(ClaimsMgtUtil.getFirstNamefromUserStoreManager(
                TenantMgtServiceComponent.getRealmService(), tenant, tenantId));
        bean.setLastname(ClaimsMgtUtil.getLastNamefromUserStoreManager(
                TenantMgtServiceComponent.getRealmService(), tenant, tenantId));

        //getting the subscription plan
        Subscription subscription = TenantMgtUtil.getActiveUsagePlan(tenantId);
        if(subscription!=null){
            bean.setUsagePlan(subscription.getSubscriptionPlan());
        }else{
            bean.setUsagePlan("");
        }

        return bean;
    }
View Full Code Here

Examples of org.wso2.carbon.tenant.mgt.stub.beans.xsd.TenantInfoBean

     * @param session HttpSession
     * @throws Exception , if error in adding the tenant
     */
    public static void addTenantConfigBean(HttpServletRequest request, ServletConfig config,
                                           HttpSession session) throws Exception {
        TenantInfoBean tenantInfoBean = new TenantInfoBean();

        try {
            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"));
            tenantInfoBean.setCreatedDate(Calendar.getInstance());
            TenantServiceClient serviceClient = new TenantServiceClient(config, session);
            serviceClient.addTenant(tenantInfoBean);
           
        } catch (Exception e) {
            String msg = "Failed to add tenant config. tenant-domain: "
                    + tenantInfoBean.getTenantDomain() + ", " + "tenant-admin: "
                    + tenantInfoBean.getAdmin() + ".";
            log.error(msg, e);
            throw new Exception(msg, e);
        }
    }
View Full Code Here

Examples of org.wso2.carbon.tenant.mgt.stub.beans.xsd.TenantInfoBean

     * @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);
        }
    }
View Full Code Here

Examples of org.wso2.carbon.tenant.mgt.stub.beans.xsd.TenantInfoBean

                                           HttpSession session) throws Exception {
        String tenantDomain = "";
        try {
            tenantDomain = request.getParameter("domain");
            TenantServiceClient serviceClient = new TenantServiceClient(config, session);
            TenantInfoBean tenantBean=serviceClient.getTenant(tenantDomain);
            return tenantBean;
        } catch (Exception e) {
            String msg = "Failed to get existing details of the tenant:" + tenantDomain;
            log.error(msg, e);
            throw new Exception(msg, e);
View Full Code Here

Examples of org.wso2.carbon.tenant.register.stub.beans.xsd.TenantInfoBean

     * @return String
     * @throws UIException
     */
    public static String registerTenantConfigBean(HttpServletRequest request,
                                                  ServletConfig config, HttpSession session) throws UIException {
        TenantInfoBean tenantInfoBean = new TenantInfoBean();
        CaptchaInfoBean captchaInfoBean = new CaptchaInfoBean();

        try {
            // filling tenant info.
            tenantInfoBean.setFirstname(request.getParameter("admin-firstname"));
            tenantInfoBean.setLastname(request.getParameter("admin-lastname"));
            tenantInfoBean.setAdmin(request.getParameter("admin"));
            tenantInfoBean.setAdminPassword(request.getParameter("admin-password"));
            tenantInfoBean.setTenantDomain(resolveDomainName(request.getParameter("domain")));
            tenantInfoBean.setEmail(request.getParameter("admin-email"));
            tenantInfoBean.setSuccessKey((String) session.getAttribute("validate-domain-success-key"));
            tenantInfoBean.setUsagePlan(request.getParameter("usage-plan-name"));
            tenantInfoBean.setOriginatedService(TenantConfigUtil.base64Decode((String) session.getAttribute(
                    StratosConstants.ORIGINATED_SERVICE)));
            tenantInfoBean.setCreatedDate(Calendar.getInstance());
            // filling captcha info
            captchaInfoBean.setSecretKey(request.getParameter("captcha-secret-key"));
            captchaInfoBean.setUserAnswer(request.getParameter("captcha-user-answer"));

            TenantSelfRegistrationClient selfRegistrationClient =
                    new TenantSelfRegistrationClient(config, session);

            String returnText = selfRegistrationClient.registerTenant(tenantInfoBean, captchaInfoBean);

            return returnText;

        } catch (Exception e) {
            AxisFault fault = new AxisFault(e.getMessage());
            String msg = fault.getReason() + " Failed to add tenant config. tenant-domain: " +
                    tenantInfoBean.getTenantDomain() + ", " +
                    "tenant-admin: " + tenantInfoBean.getAdmin() + ".";
            log.error(msg, e);
            // we are preserving the original message.
            throw new UIException(e.getMessage(), e);
        }
    }
View Full Code Here

Examples of org.wso2.carbon.tenant.register.stub.beans.xsd.TenantInfoBean

                String msg = "Provided domain name is empty";
                log.error(msg);
                return false;
            }

            TenantInfoBean tenantInfoBean = new TenantInfoBean();
            tenantInfoBean.setAdmin(admin);
            tenantInfoBean.setTenantDomain(domain);

            TenantSelfRegistrationClient selfRegistrationClient =
                    new TenantSelfRegistrationClient(config, session);
            return selfRegistrationClient.resetPassword(tenantInfoBean);
        } catch (Exception e) {
View Full Code Here

Examples of org.wso2.carbon.tenant.register.stub.beans.xsd.TenantInfoBean

     */
    public static boolean updateAdminPasswordWithUserInput(HttpServletRequest request, ServletConfig config,
                                                           HttpSession session) throws UIException {
        String domain = request.getParameter("domain");
        String password = request.getParameter("admin-password");
        TenantInfoBean tenantInfoBean = new TenantInfoBean();
        tenantInfoBean.setTenantDomain(domain);
        tenantInfoBean.setAdminPassword(password);
        CaptchaInfoBean captchaInfoBean = new CaptchaInfoBean();

        try {
            // filling captcha info
            captchaInfoBean.setSecretKey(request.getParameter("captcha-secret-key"));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.