Toggle navigation
Home
org.killbill.billing.util.callcontext.CallContext to org.killbill.billing.callcontext.InternalCallContext
No. of Instances - 4
No. of Commits - 2
No. of Projects - {'killbill'}
Hierarchy/Composition: -
Primitive Info: -
NameSpace: Internal -> Internal
Mapping:
Cascading Type Change (Different)
InternalCallContext
to
InternalTenantContext
InternalCallContext
to
InternalTenantContext
Add or Remove Method invocation
childAccount.getId()
to
childAccount.getParentAccountId()
internalCallContextFactory.createInternalCallContext(childAccount.getId(),context)
to
internalCallContextFactory.createInternalTenantContext(childAccount.getParentAccountId(),childAccountContext)
childAccount.getParentAccountId()
to
internalTenantContext.getAccountRecordId()
internalCallContextFactory.createInternalTenantContext(childAccount.getId(),context)
to
internalCallContextFactory.createInternalTenantContext(childAccount.getParentAccountId(),childAccountContext)
internalCallContextFactory.createInternalCallContext(childAccount.getParentAccountId(),context)
to
internalCallContextFactory.createInternalCallContext(internalTenantContext.getAccountRecordId(),childAccountContext)
Rename Variable
context
to
childAccountContext
context
to
childAccountContext
context
to
childAccountContext
context
to
childAccountContext
Update Class Instacne Creation
new DefaultInvoice(childAccount.getParentAccountId(),effectiveDate.toLocalDate(),effectiveDate.toLocalDate(),childAccount.getCurrency(),InvoiceStatus.DRAFT)
to
new DefaultInvoice(childAccount.getParentAccountId(),effectiveDate.toLocalDate(),effectiveDate.toLocalDate(),childAccount.getCurrency(),InvoiceStatus.COMMITTED)
Update Anonymous class
{ @Override public Void inTransaction( final EntitySqlDaoWrapperFactory entitySqlDaoWrapperFactory) throws Exception { final InternalCallContext childInternalCallContext=internalCallContextFactory.createInternalCallContext(childAccount.getId(),context); final InternalCallContext parentInternalCallContext=internalCallContextFactory.createInternalCallContext(childAccount.getParentAccountId(),context); final InvoiceSqlDao invoiceSqlDao=entitySqlDaoWrapperFactory.become(InvoiceSqlDao.class); final InvoiceItemSqlDao transInvoiceItemSqlDao=entitySqlDaoWrapperFactory.become(InvoiceItemSqlDao.class); final DateTime effectiveDate=context.getCreatedDate(); final BigDecimal accountCBA=getAccountCBA(childAccount.getId(),childInternalCallContext); final Invoice invoiceForExternalCharge=new DefaultInvoice(childAccount.getId(),effectiveDate.toLocalDate(),effectiveDate.toLocalDate(),childAccount.getCurrency(),InvoiceStatus.COMMITTED); final String chargeDescription="Charge to move credit from child to parent account"; final InvoiceItem externalChargeItem=new ExternalChargeInvoiceItem(UUIDs.randomUUID(),effectiveDate,invoiceForExternalCharge.getId(),childAccount.getId(),null,chargeDescription,effectiveDate.toLocalDate(),accountCBA,childAccount.getCurrency()); invoiceForExternalCharge.addInvoiceItem(externalChargeItem); final Invoice invoiceForCredit=new DefaultInvoice(childAccount.getParentAccountId(),effectiveDate.toLocalDate(),effectiveDate.toLocalDate(),childAccount.getCurrency(),InvoiceStatus.DRAFT); final String creditDescription="Credit migrated from child account " + childAccount.getId(); final InvoiceItem creditItem=new CreditAdjInvoiceItem(UUIDs.randomUUID(),effectiveDate,invoiceForCredit.getId(),childAccount.getParentAccountId(),effectiveDate.toLocalDate(),creditDescription,accountCBA.negate(),childAccount.getCurrency()); invoiceForCredit.addInvoiceItem(creditItem); InvoiceModelDao childInvoice=new InvoiceModelDao(invoiceForExternalCharge); invoiceSqlDao.create(childInvoice,childInternalCallContext); createInvoiceItemFromTransaction(transInvoiceItemSqlDao,new InvoiceItemModelDao(externalChargeItem),childInternalCallContext); InvoiceModelDao parentInvoice=new InvoiceModelDao(invoiceForCredit); invoiceSqlDao.create(parentInvoice,parentInternalCallContext); createInvoiceItemFromTransaction(transInvoiceItemSqlDao,new InvoiceItemModelDao(creditItem),parentInternalCallContext); cbaDao.addCBAComplexityFromTransaction(childInvoice.getId(),entitySqlDaoWrapperFactory,childInternalCallContext); notifyBusOfInvoiceCreation(entitySqlDaoWrapperFactory,childInvoice,childInternalCallContext); cbaDao.addCBAComplexityFromTransaction(parentInvoice.getId(),entitySqlDaoWrapperFactory,parentInternalCallContext); return null; } }
to
{ @Override public Void inTransaction( final EntitySqlDaoWrapperFactory entitySqlDaoWrapperFactory) throws Exception { final InternalTenantContext internalTenantContext=internalCallContextFactory.createInternalTenantContext(childAccount.getParentAccountId(),childAccountContext); final InternalCallContext parentAccountContext=internalCallContextFactory.createInternalCallContext(internalTenantContext.getAccountRecordId(),childAccountContext); final InvoiceSqlDao invoiceSqlDao=entitySqlDaoWrapperFactory.become(InvoiceSqlDao.class); final InvoiceItemSqlDao transInvoiceItemSqlDao=entitySqlDaoWrapperFactory.become(InvoiceItemSqlDao.class); final DateTime effectiveDate=childAccountContext.getCreatedDate(); final BigDecimal accountCBA=getAccountCBA(childAccount.getId(),childAccountContext); final Invoice invoiceForExternalCharge=new DefaultInvoice(childAccount.getId(),effectiveDate.toLocalDate(),effectiveDate.toLocalDate(),childAccount.getCurrency(),InvoiceStatus.COMMITTED); final String chargeDescription="Charge to move credit from child to parent account"; final InvoiceItem externalChargeItem=new ExternalChargeInvoiceItem(UUIDs.randomUUID(),effectiveDate,invoiceForExternalCharge.getId(),childAccount.getId(),null,chargeDescription,effectiveDate.toLocalDate(),accountCBA,childAccount.getCurrency()); invoiceForExternalCharge.addInvoiceItem(externalChargeItem); final Invoice invoiceForCredit=new DefaultInvoice(childAccount.getParentAccountId(),effectiveDate.toLocalDate(),effectiveDate.toLocalDate(),childAccount.getCurrency(),InvoiceStatus.COMMITTED); final String creditDescription="Credit migrated from child account " + childAccount.getId(); final InvoiceItem creditItem=new CreditAdjInvoiceItem(UUIDs.randomUUID(),effectiveDate,invoiceForCredit.getId(),childAccount.getParentAccountId(),effectiveDate.toLocalDate(),creditDescription,accountCBA.negate(),childAccount.getCurrency()); invoiceForCredit.addInvoiceItem(creditItem); InvoiceModelDao childInvoice=new InvoiceModelDao(invoiceForExternalCharge); invoiceSqlDao.create(childInvoice,childAccountContext); createInvoiceItemFromTransaction(transInvoiceItemSqlDao,new InvoiceItemModelDao(externalChargeItem),childAccountContext); InvoiceModelDao parentInvoice=new InvoiceModelDao(invoiceForCredit); invoiceSqlDao.create(parentInvoice,parentAccountContext); createInvoiceItemFromTransaction(transInvoiceItemSqlDao,new InvoiceItemModelDao(creditItem),parentAccountContext); cbaDao.addCBAComplexityFromTransaction(childInvoice.getId(),entitySqlDaoWrapperFactory,childAccountContext); notifyBusOfInvoiceCreation(entitySqlDaoWrapperFactory,childInvoice,childAccountContext); cbaDao.addCBAComplexityFromTransaction(parentInvoice.getId(),entitySqlDaoWrapperFactory,parentAccountContext); notifyBusOfInvoiceCreation(entitySqlDaoWrapperFactory,parentInvoice,parentAccountContext); return null; } }