How to implement callouts on multiple columns and/or multiple table use callout factory?

89 views
Skip to first unread message

shiju01

unread,
Feb 28, 2018, 5:32:02 AM2/28/18
to iDempiere

Hi,

Need to implement callout using Callout Factory  Plugin (ie. ICalloutFactory & ICalloutFromFactory method)   

     Callout should be defined on multiple columns of multiple table for example 


                 a) Table C_Order and Columns  1) Document Type 2) Business Partner 3) Price List
                 b) Table C_Invoice  and Columns  1) Document Type 2) Business Partner 3) Price List
                 c) Table M_Movement and and Columns  1) Document Type 2) Warehouse 3) To_Warehouse
                 d) Table M_Product and and Columns  1) Tax Category

 Following are the two class created  as per the wiki    http://wiki.idempiere.org/en/Developing_Plug-Ins_-_Callout


=============================================================================================================================================


public class CattleyaCalloutFromFactory implements IColumnCallout {

    public String start (Properties ctx, int WindowNo,
            GridTab mTab, GridField mField, Object value, Object oldValue)
    {

        How to handle multiple different columns and tables here -????


=============================================================================================================================================


public class CattleyaCalloutFactory implements IColumnCalloutFactory {

    /**
     *
     * @param tableName
     * @param columnName
     * @return array of matching callouts
     */
    public IColumnCallout[] getColumnCallouts(String tableName, String columnName)
    {
       
        List<IColumnCallout> list = new ArrayList<IColumnCallout>();
       
        if (tableName.equals(MMovement_CAT.Table_Name) && columnName.equals(MMovement_CAT.COLUMNNAME_M_Warehouse_ID))
            list.add(new CattleyaCalloutFromFactory());

        if (tableName.equals(MCOrder_CAT.Table_Name) && columnName.equals(MCOrder_CAT.COLUMNNAME_M_PriceList_ID))
            list.add(new CattleyaCalloutFromFactory());

        if (tableName.equals(MCInvoice_CAT.Table_Name) && columnName.equals(MCInvoice_CAT.COLUMNNAME_M_PriceList_ID))
            list.add(new CattleyaCalloutFromFactory());
           
        if (tableName.equals(MProduct_CAT.Table_Name) && columnName.equals(MProduct_CAT.COLUMNNAME_C_TAXCATEGORY_ID))
            list.add(new CattleyaCalloutFromFactory());

        return list != null ? list.toArray(new IColumnCallout[0]) : new IColumnCallout[0];
    }

}

Kubavat Hardik

unread,
Feb 28, 2018, 5:49:53 AM2/28/18
to iDempiere
I suggest to create different call out classes for different table which implements IColumnCallout.

shiju01

unread,
Feb 28, 2018, 7:57:21 AM2/28/18
to iDempiere

That means there will be one Callout Factory Class and as many Callout classes as required ?

Then what will be the best way to name the callout classes   ?
Reply all
Reply to author
Forward
0 new messages