invoice: refactor set/remove WRITTEN_OFF APIs

Move the call outside of the transaction (wasn't transactional anyways).

Signed-off-by: Pierre-Alexandre Meyer <pierre@ning.com>
util: populate account_record_id in DefaultTagUserApi

Signed-off-by: Pierre-Alexandre Meyer <pierre@ning.com>
util: populate account_record_id in DefaultCustomFieldUserApi

Signed-off-by: Pierre-Alexandre Meyer <pierre@ning.com>
overdue: populate account_record_id in refresh call

Signed-off-by: Pierre-Alexandre Meyer <pierre@ning.com>
Initial pass toi refactor internal/external APIs
junction: populate account_record_id in DefaultBlockingApi

Signed-off-by: Pierre-Alexandre Meyer <pierre@ning.com>
util: always create placeholder tables for basic objects

Now that we do secondary lookups for account_record_id, we assume that
the basic tables are always present (e.g. bundles, subscriptions).

Signed-off-by: Pierre-Alexandre Meyer <pierre@ning.com>
entitlement: invoice: don't create a call context if not needed

For r/o operations, create a tenant context only.

Signed-off-by: Pierre-Alexandre Meyer <pierre@ning.com>
Second pass on remove user api from killbill code
context: populate missing account_record_id

Signed-off-by: Pierre-Alexandre Meyer <pierre@ning.com>
Merge remote-tracking branch 'origin/svcsapi' into svcapi-progress

Conflicts:
	entitlement/src/main/java/com/ning/billing/entitlement/api/billing/DefaultChargeThruApi.java
	invoice/src/main/java/com/ning/billing/invoice/api/user/DefaultInvoiceUserApi.java
	invoice/src/main/java/com/ning/billing/invoice/dao/AuditedInvoiceDao.java
	invoice/src/test/java/com/ning/billing/invoice/dao/TestDefaultInvoiceDao.java
	invoice/src/test/java/com/ning/billing/invoice/dao/TestInvoiceDao.java
	junction/src/main/java/com/ning/billing/junction/api/blocking/DefaultBlockingApi.java
	overdue/src/main/java/com/ning/billing/overdue/api/DefaultOverdueUserApi.java
	overdue/src/test/java/com/ning/billing/overdue/applicator/TestOverdueStateApplicator.java
Merge remote-tracking branch 'origin/svcsapi' into svcapi-progress

Conflicts:
	entitlement/src/main/java/com/ning/billing/entitlement/api/billing/DefaultChargeThruApi.java
bus: move Bus and BusServer to util

We may want to split the classes later on. The post methods should be
internal only, but start/stop/register/unregister should be exposed to
the lifecycle.

Signed-off-by: Pierre-Alexandre Meyer <pierre@ning.com>
bus: pass the InternalCallContext when posting an event

This is to populate account_record_id and tenant_record_id in the
bus_events table.

Signed-off-by: Pierre-Alexandre Meyer <pierre@ning.com>
account: populate account_record_id when posting a AccountCreationEvent event

We need to rehydrate the context with the account_record_id since it
didn't exist at the time when the context was created.

Signed-off-by: Pierre-Alexandre Meyer <pierre@ning.com>
junction: fix DateTime truncation issue in BlockingState mapper

Signed-off-by: Pierre-Alexandre Meyer <pierre@ning.com>
analytics: fix tests failures after 5pm PDT

clock.getUTCToday() and new LocalDate() are off by one after 5pm PDT.

Signed-off-by: Pierre-Alexandre Meyer <pierre@ning.com>
Add default implementation for internal APIs
Merge remote-tracking branch 'origin/svcsapi' into svcapi-progress

Conflicts:
	invoice/src/main/java/com/ning/billing/invoice/InvoiceDispatcher.java
	invoice/src/main/java/com/ning/billing/invoice/api/user/DefaultInvoiceUserApi.java
	invoice/src/main/java/com/ning/billing/invoice/dao/AuditedInvoiceDao.java
	invoice/src/test/java/com/ning/billing/invoice/api/invoice/TestDefaultInvoicePaymentApi.java
	invoice/src/test/java/com/ning/billing/invoice/dao/InvoiceDaoTestBase.java
	invoice/src/test/java/com/ning/billing/invoice/dao/TestDefaultInvoiceDao.java
	invoice/src/test/java/com/ning/billing/invoice/tests/TestChargeBacks.java
	junction/src/test/java/com/ning/billing/junction/api/blocking/TestDefaultBlockingApi.java
	overdue/src/main/java/com/ning/billing/overdue/applicator/OverdueStateApplicator.java
	payment/src/main/java/com/ning/billing/payment/core/PaymentMethodProcessor.java
	payment/src/main/java/com/ning/billing/payment/core/PaymentProcessor.java
	payment/src/main/java/com/ning/billing/payment/core/ProcessorBase.java
	payment/src/main/java/com/ning/billing/payment/core/RefundProcessor.java
	payment/src/test/java/com/ning/billing/payment/core/TestPaymentMethodProcessor.java
svcsapi: More account_record_id/tenant_record_id work

* Fix missing account_record_id in account audits
* Pass tenant_record_id and account_record_id to NotificationQueueHandlers
* Don't pass accountId when creating InternalTenantContexts - it's not needed
* Store account_record_id and tenant_record_id in db-backed queues

Signed-off-by: Pierre-Alexandre Meyer <pierre@ning.com>