Package org.wso2.carbon.user.core.tenant

Examples of org.wso2.carbon.user.core.tenant.Tenant


            xLeft = getStartIconXLeft() + getStartIconWidth();
            yTop = getStartIconYTop() + (getStartIconHeight() / 2);

        }

        SVGCoordinates coords = new org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates(xLeft, yTop);

        return coords;
    }
View Full Code Here


            xLeft = getStartIconXLeft() + (getStartIconWidth() / 2);
            yTop = getStartIconYTop() + getStartIconHeight();

        }

        SVGCoordinates coords = new org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates(xLeft, yTop);

        return coords;
    }
View Full Code Here

    protected Element getArrows(SVGDocument doc) {
        if (subActivities != null) {
            ActivityInterface prevActivity = null;
            ActivityInterface activity = null;
            String id = null;
            SVGCoordinates myStartCoords = getStartIconExitArrowCoords();
            SVGCoordinates exitCoords = null;
            org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates entryCoords = null;
            Iterator<ActivityInterface> itr = subActivities.iterator();
            while (itr.hasNext()) {
                activity = itr.next();
                if (prevActivity != null) {
                    exitCoords = prevActivity.getExitArrowCoords();
                    entryCoords = activity.getEntryArrowCoords();
                    id = prevActivity.getId() + "-" + activity.getId();
                    return getArrowDefinition(doc, exitCoords.getXLeft(), exitCoords.getYTop(),
                        entryCoords.getXLeft(), entryCoords.getYTop(), id,
                        prevActivity, activity);
                } else {
                    entryCoords = activity.getExitArrowCoords();
                    return getArrowDefinition(doc, myStartCoords.getXLeft(), myStartCoords.getYTop(),
View Full Code Here

    @Override
    public SVGDimension getDimensions() {
        if (dimensions == null) {
            int width = 0;
            int height = 0;
            dimensions = new SVGDimension(width, height);

            SVGDimension subActivityDim = null;
            ActivityInterface activity = null;
            Iterator<org.wso2.carbon.bpel.ui.bpel2svg.ActivityInterface> itr = getSubActivities().iterator();
            while (itr.hasNext()) {
                activity = itr.next();
                subActivityDim = activity.getDimensions();
                if (subActivityDim.getWidth() > width) {
                    width += subActivityDim.getWidth();
                }
                height += subActivityDim.getHeight();
            }

            height += getYSpacing();
            width += getXSpacing();
View Full Code Here

        if (dimensions == null) {
            int width = 0;
            int height = 0;
            dimensions = new org.wso2.carbon.bpel.ui.bpel2svg.SVGDimension(width, height);

            SVGDimension subActivityDim = null;
            org.wso2.carbon.bpel.ui.bpel2svg.ActivityInterface activity = null;
            Iterator<org.wso2.carbon.bpel.ui.bpel2svg.ActivityInterface> itr = getSubActivities().iterator();
            while (itr.hasNext()) {
                activity = itr.next();
                subActivityDim = activity.getDimensions();
                if (subActivityDim.getWidth() > width) {
                    width += subActivityDim.getWidth();
                }
                height += subActivityDim.getHeight();
            }

            height += getYSpacing() + getStartIconHeight() + (getYSpacing() / 2);
            width += getXSpacing();
View Full Code Here

    }

    private int createTenant(String domainName, String adminEmail, String adminUsername,
                             String adminFirstName, String adminLastName) throws Exception {
        int tenantId = -1;
        Tenant tenant = new Tenant();
        tenant.setAdminName(adminUsername);
        tenant.setActive(true);
        tenant.setAdminPassword(UUIDGenerator.getUUID());
        tenant.setEmail(adminEmail);
        tenant.setAdminFirstName(adminFirstName);
        tenant.setAdminLastName(adminLastName);
        tenant.setDomain(domainName);
        TenantPersistor tenantPersistor = IdentityRPServiceComponent.getTenantPersistor();

       
        MultiTenantRealmConfigBuilder builder =
                                                IdentityRPServiceComponent.getRealmService()
                                                                          .
                                                                          getMultiTenantRealmConfigBuilder();
        TenantMgtConfiguration tenantMgtConfiguration =
                IdentityRPServiceComponent.getRealmService().getTenantMgtConfiguration();
        RealmConfiguration bootStrapRealmConfig =
                                         IdentityRPServiceComponent.getRealmService()
                                                                   .getBootstrapRealmConfiguration();
        RealmConfiguration realmConfigToPersist =
                                                  builder.getRealmConfigForTenantToPersist(bootStrapRealmConfig,
                                                                                           tenantMgtConfiguration,
                                                                                           tenant,
                                                                                           -1);
        realmConfigToPersist.
                            getUserStoreProperties().
                            put(UserCoreConstants.RealmConfig.PROPERTY_EXTERNAL_IDP, GOOGLE_APPS_IDP_NAME);
        tenant.setRealmConfig(realmConfigToPersist);
        tenantId = tenantPersistor.persistTenant(tenant);
        IdentityRPServiceComponent.getRealmService().getTenantManager().activateTenant(tenantId);
        return tenantId;
    }
View Full Code Here

        RealmConfigXMLProcessor processor = new RealmConfigXMLProcessor();
        RealmConfiguration realmConfig = processor.buildRealmConfiguration(new FileInputStream(
                userMgtXML));

        Tenant tenant = new Tenant();
        tenant.setDomain("wso2.org");
        tenant.setRealmConfig(realmConfig);
        int tenantId = tenantManager.addTenant(tenant);
        Tenant tenant2 = (Tenant) tenantManager.getTenant(tenantId);

        // checking if the everything is stored.
        assertEquals("tenant domain should be equal.", tenant.getDomain(), tenant2.getDomain());

        Tenant tenant3 = new Tenant();
        tenant3.setDomain("abc.org");
        tenant3.setRealmConfig(realmConfig);
        tenantManager.addTenant(tenant3);


        Tenant[] tenants = (Tenant[]) tenantManager.getAllTenants();

        // check the get all tenants
        assertEquals("tenants length should be 2", tenants.length, 2);
        assertTrue("tenants should contain wso2.org",
                (tenants[0].getDomain() + tenants[1].getDomain()).contains("wso2.org"));
        assertTrue("tenants should contain abc.org",
                (tenants[0].getDomain() + tenants[1].getDomain()).contains("abc.org"));

        // if the domain exists
        assertTrue("wso2.org should exist", tenantManager.getTenantId("wso2.org") > 0);
        assertTrue("pqr.org should not exists", tenantManager.getTenantId("pqr.org") < 0);

        int tenantId4 = tenantManager.getTenantId("wso2.org");
        assertEquals("tenant domain should be wso2.org", "wso2.org",
                tenantManager.getDomain(tenantId4));

        // check the update
        Tenant tenant4 = (Tenant) tenantManager.getTenant(tenantId4);
        tenant4.setDomain("WSO2.com");
        tenantManager.updateTenant(tenant4);

        // checking the updated values
        Tenant tenant5 = (Tenant) tenantManager.getTenant(tenantId4);
        assertEquals("tenant domain should be equal.", tenant5.getDomain(), "WSO2.com");

        Tenant[] tenants2 = (Tenant[]) tenantManager.getAllTenants();
        // check the updated values get all tenants
        assertEquals("tenants length should be 2", tenants.length, 2);
        assertTrue("tenants should contain WSO2.com",
View Full Code Here

        log.error(msg, e);
        throw new UserStoreException(msg, e);
    }

    private Tenant ADBTenantToTenant(org.wso2.carbon.um.ws.api.stub.Tenant stubTenant) {
        Tenant tenant = new Tenant();
        tenant.setActive(stubTenant.getActive());
        tenant.setAdminName(stubTenant.getAdminName());
        tenant.setAdminPassword(stubTenant.getAdminPassword());
        tenant.setDomain(stubTenant.getDomain());
        tenant.setEmail(stubTenant.getEmail());
        tenant.setId(stubTenant.getId());
        return tenant;
    }
View Full Code Here

    private Customer getCurrentCustomer(UserRegistry userRegistry,
                                        BillingEngine billingEngine) throws Exception {
        int currentTenantId = userRegistry.getTenantId();
        TenantManager tenantManger = Util.getRealmService().getTenantManager();
        Tenant currentTenant = (Tenant) tenantManger.getTenant(currentTenantId);

        List<Customer> customers = billingEngine.getCustomersWithName(currentTenant.getDomain());
        if (customers == null || customers.isEmpty()) {
            return null;
        }
        return customers.get(0);
    }
View Full Code Here

                    mailParameters.put("amount", payment.getAmount().toString());
                    mailParameters.put("invoice-id", String.valueOf(payment.getInvoice().getId()));

                    try{
                        TenantManager tenantManager = Util.getRealmService().getTenantManager();
                        Tenant tenant = (Tenant) tenantManager.getTenant(customer.getId());
                        String customerName =
                                ClaimsMgtUtil.getFirstName(Util.getRealmService(), tenant, customer.getId());
                        if(customerName!=null){
                            mailParameters.put("customer-name", customerName);
                        }else{
View Full Code Here

TOP

Related Classes of org.wso2.carbon.user.core.tenant.Tenant

Copyright © 2018 www.massapicom. 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.