480 likes | 765 Views
OA Framework. Sameer Saxena. Preface. About a Web Based Application. MVC Pattern Mapping to OA Framework Demo Hello World Customer Search LOV OA FWK 5.10.C ( overview ). Design and Development Process. Define JRAD/AOL metadata Create OAController objects
E N D
OA Framework Sameer Saxena
Preface • About a Web Based Application. • MVC Pattern • Mapping to OA Framework • Demo • Hello World • Customer Search • LOV • OA FWK 5.10.C ( overview )
Design and Development Process • Define JRAD/AOL metadata • Create OAController objects • Design and generate BC4J components
Architecture Overview • BC4J - Java business components for representing business logic • AK - Declarative data for UIX • Resides in database • JRAD – Declarative data for UIX • Resides in XML files
Model / View / ControllerDesign Pattern OA Controller AK Repository BC4J XML UIX Beans BC4J Classes JRAD Repository View Model
OA Framework 5.6 /JRAD M2.5 Apps Tools Middle Tier Menu, Flex Fields, User, Responsibility URL=OA.jsp?regionid=myPageRegion OACore AOL/J FND • Create WebBeans • Cache AK Data • Customization Layering • Instantiate AM’s, VO’s, ... • Update VO’s • Handle Events • - ProcessRequest • - ProcessFormData • - ProcessFormRequest • Error Handling JSP Engine AK Web Beans UI Metadata Apache HTML MarlinRenderers BC4J Custom Apps Code • Query Data • Dynamic UI Manipulation • Task specific validation • Error Handling • Page Flow
OA Framework 5.7/ JRAD M3 Apps Tools Middle Tier Menu, Flex Fields, User, Responsibility URL=OA.jsp?regionid=myPageRegion OACore AOL/J FND • Create WebBeans • Cache AK Data • Customization Layering • Instantiate AM’s, VO’s, ... • Update VO’s • Handle Events • - ProcessRequest • - ProcessFormData • - ProcessFormRequest • Error Handling JSP Engine JRAD Web Beans MDS UI Metadata Apache • Caching • Customization • Translations HTML MarlinRenderers BC4J Custom Apps Code • Query Data • Dynamic UI Manipulation • Task specific validation • Error Handling • Page Flow
OA Framework 6.0/ JRAD M4 Apps Tools Middle Tier URL=OA.jsp?regionid=myPageRegion Flex Fields, Responsibility JRAD AOL/J FND • Create WebBeans • Cache AK Data • Customization Layering • Instantiate AM’s, VO’s, ... • Update VO’s • Handle Events • - ProcessRequest • - ProcessFormData • - ProcessFormRequest • Error Handling JSP Engine User, Menus JRAD Web Beans MDS UI Metadata Apache • Caching • Customization • Translations HTML Page HTML MarlinRenderers BC4J Custom Apps Code • Query Data • Dynamic UI Manipulation • Task specific validation • Error Handling • Page Flow
dataflow up stack (pull) dataflow down stack (push) Layered Reusability • Each layer only “knows” about the layers below it. • This allows reuse at any of the layer boundaries. OAControllers Application Modules View Objects Entity Objects DB
Event Flow in OA Framework • Two main events in OAController • processRequest - used for HTTP GET (URL) • processFormRequest - used for HTTP POST (Form Submit) • Form submits (button presses) are directed back to the original OAController • Several other events are available for overriding default Framework behavior
HTTP GET Event Flow – Overview • Get info and validate user • Fetch metadata • Validate Root AM • Instantiate BC4J and UIX objects • Walk UIX tree and call processRequest() on controllers • Perform post processing for complex beans • UIX renders page
HTTP GET Event FlowFetch Metadata • Check cache for metadata • If not available go to JRAD repository • Metadata is fetched through a separate static connection • At customer sites JRAD metadata will be in the database • Working from Jdeveloper you can work against XML files, the database repository, or both • Resolve personalizations against current context
HTTP GET Event FlowValidate Root AM • Instantiate the root BC4J Application Module (AM) • AM associated with page is the root AM – holds the connection • Application Modules are pulled from AM pool if available or may be new objects • AM uses DBC info to create database connection (or reuse existing connection) • Validate session on root AM • Validate function associated with page
HTTP GET Event FlowInstantiate BC4J and UIX Classes • Convert metadata to OA bean hierarchy • OA beans are extensions of UIX beans • Instantiate associated BC4J objects • Place bound values on beans that require binding • Cache bean hierarchy on root AM
Structure of a Web Bean Dictionary Key Value BaseMutableUINode OAStyledTextBean “text” “Hello World” _indexedChildren “style” “OraTipText” _namedChildren _attributes Hello World getAttributeValue setAttributeValue
HTTP GET Event FlowprocessRequest() • Walk UIX tree and instantiate controller classes • Call processRequest() on controllers • Developers can query data for the UI (vo.executeQuery) and set programmatic properties • Perform post-processing on complex beans • OAPageLayoutBean and OATableBean for example • This post-processing can be initiated from processRequest() by calling prepareForRendering() • Places data binding objects on rendering context
Data Binding WebBean OADataBoundValue Dictionary _attributes viewUsage VO1 viewAttr Attr1 RenderingContext getAttributeValue (context, “text”) text VO1 UIX
HTTP Post Event FlowprocessFormData • Walk UIX tree and call processFormData() on controllers • Apply form data back to underlying objects • If a primary key is defined for the object, validate that the data is being applied to the correct object – required for back button support • Throw state error if data is out of synch
Application Module Usage • Root AM per page or multi-page transaction • Release (check in) the AM if going to a new page • retainAM=Y tells Framework to maintain all AMs • ReleaseListener can be associated to the AM for the same purpose • Incorrect use can cause inadvertent resource leaks • Retain AM while displaying the same page • Use OAPageContext.releaseRootApplicationModule to release AM in this case
Development Environment • JDeveloper (currently on NT) A complete Edit-Compile-Deployment IDE tool. • BC4J Wizards • JRAD plugin for metadata • Java and XML code • JRAD previewers • Development time testing with OC4J
JDeveloper Installation • http://incq187sc.idc.oracle.com:9090/admin/OIE/LocalJdeveloperSetUp.htm
Lets try it out…. • Hello World • Customer Search • LOV
FWK 5.10 C • Whats New ? • Advanced Tables • PPR ( Partial Page Refresh ) • State Persistence Model (Passivation) • Personalization
Advanced Tables • Steps to declaratively implement Advance Table Bean :- • To define a table, create a new region and set its Region Style property to advancedTable. • Properties on the new advanced table region : • Width - Set the width of the table in pixels or as a percentage (by including the percent symbol '%' after the value.) If you set the Width to 100%, the Next and Previous links that allow you to navigate among the rows in a table, remain visible above the table, without horizontal scrolling. This is especially useful when you have a wide table that requires horizontal scrolling. • Empty Table Text - Specify alternate text that you want to display if the table is empty. The default is "No data exists". • Banding Type - Specify the type of banding for the table: noBanding, columnBanding, or rowBanding. The default is noBanding. • Banding Interval - If you specify row or column banding, you can specify a number to indicate the banding interval. The default is 1. As an example, if you specify rowBanding and the banding interval is 1, the table displays an alternating gray band across every other row.
Steps to declaratively implement Advance Table Bean :- • In the OA Extension Property Inspector, set the following optional properties on the column containers • Total Value -Set this property to True to enable totalling on this column. • No Wrap - Specify whether the column content can wrap. • Banding Shade - Specify whether column banding should be dark or light in appearance. • Alignment - Specify whether the column content alignment is textFormat (Start), iconButtonFormat (Center), or numberFormat (Right). The default alignment is textFormat. • Grid Displayed - Specify whether the grid line to the left of the column should be displayed. • Width - Specify the width of the column in pixels or percentage.
Steps to declaratively implement Advance Table Bean :- Set the following common properties for all leaf items of a column: View Attribute- Enter the name of the view object attribute that provides data for this column. The attribute should come from the same BC4J view object specified for the advancedTable region. Read Only - Set this property to False if you want the column to be updateable. Prompt - Set this property to display the prompt text for the leaf item if the leaf item is a child of a container region that represents a composite column. If the leaf item is not under a container, then this Prompt property is ignored, because the prompt text in this case is derived from the sortableHeader web bean.
Event Handling • The various table events are: • Navigation - user selects the Next or Previous link to navigate between different ranges of rows. • Sorting - user selects a beveled column heading to sort that column in ascending or descending order. • Insertion of a new row - user selects the Add Another Row button. • Recalculate column Total - user selects the Recalculate button to update the column total. • Detail Disclosure - user selects the Hide or Show link to collapse or expand the detail disclosure region. • Table Control - user selects the Action/Navigation button in the table Control bar.
Event Parameters • SOURCE_PARAM - indicates the source of the event that is generating the current browser request. This maps to the name attribute of the web bean. • EVENT_PARAM - indicates the event generated by a web bean (a table, in this case). The possible events generated by a table are: • GOTO_EVENT - when 'Next' or 'Previous' navigation links are selected • SORT_EVENT - when a column header is selected to sort that column • HIDE_EVENT - when the 'Hide' link of a detail disclosure is selected • SHOW_EVENT - when the 'Show' link of a detail disclosure is selected • ADD_ROWS_EVENT - when the 'Add Another Row' button is selected • UPDATE_EVENT - when the total row 'Recalculate' button is selected
Event Parameters • VALUE_PARAM - indicates a value that is relevant to a particular event: • When a detail disclosure Hide/Show is selected, the value parameter contains the row index corresponding to the row whose Hide/Show was selected. • When the 'Next' or 'Previous' link of table navigation bar is selected, the value parameter contains the index of the first row of the current range. For example, when the row range 1-10 is displayed, the value is 1 and when the row range 11-20 is displayed, the value is 11. • SIZE_PARAM - indicates the number of rows currently displayed in the table (relevant only to the navigation event). • STATE_PARAM - indicates the current sort state (ascending or descending) of the column on which sorting is invoked (relevant only for the sort event).
Example to check for the "Add Rows" event: • If (SOURCE_PARAM.equals(pageContext.getParameter(tableBean.getName())) • && ADD_ROWS_EVENT.equals(pageContext.getParameter(EVENT_PARAM))) • { • // your code comes here • ... • }
Row Headers • To implement a row header, you need only specify a value for the Row Header View Attribute property on the advancedTable region in OA Extension
Column Span • You can use column span when you have a need to display a column that contains "children" columns. A column span is implemented in OA Extension as a columnGroup container. A columnGroup can contain columns and other columnGroups and encapsulates only the column header and column header data for the columnGroup, and not for the columns and columnGroups under it.
Steps to implement the column span :- • Step 1: Select the advanceTable region and choose New > columnGroup from the context menu. Select the sortableHeader for this columnGroup and specify a value for its Prompt property. • Step 2: Select the columnGroup you just created and choose New > columnGroup from the context menu to create the next level of columns that represent the seasons. Select the sortableHeader for this columnGroup and enter the value Fall for its Prompt property (TWICE). Select the sortableHeader for this columnGroup and enter the value Spring for its Prompt property. • Step 3: Select the columnGroup you created for 'Fall' in Step 2 and choose New > column from the context menu. Select the sortableHeader for this column and enter the value Sep for its Prompt property. Repeat for the other two months in the 'Fall' columnGroup. Repeat this entire step to similarly create columns for each month in the 'Spring' columnGroup. • Step 4: Select the advanceTable region and choose New > column from the context menu. Select the sortableHeader for this column and specify a value for its Prompt property. In the figure above, the value for the column without column span is also set to Column Header.
Other New features in 11.5.10.C & 11.5.10.D • Adding Rows (Available in 11.5.10D) • Totalling (Available in 11.5.10D) • Detail Disclosure • Table-in-Table (Available in 11.5.10D) • ( Formatting a Table , Full Table Formatting , Column Formatting , Row Formatting )
FWK 5.10 C • Whats New ? • Advanced Tables • PPR ( Partial Page Refresh ) • State Persistence Model (Passivation) • Personalization
Enhanced Partial Page Refresh (PPR) • Developers can now declaratively enable PPR events for selected components. For example, you can: • Configure the selection of a poplist to cause related fields to render, be updateable, be required or be disabled based on the selected value. • Configure the value change of a text field to set related field values. • Configure the selection of a master table's singleSelection radio button to automatically query and display related rows in a detail table. • The following components support developer-configured PPR events: resetButton, link, singleSelection, messageCheckBox, messageTextInput, messageChoice, button, selectionButton, submitButton
Support for Transaction Undo {5.10C} • The BC4J Transaction Undo feature lets you roll back transaction data cached in middle tier BC4J objects to a given snapshot (similar to the database rollback to savepoint operation). This feature is currently recommended for any use case where you initate a sub-transaction that you want to be able to cancel without affecting the primary transaction. • For example, if you allow a user to create a new item while creating a purchase order, the user probably wants the ability to cancel the item creation without losing all her work to create the purchase order.