Page 1 of 1

Overriding broadleaf workflows

Posted: Tue Feb 04, 2014 9:03 am
by swyd
Hi,

in our current project we edited most of the Broadleaf predefined workflows, especially pricing since migration to Europe tax model was mandatory.

Now with the migration to 3.0.5 a change in BLC occurred where when you define a workflow in a custom XML it doesn't override the BLC predefined one but merges them together, so we get double calls to a bunch of methods, e.g. when adding an item, first our custom activity is executed and then the default BLC one is, which was previously not the case.

My question is, is it possible to turn off specific activities from workflows ? Since creating custom workflows and editing all the services will require much more work.

Best regards,
Djordje

Re: Overriding broadleaf workflows

Posted: Wed Feb 05, 2014 4:45 am
by Theo Schumacher
Hi,

I'am also experiencing problems with overriding workflows. I'am working with 3.0.8GA. (see post http://forum.broadleafcommerce.org/viewtopic.php?f=15&t=2453)
I followed the getting started guide and added the workflow sequence definition to applicationContext.xml but I'am getting strange errors.

did you change your applicationContext.xml and how ?

In the near future I will also be faced to implement european VAT model in broadleaf. Any hints on that would be welcome ;)

Regards

Re: Overriding broadleaf workflows

Posted: Wed Feb 05, 2014 11:44 am
by phillipuniverse
Right, if you are migrating from Broadleaf 2.x to Broadleaf 3.x, this has changed about workflows. Nothing about workflows has changed between Broadleaf 3.0.0-GA and Broadleaf 3.0.8-GA (nor will it).

If you want to disable a particular activity from running, you can override the bean to be a 'passthrough activity'. For instance, if I want to disable the ValidateUpdateRequestActivity within the blUpdateItemWorkflow which is defined in Broadleaf as:

Code: Select all

<bean p:order="1000" id="blValidateUpdateRequestActivity" class="org.broadleafcommerce.core.order.service.workflow.update.ValidateUpdateRequestActivity"/>


Then you can change it in your application context to instead be:

Code: Select all

<bean p:order="1000" id="blValidateUpdateRequestActivity" class="com.mycompany.core.workflow.PassThroughActivity"/>


Code: Select all

/**
 * A do-nothing activity that just returns the context that was passed in
 */
public class PassThroughActivity extends BaseActivity<CartOperationContext> {
    @
Override
    
public CartOperationContext execute(CartOperationContext contextthrows Exception {
        return 
context;
    }
}