Make Callouts replaceable by Factory approach

Description

To make the order callouts extendable they should be refactored to use the factory concept.
As a POC I have taken out the qty and amt callouts from CalloutOrder and moved them to the new OrderCalloutFactory. If acceptable, the other callouts should follow.
For the necessary changes to the related OrderLine fields the migration scripts are attached.

Environment

None

Attachments

6

Activity

Show:

Dirk Niemeyer August 28, 2015 at 3:31 PM
Edited

I had to refine the factory approach to check if the requested method was provided by the class provided from the factory. Otherwise one would have to implement for example all 13 methods defined by the class CalloutOrder and not only the two or three you are interested in to replace.

please check and apply the new patchfile "idempiere-2732-revisited.patch". Thank you.

Dirk Niemeyer July 29, 2015 at 10:54 AM

Hi Carlos ( and Heng Sin),
thank you for taking care.
To keep the callout definition in the AD seems indeed a better approach. I see if I can implement the proposed callout factory approach.

Carlos Ruiz July 22, 2015 at 11:25 PM

Thanks , I consulted about this, his advice is to create

a new ICalloutFactory and refactor the part of GridTab that load callout class into a factory method
i.e the part after String callout = field.getCallout();

so you can replace the callout with same name by your custom like we can do for process factory.
with this approach we don't need to touch the dictionary - we just create a calloutfactory to replace the core callouts with our custom callouts

Dirk Niemeyer July 17, 2015 at 1:13 PM

It turns out to be a bit more complicated to replace a specific callout service by a different one.
To make it specific, I invented a new factory interface IColumnCalloutOrderFactory which is implemented by OrderCalloutFactory.
Core had to be extended to find the best (i.e. with the highest rank) implementation for this specific factory.
This could be the base approach to make the column callouts pluggable.
WDYT?

Fixed

Details

Assignee

Reporter

Labels

Components

Priority

Created July 17, 2015 at 8:00 AM
Updated November 4, 2015 at 1:18 AM
Resolved September 16, 2015 at 4:02 PM