Ha I see, you speak about

    <EnumerationType description="Product Promotion Parent Enum Type" enumTypeId="PROD_PROMO" 
hasTable="N" parentTypeId=""/>
    <EnumerationType description="Product Promotion Input Parameter" enumTypeId="PROD_PROMO_IN_PARAM" 
hasTable="N" parentTypeId="PROD_PROMO"/>
    <EnumerationType description="Product Promotion Condition" enumTypeId="PROD_PROMO_COND" 
hasTable="N" parentTypeId="PROD_PROMO"/>

Then yes I understand and I think a POC would be welcome :)

Jacques


Le 11/12/2017 à 13:08, Jacques Le Roux a écrit :
Hi Nicolas,

I don't see why you speak about enumeration for ProductPromoCond and 
ProductPromoAction which are plain entities.

Jacques


Le 08/12/2017 à 14:14, Nicolas Malin a écrit :
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




Reply via email to