Difference between revisions of "Equinox Integration 2/Tutorial Extension Point"
From ADempiere
This Wiki is read-only for reference purposes to avoid broken links.
Line 8: | Line 8: | ||
* Navigate to Doc_Invoice.createFaccts() | * Navigate to Doc_Invoice.createFaccts() | ||
− | * Insert the line IInvoicePoster invoicePoster = Service.locate().getInvoicePoster() | + | * Insert the line <code>IInvoicePoster invoicePoster = Service.locate().getInvoicePoster()</code>. Eclipse will highlight some errors, we will repeatedly use Code assist (Ctrl-1) to proceed. |
− | * | + | * Position the cursor on <code>IInvoicePoster</code>, create new interface using code assist. |
− | * | + | ** Create the interface in the package <code>org.adempiere.base</code> |
+ | ** In this package, all core interfaces should resist. | ||
+ | ** Create the (empty) interface and save. | ||
+ | * Back to Doc_Invoice, position the cursor on <code>getInvoicePoster()</code>, create new method using code assist. | ||
+ | ** The new method is inserted in the interface IServiceLocator. Save it. | ||
+ | * Back to Doc_Invoice, insert the line <code>invoicePoster.post()</code> | ||
+ | * create new method post() using code assist. | ||
+ | ** The method is inserted into the new interface <code>IInvoicePoster</code> | ||
+ | |||
= Locate and define extension point = | = Locate and define extension point = | ||
= Write the plugin = | = Write the plugin = |
Revision as of 06:18, 31 January 2010
If you want to extract some functionality out of the core and provide a new extension point so that plug-ins can provide an extension, read on.
Example: Let plugins implement how invoices are posted to FACCT.
Replace core code by call to service
- Navigate to Doc_Invoice.createFaccts()
- Insert the line
IInvoicePoster invoicePoster = Service.locate().getInvoicePoster()
. Eclipse will highlight some errors, we will repeatedly use Code assist (Ctrl-1) to proceed. - Position the cursor on
IInvoicePoster
, create new interface using code assist.- Create the interface in the package
org.adempiere.base
- In this package, all core interfaces should resist.
- Create the (empty) interface and save.
- Create the interface in the package
- Back to Doc_Invoice, position the cursor on
getInvoicePoster()
, create new method using code assist.- The new method is inserted in the interface IServiceLocator. Save it.
- Back to Doc_Invoice, insert the line
invoicePoster.post()
- create new method post() using code assist.
- The method is inserted into the new interface
IInvoicePoster
- The method is inserted into the new interface