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

Oracle ADF Architecture TV - Design - Task Flow Data Control Scope Options

Embed Size (px)

DESCRIPTION

Slides from Oracle's ADF Architecture TV series covering the Design phase of ADF projects, investigation the task data control scope options. 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

Citation preview

Page 1: Oracle ADF Architecture TV - Design - Task Flow Data Control Scope Options

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

Page 2: Oracle ADF Architecture TV - Design - Task Flow Data Control Scope Options

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

Task Flow Data Control Scope Options

ORACLE PRODUCT

LOGO

Real World ADF Design & Architecture Principles

15th Feb 2013 v1.0

Page 3: Oracle ADF Architecture TV - Design - Task Flow Data Control Scope Options

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

Learning Objectives

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

– Understand how the traditional concept of transactions aligns to that of ADF

–  Identify different data controls and their transaction capabilities – Explain the influence of the task flow data control scope option

and how it relates to data controls

Image: imagerymajestic/ FreeDigitalPhotos.net

Page 4: Oracle ADF Architecture TV - Design - Task Flow Data Control Scope Options

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

Program Agenda

•  Transactions Revisited •  ADF Data Controls •  Task Flow “Data Control Scope"

Page 5: Oracle ADF Architecture TV - Design - Task Flow Data Control Scope Options

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

In terms of database systems what is a transaction? Why are they needed?

In ADF where are the transactional capabilities defined?

Exercise

Image: imagerymajestic/ FreeDigitalPhotos.net

Page 6: Oracle ADF Architecture TV - Design - Task Flow Data Control Scope Options

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

Transactions Revisited

•  The common definition

– A collection of work with a start and end – Commit or rollback acts on the entire collection of work –  If an errors occur we don’t get stuck half way

– Other users are isolated from the transactions – Only future transactions see the results

Page 7: Oracle ADF Architecture TV - Design - Task Flow Data Control Scope Options

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

Transactions – What You Forgot

•  Remember transactions aren’t just about commit and rollback

–  They allow one user to chain operations together – Not just separate atomic actions – Each operation sees the previous changes within the transaction – Not visible to other users, but are visible to the current user – As such transactions are also a form of state management

Page 8: Oracle ADF Architecture TV - Design - Task Flow Data Control Scope Options

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

Where in ADF are the transactional capabilities

exposed (defined) to the UI layer again?

Exercise

Image: imagerymajestic/ FreeDigitalPhotos.net

Page 9: Oracle ADF Architecture TV - Design - Task Flow Data Control Scope Options

9 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.

Transactions & Data Controls

•  Data controls provide the transactional APIs in ADF – Remember this isn’t just commit and rollback – But also state management

•  Typically one instance is given to each user session –  This separates users’ transactions

•  Dependent on design – A user can be given multiple instances to perform multiple

transactions

Page 10: Oracle ADF Architecture TV - Design - Task Flow Data Control Scope Options

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

Program Agenda

•  Transactions Recap •  ADF Data Controls •  Task Flow “Data Control Scope"

Page 11: Oracle ADF Architecture TV - Design - Task Flow Data Control Scope Options

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

ADF Data Controls Types

•  ADF BC •  EJB/JPA •  POJO •  RESTful/URL •  SOAP/Web service •  Custom data controls

All designed to carry state

EJB/JPA out-of-the-box uses an implicit commit

model

Only ADF BC supports explicit commit &

rollbacks

Page 12: Oracle ADF Architecture TV - Design - Task Flow Data Control Scope Options

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

ADF Data Controls Challenges •  If transactions are logically mapped to navigating groups of web pages

–  Q: How do we map the data control transaction to these boundaries?

•  If we need to support separate transactions per session –  Q: How do we configure this with just one data control?

•  If ADF libraries may split data control definitions –  Q: How to combine @ runtime with one instance and they can share state?

•  If our application uses multiple different data control types –  Q: How to commit/rollback as a group?

Page 13: Oracle ADF Architecture TV - Design - Task Flow Data Control Scope Options

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

ADF Data Controls Challenges & Solutions •  If transactions are logically mapped to navigating groups of web pages

–  Q: How do we map the data control transaction to these boundaries? –  A: Task flows allow you to define groups of pages/fragments and task flows

•  If we need to support separate transactions per session –  Q: How do we configure this with just one data control? –  A: Task flows can create a new data control or share an existing one

•  If ADF libraries may split data control definitions –  Q: How to combine @ runtime with one instance and they can share state? –  A: Intelligence is built in to combine data controls at runtime

•  If our application uses multiple different data control types –  Q: How to commit/rollback as a group? –  A: Task flows track the data controls attached as a group

Page 14: Oracle ADF Architecture TV - Design - Task Flow Data Control Scope Options

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

ADF Data Controls Challenges & Solutions •  If transactions are logically mapped to navigating groups of web pages

–  Q: How do we map the data control transaction to these boundaries? –  A: Task flows allow you to define groups of pages/fragments and task flows

•  If we need to support separate transactions per session –  Q: How do we configure this with just one data control? –  A: Task flows can create a new data control or share an existing one

•  If ADF libraries may split data control definitions –  Q: How to combine @ runtime with one instance and they can share state? –  A: Intelligence is built in to combine data controls at runtime

