oracle adf architecture tv - design - task flow communication pattern

Post on 10-Nov-2014

244 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

Slides from Oracle's ADF Architecture TV series covering the Design phase of ADF projects, looking into the different options for communication between ADF task flows. Like to know more? Check out: - Subscribe to the YouTube channel - http://bit.ly/adftvsub - Design Playlist - http://www.youtube.com/playlist?list=PLJz3HAsCPVaSemIjFk4lfokNynzp5Euet - Read the episode index on the ADF Architecture Square - http://bit.ly/adfarchsquare

TRANSCRIPT

1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

2 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Real World ADF Design & Architecture Principles Task Flow & Region Communication Patterns

ORACLE PRODUCT

LOGO

15th Feb 2013 v1.0

3 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Learning Objectives

•  At the end of this module you should be able to:

– Understand different patterns of ADF region interaction – Be able to choose the right pattern to implement for a problem – Understand the dos and don’ts of task flow communication

Image: imagerymajestic/ FreeDigitalPhotos.net

4 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Program Agenda

•  Task Flow Call Options •  Region Interaction Recipes •  Contextual Events •  Exercises

5 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Task Flow Communication Bounded Task Flow Call Options

Bounded Task Flow

Region

Task Flow Call Activity

displayed in

navigate to

URL GET Request navigate to

6 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Task Flow Communication Call Activity

Task Flow

Task Flow Call Activity navigate to

provision Input Parameter Input Parameter Input Parameter

7 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Task Flow Communication Call Activity

Task Flow

Task Flow Call Activity return control to

process

Return Value Return Value

Return Activity

8 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Task Flow Communication ADF Region

Shared Data Control

Task Flow provision

Input Parameter Input Parameter Input Parameter

Region Parent View

Task Flow Binding

refresh

Parent View PageDef

get RegionModel

9 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 9 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

But where is the return value in ADF regions?

Exercise

Image: imagerymajestic/ FreeDigitalPhotos.net

10 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Program Agenda

•  Task Flow Call Options •  Region Interaction Recipes •  Contextual Events •  Exercises

11 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Example

Region 1

Region 2

12 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Region Interaction

•  Shared Data Control •  Input Parameters

– Parameter changes –  JavaBean instance references

•  ADF Region events •  Contextual events

Establishing Communication

13 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Secret of Oracle ADF Rockstar Programmers

Often there is no single solution to a problem. Use case matters.

14 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Parent-to-Region

•  Master-detail synchronization between parent view and content shown in region

•  Parent view passing data to child region for further processing –  Embedded wizard use case

•  Parent view triggering navigation in region –  Generic CRUD flow –  Content switcher to display different views for a set of data

Usecase

15 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Region-to-Parent

•  Region to return value to parent view at end of task flow processing –  Region "exit" use case

•  Region method call to call behavior on parent view –  Dynamic Tab Shell Template use case

•  Navigate parent view in response to region change •  Change dynamic task flow configuration from region

Usecase

16 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Region-to-Region

•  Master-Detail behavior •  Region causing navigation in another •  Data passing

Usecase

17 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Program Agenda

•  Task Flow Call Options •  Region Interaction Recipes

– Shared Data Control –  Input Parameter – Region Events – Other

•  Contextual Events •  Exercises

18 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Parent-to-Region Master-Detail Behavior – Shared DC

Task Flow

af:region

Parent View

View <file>.jsff

Next Previous Administration PPR

1.

4.

19 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Parent-to-Region Master-Detail Behavior – Shared DC

Task Flow

af:region

Parent View

View <file>.jsff

<file>PageDef.xml

dependentEmployees Iterator

<file>PageDef.xml

allDepartmentsIterator

Next Previous Administration change row currency

PPR

1.

2.

4.

20 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Parent-to-Region Master-Detail Behavior – Shared DC

Task Flow

af:region

Parent View

View <file>.jsff

<file>PageDef.xml

dependentEmployees Iterator

<file>PageDef.xml

allDepartmentsIterator

Next Previous Administration change row currency

change row currency

PPR

update

1.

2.

3.

4.

21 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Parent-to-Region Master-Detail Behavior – Isolated DC

Task Flow

af:region

Parent View

View <file>.jsff

Next Previous Administration PPR

1.

4.

