How Do I Do This in ADF?!?!

advertisement
Mia Urman
CEO, OraPlayer
Oracle Expert and Oracle Forms Cheerleader
• 14 years supporting, training and consulting Oracle Tools
• 7 years at Oracle as a senior support analyst and local product
manager of Forms and ADF.
• Founder of OraPlayer - Oracle Forms modernization solutions to
unlock Forms systems and fast-track to a Mobile / SOA
architecture / Cloud
• Leader of the ilOUG Oracle Developer Group and speaker at
ODTUG Kscope , OOW, UKOUG etc…
Agenda
What is Framework vs RAD?
Comparing 2 technologies
–What is Forms Architecture
–What is ADF Architecture
What are the ADF building blocks?
–
–
–
–
–
Business Services
ADF Faces
Bindings
ADF TaskFlows
Mobile
Mapping Oracle Forms concepts to ADF
Next Steps …..
• Forms users
• Oracle ERP developers
• Java Developers
• Why are you here?
• What do you want to learn today?
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
Web
Desktop
Database
Web Services
Mobile
Legacy Systems
Office
Applications Unlimited
• JDeveloper is a freeware IDE offers features for
development in Java, XML, SQL and PL/SQL, HTML,
JavaScript, BPEL and PHP.
• JDeveloper covers the full development lifecycle from
design through coding, debugging, optimization and
profiling to deploying.
• Oracle full service java development tool
• Simplifies java development
• Abstracts developers from technology complexities
• Provides end-to-end infrastructure solutions…
SOA
Java
Web 2.0
Metadata Services (MDS)
Desktop
ADF
Swing
Browser-Based
Office
Mobile
JSP
JSF
Struts
ADF Faces
JSF/ADF TaskFlows
EJB
BAM
BPEL
ADFbc
Web
Services
BI
Controller
Model
ADF Bindings (JSR 227)
Java
View
Essbase
Portlets
TopLink
Business
Services
Data
Services
Relational Data
XML Data
Legacy Data
Packaged Apps
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
ADF Business Components (ADF BC) characteristics:
• Provides data interaction & business logic execution
• Maps to a data source
• Enables 4GL development
– Wizard-based or visual development
– Implemented in metadata, not code
• Enables business logic development
– Pre-defined Java methods for events
– Declarative business rules
• Can expose application modules as services
• Based on standard Java and XML
– Works with various application servers or databases
Customer
CustVO
CustomerOrder
AllOrders
Application Module
with View
Object Instances
CustomerEO
OrderEO
OrdVO
View
Objects
and
View
Link
LineItemEO
Entity Objects
and
Associations
Entity
object
>
>
CustomerEO
Validation
rule
Id
Name
Status Status List
Email (Gold Silver Grey)
>
>
Attributes
CUSTOMERS
Database
table
ID
NAME
STATUS
201
202
Steve
Mike
Gold
Silver
Email
msmith@company.com
dgonzales@company.com
1. Map to table
2. Choose/add
attributes
3. Set attribute
properties
• Define default UI
representation
–
–
–
–
Label
Tooltip
Format mask
Control type
1. Add validation
2. Define Validation
3. Set error message
• Define a relationship between EOs
• Facilitate access to data
in related entity objects
• May be based or independent of DB
constraints
• Are used in defining
validations and LOV
• Consist of a source (master)
and a destination (detail) entity
PersonsEO
Source
OrdersPersonsFkAssoc
OrdersEO
Association
Destination
• Represent a query
• Are used for joining, filtering, projecting, and sorting
business data
• Enable you to have a view of data that is specific to
one part of your application
• Can be constructed from a SQL statement, static
values, or populated programmatically
• Can also be based on any number of entity objects
View
objects
Reusable
Query Components
PriorityOrderVO
ItemListVO
CustomerEO
ID
Name
Status
CustomersVO
select name,
status
from customers
order by name
ID
NAME
STATUS
201
202
201
Susan
Mike
Steve
Platinum
Silver
Gold
Database Table
CustomerStatusRO
select status
from customers
Name
Status
Mike
Steve
Susan
Silver
Gold
Platinum
Status
Silver
Gold
Platinum
1. Define type
2. Define data sources
3. Choose attributes
4. Set attribute’s properties for
specific view only
• Contains the model that the client uses to interact with view object
instances
• Control the connection to the database and keep track of all
changes that affect data in the database
• Provide remotely accessible methods to implement application
module behavior
• Are easily reused
OrderAM
PersonsVO1
OrdersVO1 via PersonOrderVL
>
>
>
>
>
>
>
Task Flows
Bounded Task Flow
Task Flow
How to Implement a Master-Detail Screen
Master-detail relationships in Oracle ADF through a view link.
A view link is conceptually similar to a Oracle Forms relation.
• Regular components
– Text items, buttons, check boxes, radio buttons
• List selection components
– Single select, multiple select,
combo box, shuttle
• Data layout components
– Table, tree, tree table
• Choosers
– Choose date, choose color
• Menus
• Others
– Progress bar, bread crumbs …
• 150+ AJAX enabled JavaServer Faces
components
• Drag-and-drop framework
• Dialog and popup framework
• Navigation menu framework
• Partial page rendering
• Advanced data streaming
• Complete JavaScript API
• Skinning
• Accessibility
• Dial: standard and
threshold
• Status Meter:
standard and
threshold
• LED
Web
Mobile
•
•
•
•
•
•
•
•
•
•
•
Database
Web
Services
Oracle
ADF
Mobile
Java
HTML5
Built on Skills
Standards
Use Existing
Set
Use Existing Skills Set
Wizard Based Development
ADF Mobile Components
• Basic Components
• ListView
• Charts
• Gauge
Oracle proprietary and confidential
• T-Maps
• Carousel
• GeoMap
• Forms
Integrated Development Environment