•  If our application uses multiple different data controls –  Q: How to commit/rollback as a group? –  A: Task flows track the data controls attached as a group

Answered in the previous presentations

Page 15: Oracle ADF Architecture TV - Design - Task Flow Data Control Scope Options

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

ADF Data Controls Challenges & Solutions •  If transactions are logically mapped to navigating groups of web pages

–  Q: How do we map the data control transaction to these boundaries? –  A: Task flows allow you to define groups of pages/fragments and task flows

•  If we need to support separate transactions per session –  Q: How do we configure this with just one data control? –  A: Task flows can create a new data control or share an existing one

•  If ADF libraries may split data control definitions –  Q: How to combine @ runtime with one instance and they can share state? –  A: Intelligence is built in to combine data controls at runtime

•  If our application uses multiple different data controls –  Q: How to commit/rollback as a group? –  A: Task flows track the data controls attached as a group

Answered in the this presentation

Page 16: Oracle ADF Architecture TV - Design - Task Flow Data Control Scope Options

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

ADF Data Controls Challenges & Solutions •  If transactions are logically mapped to navigating groups of web pages

–  Q: How do we map the data control transaction to these boundaries? –  A: Task flows allow you to define groups of pages/fragments and task flows

•  If we need to support separate transactions per session –  Q: How do we configure this with just one data control? –  A: Task flows can create a new data control or share an existing one

•  If ADF libraries may split data control definitions –  Q: How to combine @ runtime with one instance and they can share state? –  A: Intelligence is built in to combine data controls at runtime

•  If our application uses multiple different data controls –  Q: How to commit/rollback as a group? –  A: Task flows track the data controls attached as a group

Answered in the next presentation

Page 17: Oracle ADF Architecture TV - Design - Task Flow Data Control Scope Options

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

Task Flow Transaction and Data Control Scope Options

<?xml version="1.0" encoding="ISO-8859-1" ?> <adfc-config xmlns="http://xmlns.oracle.com/adf/controller" version="1.2"> <task-flow-definition id="task-flow-definition"> <transaction> <new-transaction/> </transaction> <data-control-scope> <isolated/> </data-control-scope> <use-page-fragments/> </task-flow-definition> </adfc-config>

Page 18: Oracle ADF Architecture TV - Design - Task Flow Data Control Scope Options

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

Shared Data Control Scope

•  “Share data controls with calling task flow” •  Shared

–  Between calling & called task flows –  If data controls are of the same

name and type –  Only one instance of the data

control will be created & shared –  And view objects sharing:

• Current row indicators •  Edit the same records • One database connection

Page 19: Oracle ADF Architecture TV - Design - Task Flow Data Control Scope Options

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

Isolated Data Control Scope

•  Don’t’ “Share data controls with calling task flow” •  Isolated

–  Regardless two instances of the data control

–  Allows disparate data control transactions

–  Separate view objects • No record coordination •  Isolated record editing •  Separate connections

Page 20: Oracle ADF Architecture TV - Design - Task Flow Data Control Scope Options

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

Our system provides the user access to two isolated instances of the same data control simultaneously, and we're now infrequently

hitting row lock errors.

Why and what’s the solution?

Exercise

Image: imagerymajestic/ FreeDigitalPhotos.net

Page 21: Oracle ADF Architecture TV - Design - Task Flow Data Control Scope Options

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

Shared Data Control Scope: To

2

1

3

4

Page 22: Oracle ADF Architecture TV - Design - Task Flow Data Control Scope Options

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

Shared Data Control Scope: Returning

1 3 4

2

Page 23: Oracle ADF Architecture TV - Design - Task Flow Data Control Scope Options

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

Isolated Data Control Scope: To

1

2

4 3

Page 24: Oracle ADF Architecture TV - Design - Task Flow Data Control Scope Options

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

Isolated Data Control Scope: Returning

Page 25: Oracle ADF Architecture TV - Design - Task Flow Data Control Scope Options

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

Isolated Data Control Scope: Returning

1 2

4

5

3 6

Page 26: Oracle ADF Architecture TV - Design - Task Flow Data Control Scope Options

26 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 26 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Image: Ambro / FreeDigitalPhotos.net

Every isolated task flow means separate data control instances, more memory consumed, and if using ADF BC more database

connections consumed.

Page 27: Oracle ADF Architecture TV - Design - Task Flow Data Control Scope Options

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

Rules for Sharing Data Controls

•  Data control must be in same data control frame •  Same data control type – eg. ADF BC, EJB, WebService •  Across ADF Libraries

– At design time if same data control comes from two different ADF libraries, if they have the same name they can also share

Page 28: Oracle ADF Architecture TV - Design - Task Flow Data Control Scope Options

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

Conclusion

•  The data control scope allows task flows to share or create separate instances of data controls

•  If shared they will share a transaction and state •  If isolated they will have their own transaction and state •  Isolated makes sense when parts of the application state must

be kept separate and independent –  But does have an overhead of extra memory and (for ADF BC) database

connections –  And you lose sharing state (such as current iterator positions) across

separate instances of the same view object

Page 29: Oracle ADF Architecture TV - Design - Task Flow Data Control Scope Options

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

Further Reading

Essential to view the next slides on Task Flow Transaction Options

Page 30: Oracle ADF Architecture TV - Design - Task Flow Data Control Scope Options

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