22 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Parent-to-Region Master-Detail Behavior – Isolated DC

Task Flow

af:region

Parent View

View <file>.jsff

<file>PageDef.xml

dependentEmployees Iterator

Data Control Layer

<file>PageDef.xml

allDepartmentsIterator

Next Previous Administration change row currency

PPR

Data Control Layer

taskFlowBinding

DepartmentName

detect change parameter value

Input Parameter

query

1.

2.

3.

4.

23 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Program Agenda

•  Task Flow Call Options •  Region Interaction Recipes

– Shared Data Control –  Input Parameter – Region Events – Other

•  Contextual Events •  Exercises

24 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Parent-to-Region Common Usecase: Navigate to Specific View in Region

Task Flow

af:region

Input Parameter

Parent Flow

control flow case 1

control flow case 2 view1

view2

view3

view3 Show View 3 On Click

PPR

25 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Region-to-Parent Bean Reference Injection

Bounded Task Flow

af:region

Input Parameter

Insert References to Parent View API

Managed Bean

Parent Task Flow (unbounded or bounded)

#{viewScope.ManagedBean}

Managed Bean

invokes method on caller

reference saved in

26 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Region-to-Parent: Chaperone in Action Usecase: Self closing regions in tabs

Bounded Task Flow

af:region

Managed Bean

Parent View Dynamic Tab Shell

Managed Bean View Scope

Input Parameter

View1 View2 Return Activity

Method Activity

27 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Region-to-Parent: Chaperone in Action Usecase: Self closing regions in tabs

Bounded Task Flow

af:region

Managed Bean

Parent View Dynamic Tab Shell

Managed Bean View Scope

View1 View2 Return Activity

Method Activity

Invoke method on

28 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Region-to-Parent: Chaperone in Action Usecase: Self closing regions in tabs

Bounded Task Flow

af:region

Managed Bean

Parent View Dynamic Tab Shell

Managed Bean View Scope

View1 View2 Return Activity

Method Activity

Invoke method on

29 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Region-to-Parent: Chaperone in Action Usecase: Self closing regions in tabs

Bounded Task Flow

af:region

Managed Bean

Parent View Dynamic Tab Shell

Managed Bean View Scope

View1 View2 Return Activity

Method Activity

Invoke method on

close tab

30 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Program Agenda

•  Task Flow Call Options •  Region Interaction Recipes

– Shared Data Control –  Input Parameter – Region Events – Other

•  Contextual Events •  Exercises

31 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Region-to-Parent Navigate Parent View : RegionNavigationListener

af:region

Shopping Cart View Checkout View

checkOut

Task Flow

View1 View2 Return Activity

"view1" "view2" null

32 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Region-to-Parent Navigate Parent View : RegionNavigationListener

af:region

Shopping Cart View Checkout View

checkOut

Task Flow

View1 View2 Return Activity

"view1" "view2" null

?

33 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Region-to-Parent Navigate Parent View : RegionNavigationListener

af:region

Shopping Cart View Checkout View

checkOut

Task Flow

View1 View2 Return Activity

RegionNavigation Listener

