Implementing routers

Router activities are used to declaratively route control to activities, based on logic specified in an EL expression. They are used to branch to multiple control flows leading from it, to different activities.

Each router case contains the elements Expression and Outcome. They are used to choose the activity to which control is next routed:

  • Expression: This is an EL expression evaluating to either true or false. The first expression that evaluates to true is used to determine the corresponding outcome.
  • Outcome: This is a value returned by the router activity if the EL expression evaluates to true.

How to do it...

In this section, you will cover how to implement declarative route control, as follows:

  1. In JDeveloper, go to EnterQuoteDetailsUI project | Web Content | Page Flows and click on EnterQuoteDetails_TaskFlow.xml.
  2. Go to Component Palette | ADF Task Flow | Components and drag-and-drop the activity Router on the designer. Name it RouteEnterQuote.
  3. You can find a Property Inspector for the router RouteEnterQuote in the lower-right side. If not, click on Menu at View | Property Inspector.
    How to do it...
  4. Go to Component Palette | ADF faces | Components and click on Control Flow Cases.
  5. Create a flow case from the RouteEnterQuote router to the SalesQuote_ProductLess view and name it WithoutProduct.
  6. Create a flow case from the RouteEnterQuote router to the SalesQuote view and name it WithProduct.
  7. Click on the RouteEnterQuote router in the designer and go to Properties.
  8. Click on the green plus (+) icon to the right of the cases.
  9. Choose Expression Builder from the the drop-down menu.
  10. In Expression Builder, expand Data | EnterQuoteDetailsUI_SalesQuotePageDef and select AccountName.
  11. Enter the following expression:
    #{data.enterquotedetailsui_SalesQuotePageDef.AccountName == "FusionNX"}
    
    How to do it...
  12. Click OK.
  13. In the Outcome drop-down menu, select WithoutProduct as the outcome.
  14. Similarly, add another expression:
    {data.enterquotedetailsui_SalesQuotePageDef.AccountName!= "FusionNX"}
    

    Then, select the outcome WithProduct.

    How to do it...
  15. Click Router and set the default outcome in Property Inspector as WithoutProduct.
  16. This outcome is returned if none of the cases for the router activity evaluate to true, or if no cases are specified.
  17. Right-click the router RouteEnterQuote, click Mark Activity, and select Default Activity. This will ensure that the router is called.
    How to do it...

How it works...

When the router expression evaluates to true, control passes to the activity that the the control flow case points to, based on the outcome specified in the properties, for that expression. If none of the cases for the router activity evaluate to true, or if no cases are specified, the outcome specified in the router default outcome field (if any) is used.

Hence, when the quote payload (initialized by a Script Task) or the Quote Message arrives to the SalesToContract process (in case the SalesToContract process is exposed as a service or accepts messages), with value of account name as FusionNX, the first expression gets evaluated to true and control passes to the SalesQuote_ProductLess view, based on the outcome being set as WithoutProduct, in Properties.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.2.225