Mapping Oracle Forms
Concepts to ADF
•
Creating application building blocks based on tables – Entity objects
•
Declarative DB access definition – similar to blocks
•
Built-in transaction management lock, commit, data sync
•
Built in events – similar to triggers in Forms
•
Declarative property setting for attribute
•
Non base table (Post-Query) lookups – View item
•
UI labels, tooltips and format masks – Property palette of entity items
•
Validation – Entity item validation
•
List of values
•
Calculated fields – View item calculated field
•
Form/Page navigation – ADF flows
•
UI controls – JSF controls
Oracle Forms
Fusion/Web
Applications
Impact?
• Java applet UI
• HTML/JavaScript
• Different style of UI but you are still working
with “widgets”
• HTML works on page POST
• X,Y layout versus layout containers
• PL/SQL scripting
language
• Java (but still
PL/SQL in the
database)
• Objects v. Procedural is different but basic
statements are similar (if, then else)
• Generally you don’t want dedicated processes
per user
• Stateless pooled
• ADF BC gives you simplicity of stateful but
connections
performance of stateless
• Big advantage on resuse when separate
• No separation of
• Separate UI and
UI and data
• Can’t/shouldn’t be writing business logic
data elements
internals from UI code (and visa versa)
elements
• Fixed means you don’t have to understand the
• Standard and open
internals
• Proprietary and
(override and
• Open means you are not limited by the
fixed framework
augment)
vendor’s implementation
• Stateful
dedicated
connections
http://pub.vitrue.com/X4A3
Forms as a Webservice - OraPlayer
Leverage existing Oracle Forms investment by …
Running Forms as a Service for
Mobile, Cloud and SAAS
Avoiding risky and costly migration/re-development!
How Does it Work?
• Follow additional tutorial for a deeper level of knowledge
– http://www.oracle.com/technology/products/jdev/11/cuecards111/index.
html
– http://www.youtube.com/user/ADFInsiderEssentials
• Read the Fusion Developer Guides – complete free
books online
– http://www.oracle.com/technology/documentation/jdev.html
• Ask questions on the discussion forum
– http://forums.oracle.com/forums/forum.jspa?forumID=83
• Ask us questions  - miaurman@oraplayer.com
>
>
>
ADF Equivalents for Oracle Forms Validation and
Defaulting Triggers
Forms Trigger
WHEN-VALIDATE-RECORD
WHEN-VALIDATE-ITEM
ADF Equivalent
In the custom EntityImpl class for your entity object, write a public method returning a
boolean type with a method name like validateXXXX() and have it return true if the
validation succeeds or false if the validation fails.
WHEN-CREATE-RECORD
WHEN-REMOVE-RECORD
Override the create() method of your entity object
Override the remove() method of your entity object
PRE-QUERY
Override the executeQueryForCollection() method on your view object
ON-COUNT
Override the getQueryHitCount() method in your view object
POST-QUERY
Build a view object that has all the information you need in the query from the main
table, as well as any auxiliary or lookup-value tables or override the
createInstanceFromResultSet() method in your view object class.
ON-LOCK
Override the lock() method in your entity object
POST-LOGON
Execute logic after logging into the
database
Override the afterConnect() method on your custom application module. You can also
override the prepareSession() method, which is fired after initial login, as well as after
any time the application module is accessed by a user that was different from the one
that accessed it last time.
PRE-LOGOUT
Override the beforeDisconnect() method on your application module class.
PRE-COMMIT
PRE-INSERT
ON-INSERT
POST-INSERT
Override the commit() method in a custom DBTransactionImpl class
Override the doDML() method in your entity class, and if the operation equals
DML_INSERT, then write code before calling the super.
PRE-DELETE
ON-DELETE
POST-DELETE
Override the doDML() method in your entity class, and if the operation equals
DML_DELETE, then write code before calling the super.
PRE-UPDATE
ON-UPDATE
POST-UPDATE
Override the doDML() method in your entity class, and if the operation equals
DML_UPDATE, then write code before calling the super.
How to Throw an Error When a
Record Is Locked
Locking rows and throwing an exception if the row is already locked is builtin ADF Business Components functionality
.
•To throw a static message, register a custom message bundle in your ADF
Business Components project to substitute the
default RowAlreadyLockedException's error message with something more
meaningful or user-friendly.
•To throw a message that contains information about the row, override
the lock() method on the entity object, using a try/catch block to catch
the RowAlreadyLocked exception. After you catch the exception, you can
throw an error message that might contain more specific information about
the current row.
How to Get the Sysdate from the
Database
To get the system date from the database, you can use the following
Groovy expression at the entity level:
DBTransaction.currentDbTime
Note:
The DBTransaction reference is for entity-level Groovy
expressions only.
If you want to assign a default value to an attribute using this Groovy
expression, see Section 4.10.7, "How to Define a Default Value Using
a Groovy Expression".
To get the system date from Java, you call
the getCurrentDate() method. For more information,
see Section 8.10, "Accessing the Current Date and Time".
How to Retrieve Lookup Display Values for
Foreign Keys
1. Create a view object that includes the following:
•The main, editable entity object as the primary entity usage
•Secondary "reference" entity usages for the one or more associated entities whose underlying
tables contain the display text
For more information, see Section 5.5.1, "How to Create Joins for Entity-Based View Objects".
2.Select the desired attributes (at least the display text) from the secondary entity usages as
described in Section 5.5.2, "How to Select Additional Attributes from Reference Entity Usages".
At runtime, the data for the main entity and all related lookup display fields is retrieved from the
database in a single join. If the user changes the value of a foreign key attribute, the reference
information is automatically retrieved for the new, related row in the associated table.
Download