If(viewId == null){ //navigate to //checkout }

"view1" "view2" null

Managed Bean

34 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Secret of Oracle ADF Rockstar Programmers

The Region Navigation Listener listens for what happens in a region not for what happens to a region

35 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Parent-to-Region

•  Method of the af:region component –  RichRegion

•  Invokes an ActionEvent as if it was queued from a command component inside a region –  Does not require the ADF region to refresh –  Used for navigating between activities

•  Control flow cases are discoverable

Navigate Region: queueActionEventInRegion

36 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Parent-to-Region

•  Region capabilities are used by a page to identify the available navigation cases for a view displayed in a region

Determine Region Capabilities in EL

#{bindings.[regionId].regionModel.capabilities['outcome']}

37 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Parent-to-Region

•  Determine Region Capabilities in Java

//backing bean with region component binding RichRegion region = this.getEmpRegion(); RegionModel model = region.getRegionModel(); Set<String> capabilities = model.getCapabilities(); ...

38 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Parent-to-Region Navigate Region: QueueActionEventInRegion

af:region

Parent View

Task Flow

View2

View3

View4 View5

toView2 toView5

View1

Managed Bean

Handle Navigation

RichRegion region = ... region.queueActionEventInRegion(...)

Press to Navigate

toView1

39 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Program Agenda

•  Task Flow Call Options •  Region Interaction Recipes

– Shared Data Control –  Input Parameter – Region Events – Other

•  Contextual Events •  Exercises

40 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Region-to-Parent Navigate Parent View : Parent Activity

af:region

Shopping Cart View

CheckoutView

checkout

Task Flow

View1 View2 FailView

Task Flow

checkoutCallFailed

41 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Region-to-Parent Navigate Parent View : Parent Activity

af:region

Shopping Cart View

CheckoutView

checkout

Task Flow

View1 View2 FailView

Task Flow

checkoutCallFailed

42 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Region-to-Parent Navigate Parent View : Parent Activity

af:region

Shopping Cart View

CheckoutView

checkout

Task Flow

View1 View2 FailView

Task Flow

checkoutCallFailed

43 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Program Agenda

•  Task Flow Call Options •  Region Interaction Recipes

– Shared Data Control –  Input Parameter – Region Events – Other

•  Contextual Events •  Exercises

44 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

About Contextual Events

•  Mechanism on the ADF binding layer for creating loosely coupled publish and subscribe event models

•  Events may carry a data payload –  Payload does not have to be a single simple scalar type but can be a

complex object

•  Require fragment based task flows embedded within page regions •  Task flows with event producer and consumers can be saved in ADF

libraries

45 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Contextual Events #1 Parent View

ParentViewPageDef

View Port View Port

Region 1 Region 2 ViewPageDef ViewPageDef

1 2

Event Map

Raise Event

46 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Parent View

ParentViewPageDef

View Port View Port

Region 1 Region 2 ViewPageDef ViewPageDef

Contextual Events #2

2 1

Event Map

Raise Event

47 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Parent View

ParentViewPageDef

View Port View Port

Region 1 Region 2 ViewPageDef ViewPageDef

Region 3

View Port

Contextual Events #3

1

2 3 Event Map

Raise Event

48 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Contextual Events

•  Discoverability –  Event producer and event receiver

•  Documentation •  Event payload

–  What type of object is it? –  What is in a payload?

•  Developer "skill-up"

Challenges

49 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Program Agenda

•  Task Flow Call Options •  Region Interaction Recipes

– Shared Data Control –  Input Parameter – Region Events – Other

•  Contextual Events •  Exercises

50 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Exercise #1

•  The corporate architecture board is asked to suggest a solution for implementing master-detail behavior between two regions

•  The application requirement is to coodinate the content displayed in the region such that one shows customer information and the other the selected customer's orders

•  Further the requirement is that the view shows the master-detail behavior upon its initial rendering

•  Changing the customer displayed in the parent (customer) region should immediately show the associated orders is response

Parent-Child Relationship Between Regions

51 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Exercise #1 Parent-Child Relationship Between Regions

Parent View

Customer View Customer - Orders View

52 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Exercise #2

•  The requirement is for a task flow in a region to be able to hide / show components in the parent view

•  The use case that needs to be implemented is to conditionally hide / show (default) a panel accordion

Help the Team

53 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Exercise #2 Hide/Show Components From a Region

Parent View

Region Customer

Orders Pending Shipments

Payments

Conditionally Hide&Show Accordion

Questions?

54 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Conclusion

•  Keep it simple! Contextual events is powerful but not needed in many cases

•  Don't make any assumption in a task flow about the environment the task flow executes in and how it is called

•  Document task flow requirements for input parameters and return values

•  Use task flow templates

55 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

Further Reading

•  ADF Region Interaction Functional Pattern –  http://www.oracle.com/technetwork/developer-tools/adf/adfregioninteraction-155145.html

•  Contextual Events Introduction –  http://www.oracle.com/technetwork/issue-archive/2011/11-may/o31adf-352561.html

•  Contextual Events: Callback pattern –  http://www.oracle.com/technetwork/developer-tools/adf/learnmore/

regionpayloadcallbackpattern-1865094.pdf

•  Master- commander: reusable contextual event solution –  http://www.oracle.com/technetwork/issue-archive/2012/12-nov/o62adf-1867716.html

•  Parent view initializing region navigation –  http://www.oracle.com/technetwork/developer-tools/adf/learnmore/

externaltrainnavigationpattern-1845645.pdf

56 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.

top related