Hello,

Yesterday during a boring time in the come back home train, I read the ofbiz demo data review that the condition and action method are listed through enumeration like :

<ProductPromoAction productPromoId="9010" productPromoActionEnumId="PROMO_GWP" .../> <ProductPromoCond productPromoId="9010" inputParamEnumId="PPIP_PRODUCT_TOTAL" operatorEnumId="PPC_GTE" condValue="1"/>

and liked to the code by java hard code (ProductPromoWorker.java)

condition :
        } else if ("PPIP_PRODUCT_TOTAL".equals(inputParamEnumId)) {
            // this type of condition allows items involved to be involved in other quantity consuming cond/action, and does pro-rate the price
....

action :
} else if ("PROMO_GWP".equals(productPromoActionEnumId)) {
...

This isn't really useful to manage and extend it but an idea raise in my mind :)

Why not replace the enumeration by a customMethod. We can define a interface service one for action and one for condition, with the related customMethodType. Each hard coded enumeration would be convert to service.

Like this we can surcharge the current rules easily and create new one for customer site without modify the core. The main strategy point would be the interface service to pass the good parameters.

<ProductPromoAction productPromoId="9010" customMethodId="PPA_PROMO_GWP" .../> <ProductPromoCond productPromoId="9010" customMethodId="PPC_PRODUCT_TOTAL" operatorEnumId="PPC_GTE" condValue="1"/>

This is easily to improve on java code, screen and data.
What do you thinks ? Do you have an other idea to improve this ?

Cheers,
Nicolas

--
logoNrd <https://nereide.fr/>
        Nicolas Malin
The apache way <http://theapacheway.com/> : *Charity* Apache’s mission is providing software for the public good.
informat...@nereide.fr
8 rue des Déportés 37000 TOURS, 02 47 50 30 54

Apache OFBiz <http://ofbiz.apache.org/>|The Apache Way <http://theapacheway.com/>|réseau LE <http://www.libre-entreprise.org/>

Reply via email to