Saturday, 17 September 2022

ADF Advanced

 https://www.udemy.com/course/advanced-oracle-adf-12c-course/

Shared Application Module

  • Create custom application with one model
  • Create adf business objects
  • Define Data Source in application Module(under configurations)
  • Generate ADF library jar file 
    • Project properties -> Deployment (make sure it is ADF Library Jar file)
    • Project -> rightclick-> Deploy -> mysharedModel ->  Deploy to ADF Library JAR file 
    • It creates a Jar file
       
  • Add the jar to main ADF application
    • Create new ADF application 
    • ViewController project ->  Library and Classpaths -> Add Jar/Directory -> select the jar from above step -> 
  • Create Datasource
    • localhost:7101/console (weblogic/weblogic1) -> Services -> Data Sources -> create HRds
    • jdbc:oracle:thin:@localhost:1521:xe

Shared LOVs

  • Lovs in separate application and will be shared by all users
  • They are initialized only once which improves the performance
    • Create custom application with one model
    • Create view objects which will be used in LOVs
    • Define data source in AM
    • Create Application Module instance from Project properties
      • Project Properties -> Application Module Instances -> select AM by shuffling to right with cache at Application/session level
    • Generate ADF library jar file 
    • Add jar to main ADF application model project
      • When navigated to attribute LOV of any view Object -> add -> view Usage (instead of view definition)

Cascaded Lovs

  • Create all VOs which will be used as LOVs
  • Create view criteria in all VOs which will be filtered
  • Create LOV over each attribute and pass parameter to criteria
  • set autosubmit & dependencies in the view object attributes
  • set autosubmit & partial triggers on the jsf page

LOVs Switcher

  • Create all VOs which will be used as LOVs
  • Create view criteria in all VOs which will be filtered
  • Create 2 LOV for an attribute and set one of them as default
  • Accessors -> Attach view criteria to the LOVs
  • Create transient attribute which will be used as Switcher
  • Configure the transient attribute getter to return lov name depending on specific condition
  • Set autosubmit & dependencies in view object attributes
  • set auto submit and partial triggers in jsf page  

Method Validations

  • Entity Objects -> Business Rules
  • Right click on Entity Validator or Attribute Validator
  • Select type as "Method" and write error message in Failure Handling Tab
  • Entity Impl -> write code
  • The method should return True or False

Extended View Object

  • Create View object -> extends -> Existing view object
  • It will extend all attributes, LOVs, EO configurations
  • After creating new VO, one can add new attributes &  change where clause
  • No changes can be made to extended attributes

Client Interface Methods

  • Am.java -> create public method
  • AM -> client interface -> shuffle the method
    • ViewObjectImpl deptVO = getDepartmentsView1();
      ViewCriteria vc = deptVO.createViewCriteria();
      ViewCriteriaRow vcr = vc. createViewCriteriaRow();
      vcr.setAttribute("DepartmentId", arg1);
      vc.addRow(vcr);
      deptVO.applyViewCriteria(vc)
      deptVO.executeQuery();
      while (deptVO.hasNext()){
          Row r =
      deptVO.next();
          return r.getAttribute(arg0);
      }
  • viewImpl.java -> create public method
    View -> client interface -> shuffle the method
    Key key =new Key(new Object[] {employeeId});
    Row r = this.findByKey(empKey, 1)[0];
    String fullName = r.getAttribute("FirstName")+ " "+ r.getAttribute("LastName");
    return fullName;

View Object instance map to view

Groovy Expressions
  • Master Detail relation ship- accessing child from master
    • Create accessor
    • Transient Attribute on master -> expression -> accessor.count(attribute)
  • Access parent attribute
    • Transient attribute on Chile -> expression -> accessor.attributeName
  • Within same entity
    • New transient attribute -> expression -> firstName + “ “ + lastName
    • If ((salary !=null) && (comm!=null)) {
    • Salary + comm } else salary;
  • Default values
    • Adf.currentDate
    • Adf.currentDateTime
Bind Variables & overriding methods
  • Groovy expression to refer java class method that returns bind param value
    • <package>.<class>.<method>
  • ViewImpl.jab -> override method prepareRowSetForQuery to set bindVariable prior to super() call
  • Bind Variable in ViewCriteria
    • ViewImpl.java -> custom method -> getViewCriteria-> set bind param value -> apply view criteria -> execute query 
    • Expose the method as client interface OR call from backing bean

Overriding methods

ADF Logger

