Examples of TenantInfoBean


Examples of org.apache.stratos.common.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(), tenantId));
        bean.setLastname(ClaimsMgtUtil.getLastNamefromUserStoreManager(
                TenantMgtServiceComponent.getRealmService(), tenantId));

        //getting the subscription plan
        String activePlan = "";
        if(TenantMgtServiceComponent.getBillingService() != null){
            activePlan = TenantMgtServiceComponent.getBillingService().
                    getActiveUsagePlan(tenantDomain);
        }

        if(activePlan != null && activePlan.trim().length() > 0){
            bean.setUsagePlan(activePlan);
        }else{
            bean.setUsagePlan("");
        }

        return bean;
    }
View Full Code Here

Examples of org.apache.stratos.common.beans.TenantInfoBean

    public TenantInfoBean[] retrievePartialSearchTenants(String searchDomain) throws RestAPIException{
        List<TenantInfoBean> searchResult = new LinkedList<TenantInfoBean>();
        for(String tenantDomain : tenantMap.keySet()){
            if(tenantDomain.contains(searchDomain)){
                 searchResult.add(new TenantInfoBean(tenantMap.get(tenantDomain)));
            }
        }
        return searchResult.toArray(new TenantInfoBean[0]);
    }
View Full Code Here

Examples of org.apache.stratos.common.beans.TenantInfoBean

     * @param tenantId, tenant id
     * @param tenant, tenant
     * @return TenantInfoBean.
     */
    public static TenantInfoBean getTenantInfoBeanfromTenant(int tenantId, Tenant tenant) {
        TenantInfoBean bean = new TenantInfoBean();
        if (tenant != null) {
            bean.setTenantId(tenantId);
            bean.setTenantDomain(tenant.getDomain());
            bean.setEmail(tenant.getEmail());

            /*gets the created date*/
            Calendar createdDate = Calendar.getInstance();
            createdDate.setTimeInMillis(tenant.getCreatedDate().getTime());
            bean.setCreatedDate(createdDate);

            bean.setActive(tenant.isActive());
            if(log.isDebugEnabled()) {
                log.debug("The TenantInfoBean object has been created from the tenant.");
            }
        } else {
            if(log.isDebugEnabled()) {
View Full Code Here

Examples of org.apache.stratos.common.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(
                ServiceHolder.getRealmService(), tenantId));
        bean.setLastname(ClaimsMgtUtil.getLastNamefromUserStoreManager(
                ServiceHolder.getRealmService(), tenantId));

        //getting the subscription plan
        String activePlan = "";
        //TODO: usage plan using billing service

        if(activePlan != null && activePlan.trim().length() > 0){
            bean.setUsagePlan(activePlan);
        }else{
            bean.setUsagePlan("");
        }

        return bean;
    }
View Full Code Here

Examples of org.apache.stratos.common.beans.TenantInfoBean

            throw new RestAPIException(msg);
        }

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

Examples of org.apache.stratos.common.beans.TenantInfoBean

            throw new RestAPIException(msg);
        }

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

Examples of org.apache.stratos.common.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 = getTenantInfoBeanfromTenant(tenantId, tenant);
        if (tenant != null) {
            bean.setAdmin(ClaimsMgtUtil.getAdminUserNameFromTenantId(
                    TenantMgtServiceComponent.getRealmService(), tenantId));
        }
        return bean;
    }
View Full Code Here

Examples of org.apache.stratos.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.apache.stratos.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.apache.stratos.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
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.