List of usage examples for org.joda.time LocalDate toDateTimeAtCurrentTime
public DateTime toDateTimeAtCurrentTime(DateTimeZone zone)
From source file:com.ning.billing.invoice.api.user.DefaultInvoiceUserApi.java
License:Apache License
@Override public Invoice triggerInvoiceGeneration(final UUID accountId, final LocalDate targetDate, final boolean dryRun, final CallContext context) throws InvoiceApiException { final Account account; try {// w w w . j a v a2s.c o m account = accountUserApi.getAccountById(accountId, internalCallContextFactory.createInternalTenantContext(context)); } catch (AccountApiException e) { throw new InvoiceApiException(e, ErrorCode.ACCOUNT_DOES_NOT_EXIST_FOR_ID, e.toString()); } // API_FIX Could we avoid the first call to createInternalTenantContext final InternalCallContext internalContext = internalCallContextFactory.createInternalCallContext(accountId, context); final DateTime processingDateTime = targetDate.toDateTimeAtCurrentTime(account.getTimeZone()); final Invoice result = dispatcher.processAccount(accountId, processingDateTime, dryRun, internalContext); if (result == null) { throw new InvoiceApiException(ErrorCode.INVOICE_NOTHING_TO_DO, accountId, targetDate); } else { return result; } }
From source file:org.killbill.billing.invoice.api.user.DefaultInvoiceUserApi.java
License:Apache License
@Override public Invoice triggerInvoiceGeneration(final UUID accountId, @Nullable final LocalDate targetDate, final DryRunArguments dryRunArguments, final CallContext context) throws InvoiceApiException { final InternalCallContext internalContext = internalCallContextFactory.createInternalCallContext(accountId, context);/*w w w .j av a2 s .co m*/ final Account account; try { account = accountUserApi.getAccountById(accountId, internalContext); } catch (final AccountApiException e) { throw new InvoiceApiException(e, ErrorCode.ACCOUNT_DOES_NOT_EXIST_FOR_ID, e.toString()); } final DateTime processingDateTime = targetDate != null ? targetDate.toDateTimeAtCurrentTime(account.getTimeZone()) : null; final Invoice result = dispatcher.processAccount(accountId, processingDateTime, dryRunArguments, internalContext); if (result == null) { throw new InvoiceApiException(ErrorCode.INVOICE_NOTHING_TO_DO, accountId, targetDate != null ? targetDate : "null"); } else { return result; } }