当前位置: 首页>>代码示例>>Java>>正文


Java TenantContext.getTenantId方法代码示例

本文整理汇总了Java中org.killbill.billing.util.callcontext.TenantContext.getTenantId方法的典型用法代码示例。如果您正苦于以下问题:Java TenantContext.getTenantId方法的具体用法?Java TenantContext.getTenantId怎么用?Java TenantContext.getTenantId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.killbill.billing.util.callcontext.TenantContext的用法示例。


在下文中一共展示了TenantContext.getTenantId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sendEmailForUpComingInvoice

import org.killbill.billing.util.callcontext.TenantContext; //导入方法依赖的package包/类
private void sendEmailForUpComingInvoice(final Account account, final ExtBusEvent killbillEvent, final TenantContext context) throws IOException, InvoiceApiException, EmailException, TenantApiException, EmailNotificationException {

        Preconditions.checkArgument(killbillEvent.getEventType() == ExtBusEventType.INVOICE_NOTIFICATION, String.format("Unexpected event %s", killbillEvent.getEventType()));

        final String dryRunTimePropValue = configProperties.getString(INVOICE_DRY_RUN_TIME_PROPERTY);
        Preconditions.checkArgument(dryRunTimePropValue != null, String.format("Cannot find property %s", INVOICE_DRY_RUN_TIME_PROPERTY));

        final TimeSpan span = new TimeSpan(dryRunTimePropValue);

        final DateTime now = clock.getClock().getUTCNow();
        final DateTime targetDateTime = now.plus(span.getMillis());

        final PluginCallContext callContext = new PluginCallContext(EmailNotificationActivator.PLUGIN_NAME, now, context.getTenantId());
        final Invoice invoice = osgiKillbillAPI.getInvoiceUserApi().triggerInvoiceGeneration(account.getId(), new LocalDate(targetDateTime, account.getTimeZone()), NULL_DRY_RUN_ARGUMENTS, callContext);
        if (invoice != null) {
            final EmailContent emailContent = templateRenderer.generateEmailForUpComingInvoice(account, invoice, context);
            sendEmail(account, emailContent, context);
        }
    }
 
开发者ID:killbill,项目名称:killbill-email-notifications-plugin,代码行数:20,代码来源:EmailNotificationListener.java

示例2: getTemplateText

import org.killbill.billing.util.callcontext.TenantContext; //导入方法依赖的package包/类
private String getTemplateText(final Locale locale, final TemplateType templateType, final TenantContext context) throws TenantApiException {

        final String defaultTemplateName = DEFAULT_TEMPLATE_PATH_PREFIX + templateType.getDefaultTemplateName();
        if (context.getTenantId() == null) {
            return getDefaultTemplate(defaultTemplateName);
        }

        // TODO Caching strategy
        final String templateTenantKey = LocaleUtils.localeString(locale, templateType.getTemplateKey());
        final List<String> result = tenantApi.getTenantValuesForKey(templateTenantKey, context);
        if (result.size() == 1) {

            return result.get(0);
        }
        return getDefaultTemplate(defaultTemplateName);

    }
 
开发者ID:killbill,项目名称:killbill-email-notifications-plugin,代码行数:18,代码来源:TemplateRenderer.java

示例3: createBundle

import org.killbill.billing.util.callcontext.TenantContext; //导入方法依赖的package包/类
public ResourceBundle createBundle(final Locale locale, final ResourceBundleType type, final TenantContext tenantContext) throws TenantApiException {
    if (tenantContext.getTenantId() == null) {
        return getGlobalBundle(locale, type);
    }
    final String bundle = getTenantBundleForType(locale, type, tenantContext);
    if (bundle != null) {
        try {
            return new PropertyResourceBundle(new ByteArrayInputStream(bundle.getBytes(Charsets.UTF_8)));
        } catch (IOException e) {
            logService.log(LogService.LOG_WARNING, String.format("Failed to de-serialize the property bundle for tenant %s and locale %s", tenantContext.getTenantId(), locale));
            // Fall through...
        }
    }
    return getGlobalBundle(locale, type);
}
 
开发者ID:killbill,项目名称:killbill-email-notifications-plugin,代码行数:16,代码来源:ResourceBundleFactory.java

示例4: getTenantRecordId

import org.killbill.billing.util.callcontext.TenantContext; //导入方法依赖的package包/类
private Long getTenantRecordId(final TenantContext context) {
    final RecordIdApi recordIdApi = osgiKillbillAPI.getRecordIdApi();
    if (recordIdApi == null) {
        // Be safe
        return -1L;
    } else {
        return (context.getTenantId() == null) ? null : recordIdApi.getRecordId(context.getTenantId(), ObjectType.TENANT, context);
    }
}
 
开发者ID:killbill,项目名称:killbill-analytics-plugin,代码行数:10,代码来源:AnalyticsDao.java

示例5: getTenantRecordId

import org.killbill.billing.util.callcontext.TenantContext; //导入方法依赖的package包/类
protected Long getTenantRecordId(final TenantContext context) throws AnalyticsRefreshException {
    // See convention in InternalCallContextFactory
    if (context.getTenantId() == null) {
        return INTERNAL_TENANT_RECORD_ID;
    } else {
        final RecordIdApi recordIdUserApi = getRecordIdUserApi();
        return recordIdUserApi.getRecordId(context.getTenantId(), ObjectType.TENANT, context);
    }
}
 
开发者ID:killbill,项目名称:killbill-analytics-plugin,代码行数:10,代码来源:BusinessFactoryBase.java

示例6: getTenantRecordId

import org.killbill.billing.util.callcontext.TenantContext; //导入方法依赖的package包/类
private Long getTenantRecordId(final TenantContext context) {
    // See convention in InternalCallContextFactory
    if (context.getTenantId() == null) {
        return 0L;
    } else {
        final RecordIdApi recordIdApi = killbillAPI.getRecordIdApi();
        return recordIdApi.getRecordId(context.getTenantId(), ObjectType.TENANT, context);
    }
}
 
开发者ID:killbill,项目名称:killbill-analytics-plugin,代码行数:10,代码来源:ReportsUserApi.java


注:本文中的org.killbill.billing.util.callcontext.TenantContext.getTenantId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。