Package org.wso2.carbon.user.api

Examples of org.wso2.carbon.user.api.TenantManager


        return customers;
    }

    public Customer getCustomer(int customerId) throws BillingException {
        TenantManager tenantManager = Util.getRealmService().getTenantManager();
        Customer customer = null;

        try{
            Tenant tenant = tenantManager.getTenant(customerId);
            if(tenant!=null){
                customer = new Customer();
                customer.setId(customerId);
                customer.setName(tenant.getDomain());
                customer.setStartedDate(tenant.getCreatedDate());
View Full Code Here


public class CustomerUtils {
    private static Log log = LogFactory.getLog(CustomerUtils.class);

    public static void fillCustomerData(int customerId, Customer customer) throws BillingException{
        TenantManager tenantManager = Util.getRealmService().getTenantManager();
        try{
            Tenant tenant = tenantManager.getTenant(customerId);
            customer.setId(customerId);
            customer.setName(tenant.getDomain());
            customer.setStartedDate(tenant.getCreatedDate());
            customer.setEmail(tenant.getEmail());
            //customer.setAddress(); //we dont have the address
View Full Code Here

            throw new BillingException(msg, e);
        }
    }

    public static Customer getCustomer(int customerId) throws BillingException{
        TenantManager tenantManager = Util.getRealmService().getTenantManager();
        Customer customer = null;

        try{
            Tenant tenant = tenantManager.getTenant(customerId);
            if(tenant!=null){
                customer = new Customer();
                customer.setId(customerId);
                customer.setName(tenant.getDomain());
                customer.setStartedDate(tenant.getCreatedDate());
View Full Code Here

        return customer;
    }

    public static int getCustomerId(String customerName) throws BillingException {
        TenantManager tenantManager = Util.getRealmService().getTenantManager();
        int tenantId = 0;
        try{
            tenantId = tenantManager.getTenantId(customerName);
        }catch (Exception e){
            String msg = "Failed to get tenant for domain: " + customerName + ".";
            log.error(msg, e);
            throw new BillingException(msg, e);
        }
View Full Code Here

        return tenantId;
    }

    public static List<Customer> getAllCustomers() throws BillingException {
        TenantManager tenantManager = Util.getRealmService().getTenantManager();
        List<Customer> customers = new ArrayList<Customer>();
        try{
            Tenant[] tenants = tenantManager.getAllTenants();
            if(tenants!=null && tenants.length>0){
                for(Tenant tenant : tenants){
                    Customer customer = new Customer();
                    customer.setId(tenant.getId());
                    customer.setName(tenant.getDomain());
View Full Code Here

     * Resolve the tenant domain using the tenant id.
     *
     * @param tenantId the tenant id.
     */
    private void resolveTenantDomain(int tenantId) {
        TenantManager tenantManager = getTenantManager();
        if (tenantManager != null) {
            try {
                log.debug("Resolving tenant domain from tenant id");
                setTenantDomain(tenantManager.getDomain(tenantId));
            } catch (UserStoreException ignored) {
                // Exceptions in here, are due to issues with DB Connections. The UM Kernel takes
                // care of logging these exceptions. For us, this is of no importance. This is
                // because we are only attempting to resolve the tenant domain, which might not
                // always be possible.
View Full Code Here

     * Resolve the tenant id using the tenant domain.
     *
     * @param tenantDomain the tenant domain.
     */
    private void resolveTenantId(String tenantDomain) {
        TenantManager tenantManager = getTenantManager();
        if (tenantManager != null) {
            try {
                log.debug("Resolving tenant id from tenant domain");
                setTenantId(tenantManager.getTenantId(tenantDomain));
            } catch (UserStoreException ignored) {
                // Exceptions in here, are due to issues with DB Connections. The UM Kernel takes
                // care of logging these exceptions. For us, this is of no importance. This is
                // because we are only attempting to resolve the tenant id, which might not always
                // be possible.
View Full Code Here

        }

        public void run() {
            try {
                MessageContext msgCtx = ((Axis2MessageContext) synCtx).getAxis2MessageContext();
                Event<MessageContext> event = new Event(msgCtx);
                subscriptions = subscriptionManager.getMatchingSubscriptions(event);
            } catch (EventException e) {
                handleException("Matching subscriptions fetching error", e);
            }
View Full Code Here

     * @throws EventException event
     */
    private void processGetStatusRequest(MessageContext mc,
                                         ResponseMessageBuilder messageBuilder)
            throws AxisFault, EventException {
        Subscription subscription =
                SubscriptionMessageBuilder.createGetStatusMessage(mc);
        if (log.isDebugEnabled()) {
            log.debug("GetStatus request recived for SynapseSubscription ID : " +
                    subscription.getId());
        }
        subscription = subscriptionManager.getSubscription(subscription.getId());
        if (subscription != null) {
            if (log.isDebugEnabled()) {
                log.debug("Sending GetStatus responce for SynapseSubscription ID : " +
                        subscription.getId());
            }
            //send the responce
            SOAPEnvelope soapEnvelope = messageBuilder.genGetStatusResponse(subscription);
            dispatchResponse(soapEnvelope, EventingConstants.WSE_GET_STATUS_RESPONSE,
                    mc, false);
View Full Code Here


    public SynapseSubscription() {
        this.setId(UIDGenerator.generateURNString());
        this.setDeliveryMode(EventingConstants.WSE_DEFAULT_DELIVERY_MODE);
        SubscriptionData subscriptionData = new SubscriptionData();
        subscriptionData.setProperty(SynapseEventingConstants.STATIC_ENTRY, "false");
        this.setSubscriptionData(subscriptionData);
    }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.user.api.TenantManager

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.