NF9.1 OSGi New Column Callout Factory

From iDempiere en

Feature: OSGi New Column Callout Factory

Goal: Development

Developer: Hengsin (talk)

Description: Implement a new column callout factory base class that's backed by Map and Lambda functional object.

Usage:
With following Callout class:

public class MyTestAmountCallout implements IColumnCallout {
    @Override
    public String start(Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value, Object oldValue) {
        return null;
    }		
}

Developer can use one of the following approach:

1. At plugin Activator start method, register the callout class.

public void start(BundleContext context) throws Exception {
    var factory = Core.getMappedColumnCalloutFactory();
    factory.addMapping(MTest.Table_Name, MTest.COLUMNNAME_T_Amount, () -> new MyTestAmountCallout());
}

2. Create an osgi component, at the bind method for the IMappedColumnCalloutFactory service.

public void bindService(IMappedColumnCalloutFactory factory) {
    factory.addMapping(MTest.Table_Name, MTest.COLUMNNAME_T_Amount, () -> new MyTestAmountCallout());
}

3. Create a subclass of MappedColumnCalloutFactory, register as IColumnCalloutFactory service (DO NOT register as IMappedColumnCalloutFactory service).

public class MyFactory extends MappedColumnCalloutFactory {
    public MyFactory() {
	addMapping(MTest.Table_Name, MTest.COLUMNNAME_T_Amount, () -> new MyTestAmountCallout());
    }
}

Technical Info: IDEMPIERE-4690

Cookies help us deliver our services. By using our services, you agree to our use of cookies.