reuse in adf applications
TRANSCRIPT
Reuse in ADF applications
June 2nd 2016. Matthieu de Graaf & Frank Houweling
Write once, Use everywhere
2
Content
• Short introduction into Oracle ADF
• Reuse in Taskflows
• Reuse in the UI layer– Crud actions– Dynamic Save/Rollback buttons
• Reuse in the model layer– Selection of sequences– Executing database procedures– Make a screen readonly in seconds
• Final example– Global search out of the box
Frank Houweling
• Principal Java / ADF / SOA consultant - AMIS (Netherlands)
• Focus on performance diagnosis & performance management
• Frequent speaker at Kscope, UKOUG and OOW
• Tech Lead of ADF Performance Monitor
Matthieu de Graaf
• Principal Java / ADF consultant - AMIS (Netherlands)
• Focus on ADF/Database and .Net (WPF) Development
• Not so frequent speaker
5
Short introduction into Oracle ADF
Application
Module
ViewController Part
Model Part
Taskflow
View Objects
Entity Objects
Application Module
Page(fragments)
Beans
Database
UI description
Dynamic behavior of UI
Business data, retrieves data
Interface to the outside world
Interface to the ViewControllerTransaction management1:1 presentation of the database tables in the java world
6
Reuse in the UI Layer: Taskflowtemplates
• By means of taskflow templates
• Default Structure
• Error handling
• Close actions for a popup
7
Reuse in the UI layer: TaskflowBean
Library Module
TaskflowBean
Taskflow
ModuleBean
taskflowBean
Is instantiated in
Is subclassed in
8
TaskflowBean: Utility Functions
• Contains general utility functions
– Example refresh of UI components
Page:
Bean:
this.refreshPageComponent(“buttonbarPanel");
9
TaskflowBean: Container for behaviour of declarative components
• Container for (declarative) components
10
Container for declarative components – pattern
Library Module
DeclCompBean
Page
TaskflowBean
Binds to
Declarative component
Can be subclassed inModuleDeclCompBean
Binds to
Is used inMy
Declarative component
Default behavior
Module specific behavior
12
Example declarative component
• CrudPanel: For Inserting, editing and deleting occurences – Edit link default not shown
13
CrudBean: Add Part in the library
14
Crud Actions: non default behavior
15
TaskflowBean: Enabling/Disabling Save/Cancel buttons
• Enabling/Disabling of save/cancel buttons depending on the dirty state of the Datacontrol associated with the taskflow
No changes to be saved
Changes
16
TaskflowBean: Enabling/Disabling Save/Cancel buttons
Library Module
Taskflow
PageLifeCycleBean Page
RibbonSavePanelcomponent
Label
Autosubmit is true
Evaluates #{pageFlowScope.taskflowBea
n.isDataControlDirty
taskflowBean
Refreshes the panel surrounding the save/Cancel
buttons
SaveBean
17
Reuse in the model layer
• Generate sequence values
• Call stored procedures/functions
• Set page in readonly mode
18
Reuse in de model layer
• Use Subclasses of the standard Entity/ViewObject/ApplicationModule classes
Class Subclass of object Subclass of row of Object
ApplicationModule ApplicationModuleImpl -
Entity EntityImpl
ViewObject ViewObjectImpl ViewObjectRowImpl
19
Generate sequence in ADF
• Override EntityImpl: initDefaults method
20
Call stored procedures
• Override ApplicationModuleImpl
21
Make a page readonly
22
Make a page readonly
Library Module
ViewObjectRowImplTaskflow
taskflowBean
page
ViewObjectImpl
UpdateModeProperty
attributeUpdatable Property
Sets the attributeUpdatable
Property
UpdateMode prop.
Iterator prop.
23
Reuse in UI and Module layer working together: Global search
• Purpose: 1 Search field queries all columns in a viewObject with wildcards
24
Global search: Pattern
Library Module
Taskflow
taskflowBean
Calls the viewObject by iterator name
ViewObjectImpl
Puts custom viewCriteria on the
ViewObject and query
searchBean
IteratorName
pageSearchPanel
25
Conclusion
• In Oracle ADF you can accomplish reuse in a lot of ways
• Switch from declarative approach to a code approach
• Your application– Will have consistent look and feel– Will take less time to develop– Can be maintained easier