本文整理汇总了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);
}
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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);
}
}