https://www.youtube.com/watch?v=0ghJ3CUjI_Y

 

  • System.out.println
    • You have to remember to remove it
    • no granularity
    • goes only to one place
    • It is meant for appln user and not for developer/admin
     
  •  thin Wrapper on top of java.util.logging
  • private Static Logger logger = Logger.createADFLogger(<classname>);
    • logger.info("information");  //config/severe/warning/info
  • private static ADFLogger _logger = ADFLogger.createADFLogger(ItemEOImpl.class);
    // in setters
       _logger.info("adf");
    Switch logging ON
       integrated weblogic server -log -> Actions -> configure Oracle Diagnostic Logging -> + Give logger name & logger level
  • run application
  • integrated weblogic server -log -> Actions -> analyze logs -> current in console -> by log message -> filter as needed
  • Logging on ADF core classes
    • https://www.youtube.com/watch?v=0ghJ3CUjI_Y
  • Debugger
  • https://www.youtube.com/watch?v=rV9U1wlLevU
     

 

IDCS: https://www.youtube.com/watch?v=HY1rVixlcPo&t=618s

Diagnostics Logging -> https://www.youtube.com/watch?v=FxA2Fs0zhAM&t=219s

  • It allows seeing ADF Business components methods, arguments, sql queries and so
  • Add diagnostics to Java options
    • -Djbo.debugoutput
    • -Djbo.logging.show.function
    • -Djbo.logging.show.timing
  • Model project -> properties -> Run/Debug/Profile -> edit run configurations ->
  • -Djbo.debugoutput=console -Djbo.logging.show.function=true -Djbo.logging.show.timing=true
  •  To move the logs to file
    Tools ->preferences -> log -> save logs to file

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

Saturday, 18 September 2021

