Wednesday, 24 August 2022

ADF

ADF
 
  • Application development Framework
  • end-end application framework to build web applications on Java EE standards
  • Own libraries & components with jdeveloper
Jdeveloper
  • IDE tool to develop ADF application
  • database client 
  • version control SVN, GIT
  • embedded weblogic
  • ADF Libraries
  • server connection
  • Windows
    • Structure window
    • properties
ADF Project
  • Model(EJB, Hibernate, ADF BC). This contains any thing related to Database
  • View Controller. This contains any thing related to View layer
    • web.xml
    • faces-config.xml
    • adfc-config.xml
    • trindad-config.xml
MVC Design Pattern
  • Model(EJB, Hibernate, ADF BC)
  • View(UI layer)
  • Controller(navigation rule between pages)
    • View & Controller gets required data from Model
 MVC in ADF
  • Model
    • Entity object - table
    • View Object- Select query
    • Application Module - Gate that controls which data goes to View layer
  • View Controller
    • Data control & Bindings
    • View
  • Page 
Entity Objects
  • Alternate keys
    • Add Business validation of type Unique Key
  • Business Rules
    • Define validations
    • Attribute level
    • Entity Level
  • Attributes
    • UI hints
    • validation rules
View Object
  • Appears in Data control pane
  • Types
    • Entity based
      • Attribute level properties copied to View Object
      • many view objects can be defined on one entity object
      • Tuning
        • All rows
        • only upto X rows
      • View Criteria
        • Filter data of View Object & in AM data Model view object
        • Searchable Page
          • Data control -> view instance -> named criteria -> drag view criteria to page
        • List of values popup
    • SQL based
      • View only page
      • lovs
    • Programmatic
      • Create row at runtime
    • Static List
  • List of Values
    • with just readonly view object
    • with view criteria attached to lov view object
  • Transient Attribute
  • Accessors
    • View objects instances associated to attributes
Application Module
  • View instances & Attach view criteria to instances
  •  Data source definition
  • Runner
Association
  • Link between two entities
    • One can get employee details being in Department view & vice versa
    • View link can be created based on Association
View Link
  • Link between 2 view objects
  •  
Java Code in Model/Entity
  • Accessors, Create, Remove, doDML
  • set value of an attribute on setter of other attribute
    • set autosubmit to true on independent attribute
    • Set partial trigger of dependent attribute to the independent attribute
Java code in View Layers
  • VoRowImpl class
    • Accessors similar to Entity object
    • create & remove (source -> override)
  • VoImpl
    • View level
    • Change where clause of view
      • overide executeQueryForCollection
        • this.setWhereClause("DEPARTMENT_ID=50");  //before super call
Java code in AM
  1. It has all view instances that can be used in View layer
  2. Add methods that can be called in View layer
    • expose the method as client interface
    •  override afterCommit  & afterRollback
      • These will be used for complete application

  3. Add code applicable for complete application
Java code in View Layer
 
  • ADFUtil Class
    • getIterator
    • executeOperation
    • setAttributeinIterator,  getAttributeinIterator
    • get/putInSession
    • showErrorMessage
    • showWarningMessage
    • uploadFile
    • getSqlDescription
    • executeDML
    • getFromSessionScope
  • Scopes in ADF
    • Application, Session, Page Flow, Request, Backbean, view, None
View Controller
  • Page Structure
    • view -> document -> form
    • adf components are prefixed with af
    • 2 pages with just buttons. Navigate to other page
      • adfc-config.xml
        • control flows
Task Flows
  • Unbounded task flow
    • pages & navigation
  • Bounded taskflows
    • page fragments & regions
    • Has entry point
    • With Train
      • train
      • train buttonbar
      • add names to train in taskflow
    • can be called from another bounded task flow
    • security can be applied
    • parameter can be sent from bounded task flow to bounded task flow
    • Can implement transaction flow
    • Bounded task flow can be component in train of another bounded task flow with train
    •  
REST
  • Create Model with AM -> add view to AM
  • AM -> webservice -> REST ->add ->  adf-config.xml -> Release Versions -> add version
  • AM -> webservice -> REST ->add ->  provide resource name & version
  • The above steps will create RESTwebservice project & REST service descriptior xml in model 
  • Run webservice project and test from postman
  • <restURL>/version/resource
  • conditions
    • limit, offset
    • q=departmentName=value or = value2
    • &orderBy=<attribute>
    • (q=departmentId<100) and (q=locationId<100)
    •  like 'asdf*'
  • content-type
    • application/vnd.oracle.adf.resourceitem+json
  • Custom method
    • viewimpl.java ->add a method ->expose as client interface
    • Rest  config file -> custom method -> enable the method
      • there is bug, so add to page,  & copy method action element to rest config file
    • invoking custom method from postman
      • {
        "name": "",
        "parameters": [{"name","value"}]
        }
      • content-type: application/vnd.oracle.adf.action+json
  • Call REST webservice from other ADF Application
    • utility method -> 2 methods for Get & POST using httpconnection for departments
  • Jackson library to convert Json to Java class
    • create Deparments & list<Departments> classes
    • Create jspx page -> af:form properties -> advanced -> binding -> edit -> define bean
    • in backing bean -> create methods to 
      • set and get list<Departments>
      • write method to call webservice & map output to the class using mapper class
      • create table in adf form with required columns.  -> set value property of table & columns to bean-> getDepts method

No comments:

Post a Comment