Javascript in ADF

 JavaScript in ADF

  • One of standardway to add Java script to ADF page
    • AF:Document -> Facets -Document -> Meta Container
    • Meta Container -> insert inside -> adf faces -> Resource & and select type as JavaScript
  • Show Alert on some action
    • Create javascript function inside af:resource tag
      • function displayAlert(event){
            alert ("I am from Java Script Function");
        }
    • Call the java script function from adf components(input Text)
      • Insert ClientListner inside any adf faces inputText  
      • Provide the JavaScript function name which is created & select the type(trigger when to invoke the function eg: keyDown, Click..  )
  • Java Script function to Toggle - Collapse pannel splitter 
    • var component = AdfPage.PAGE.findComponent('ps1');
      component.getProperty("collapsed");
      component.setProperty("collapsed",true);
  • Toggle the layout between Horizontal and Vertical
    • Set ClientComponent property of PageGroupLayout element property to True
    •  var component = AdfPage.PAGE.findComponent('pg1');
      component.setProperty("layout","vertical");
  • How to invoke ADF component method defined on button action from JS code
    • var component = AdfPage.PAGE.findComponentbyAbsoluteId('button1');
      AdfActionEvent.queue(component,component.getPartialSubmit());
  • How to open popup in JavaScript
    • var popup = AdfPage.PAGE.findComponentbyAbsoluteId('p1');
      popup.show();
  • Show date popup automatically with out allowing user to enter manually 
    • function disableInputdate(event){
      event.cancel();
      }
    • ClientListner to Call above function on keyPress
    • Execute code once the page/document is loaded. JS script inturn executes method in backing bean
      • AF:Document-> add Client listner -> provide method name "loadPage" and action as Load
        function pageLoad(event){
        var source = event.getSource();
        AdfCustomEvent.queue(source,"callserver",{},false);
        }
      • JS code to access backing bean code
        • AF:Document -> add Server listner -> provide  type "callServer" & method from backing bean
      • loadPage()
        var source = event.getSource();
        AdfCustomerEvent.queue(source,"callServer",{},false);
    • Send Parameter from Client to JS -> backing bean. Show Employee details on double click of dept row
      • Add clientListner & serverListner to the table component
      • clientListner type is dobleclick & method as tableDBClick
      • function tableDBClick(event){
        var source = event.getSource();
        var name = source.getProperty("deptName");
        AdfCustomEvent.queue(source,"calltableserver",{deptName<param>:deptName<value>},false);
        }
      • serverListner type as calltableserver and method as backing method depttabledblclick
      • public voice depttabledblclick(ClientEvent clientEvent){
        string deptName = clientEvent.getParameters.get("deptName");
        showPopup("p2");
        }
      • public void showPopup(String popupname){
          StringBuilder strb = new StringBuilder("AdfPage.PAGE.findComponentbyAbsoluteId(\""+popupname+"\ ").show();");
        FacesContext fctx = FacesContext.getCurrentInstance();
        ExtendedRenderKitService erks = Service.getRenderKitService(fctx,ExtendedRenderKitService.class);
        erks.addScript(fctx,strb.toString());
        }
        }
      • Add clientAttribute to the table component to send parameter to JS method
        <af:clientAttribute name="deptName" value = "#{row.departmentId}">
      •  Backingbean Method

    • User ENTER to navigate to next field
      • function tabIndex(event){
        var code = event.getKeyCode();
        var component = event.getSource();
        if (!e){
        var e= window.event;
        if e.shiftKey{
          if (code==13){
        event.cancel();
        var prevComponent = AdfPage.PAGE.findComponentbyAbsoluteId(component.getProperty("prevComponentId"));
        prevComponenet.focus();
        }}
        else if (code==13){
        event.cancel();
        var nextComponent = AdfPage.PAGE.findComponentbyAbsoluteId(component.getProperty("nextComponentId"));
        nextComponenet.focus();
        }}
    • Compare values in 2 input fields
      • <![CDATA[
        function checkvalue(event){
        var output1 = document.getElementById("it5::content");
        var output2 = document.getElementById("it6::content");
        output1.value == output2.value then.....
        }
        ]]>
    • How to find component id
      • af:Document -> properties -> initial focus id -> point to your document to get the ID

    Wednesday, 18 August 2021

    BPM

     Business Process Management

    • Split the business into number of processes and each process can talk to each other.

    Building blocks

    • Notations
    • Human tasks

    Developing appln

    • Split business into number of processes
    • Design each process using notation
    • Implement each notation
    • Create ADF project for Human Task UI
    • Deploy BPM and ADF projects
    •  

    Activity Notations

    • Service -> to call a webservice
    • Send & Receive-> to call another Bpel process
    • Business Rule -> 
    • Scripts
    • Call -> call another process
    • subprocess
    • update -> automatically update human task

    Interactive Notation

    • User - any human action to be done
    • FYI - human task where to give some information
    • Management
    • Group Vote ->
    • Complex
    • Initiator -> Human task that initiates once user manually initiates 

    Notification Notation

    • Mail

    Catch & Throw Notations

    • Catch exceptions

    Gateway Notations

    • Exclusive - 

    Projects Creation

    • BPMN Process
      • Process Data Objects(Variables that can be used in process

    • Business Components
      • Business Catalog module(App Module)
        • Business Object(Employee Data)
        •  
    •  

    Monday, 26 July 2021

    BI/OTBI/BICC/OBIEE

     How to enable Query logging

    • BI admin tool -> Tools -> Options -> set system logging level between 1 to 7 -> checin the changes
    • Create a simple report 
    • To check the query created
      • Administration -> Manage sessions -> Clear all cursors
    • Refresh the report created in step2 to execute again
    • View log in manage sessions
    • search for "sending query to database" string
    • Copy query and run against DB

    Saturday, 30 January 2021

    UCM

     Unified Content Server

    • Import file into Fusion
    • Export file from Fusion

    File can be imported/exported for an account.

    • fin/payables/import
    • fin/payables/export

    Webservices

    • wsdl: https://<host:port>/idcws/GenericSoapPort?WSDL
      • Eg: https://fuscdrmsmc86-fa-ext.us.oracle.com/idcws/GenericSoapPort?WSDL
    • Convert contents to Base64 encoded format
    •        <ucm:GenericRequest webKey="cs">
               <ucm:Service IdcService="CHECKIN_NEW">
                  <ucm:Document>
                     <ucm:Field name="?">?</ucm:Field>
                     <ucm:File name="context.txt" href="PrimaryFile">
                        <ucm:Contents>cid:119455180306</ucm:Contents>
                     </ucm:File>
                  </ucm:Document>
               </ucm:Service>
            </ucm:GenericRequest>
    •   <ucm:GenericRequest webKey="cs">
               <ucm:Service IdcService="GET_FILE">
                  <ucm:Document>
                     <ucm:Field name="dDocName"><UCM content ID></ucm:Field>
                     <ucm:File name="RevisionSelectionMethod" >Latest</ucm:File>
                  </ucm:Document>
               </ucm:Service>
            </ucm:GenericRequest>
    • Adding Policy
      • Project -> Show Project View -> WS-Security Configurations -> add WSS entry as Username -> provide details
    • Apply policy config to the soap request
    •