Monday 21 March 2016

ADF Interview Questions - Set 6

Question: What are the types of Application Authentication available at Run Time in ADF?
Answer: Two types-
1. Implicit: Based on JAAS permissions for anonymous-role role
2. Explicit: Based on security constraint on authentication servlet that you can define by using the Configure ADF Security Wizard

Question: What is ADF BC Model Authorization?
Answer: It prevents unauthorized access to entity objects or its attributes. Enable developers to:
1. Secure access to an entire entity object or only certain attributes
2. Specify the which of the following actions the members of a role can perform on entity objects or attributes.
Entity object - Read, Delete, Update
Attribute of EO - Update

Question: How to grant permissions on resources to Roles? 
Answer: You can associate roles to grants on resources as below:
Groups of pages - Grant access on Bounded task flow in jazn-data.xml
Individual pages - Grant access on Page Definition in jazn-data.xml 
Rows - Grant access on entity objects or attributes in EO security and authorization.

Question: How to secure page with no data?
Answer: You can create an empty page definition file and grant access on Page Definition in jazn-data.xml 

Question: What are the different Identity Store options available in ADF Security Wizard?
Answer: Application XML: 
1. Used for small-scale applications or testing
2. Uses the Oracle Platform Security for Java's file-based repository
3. Configured in JDeveloper—user and role information stored in jazn-data.xml
LDAP:
1. Identity store configured outside of JDeveloper
2. Scalable and secure
3. Integrates with Oracle Single Sign On

Question: What are the different Authentication Type options available in ADF Security Wizard?
Answer: 1. HTTP Basic Authentication: Browser authentication is used; the user name and password are not encrypted. This is useful for testing authentication without the need for a custom login page.
2. HTTP Digest Authentication: Browser authentication is used; the user name and password are encrypted, so it is more secure than basic authentication.
3. HTTPS Client Authentication (Public Key Certificate): This strong authentication mechanism uses a certificate and transmits over SSL.
4. Form-Based Authentication: The developer can specify a login page and a page to display when login fails.

Question: What is the difference between Authentication and Authorization in ADF?
Answer: Authentication determines which users can access the application where as Authorization determines what functions users are allowed to perform after they enter the application.

Question: How can we handle response to the Browser Back Button?
Answer: The task-flow-reentry property can used to determines if user can return to an exited task flow by clicking the
browser’s Back button:
1. reentry-allowed: Reentry is allowed 
2. reentry-not-allowed: User will return to a page within the bounded task flow but an exception will be thrown on performing any action like button click.
3. reentry-outcome-dependent: Depends on outcome when same ADF bounded task flow was previously exited.

Question: How can we handle exception in ADF?
Answer: By designating an Exception Handler Activity. The exception handler activity can be any supported activity type like a view or router.
Steps - Right-click the activity in the task flow diagram, then choose Mark Activity > Exception Handler.
When you designate that an activity is the exception handling activity for a task flow, the task flow metadata updates with an <exception-handler> element that specifies the ID of the activity

Question: What are the different data control scopes available in ADF Taskflow?
Answer: Shared and Isolated

Question: What are the different Transaction Start Options available in ADF Taskflow?
Answer: Transaction start options on the called task flow definition specify whether a called ADF bounded task flow should -
1. new-transaction - Create a new transaction
2. requires-existing-transaction - Join an existing transaction
3. requires-transaction - Create a new one only if there is no existing transaction


Project Accounting - Check funds queries at Task, Top Task and Project Level

FOR TASK

  SELECT project_id,
    (SUM(budget) - SUM(actuals)) "funds"
  FROM PA_TASK_FC_RESULTS_V
  WHERE project_id     =<p_project_id>
  AND start_date       > '31-MAR-15'
  AND end_date         < '1-APR-16'
  AND budget_version_id=
    (SELECT MAX(budget_version_id)
    FROM PA_TASK_FC_RESULTS_V
    WHERE project_id=<p_project_id>
    )
  and TASK_ID=<P_TASK_ID>
  GROUP BY project_id;
  
FOR TOP TASK 

  SELECT project_id,
    (SUM(budget) - SUM(actuals)) "funds"
  FROM PA_TOP_TASK_FC_RESULTS_V
  WHERE project_id     =<p_project_id>
  AND start_date       > '31-MAR-15'
  AND end_date         < '1-APR-16'
  AND budget_version_id=
    (SELECT MAX(budget_version_id)
    FROM PA_TOP_TASK_FC_RESULTS_V
    WHERE project_id=<p_project_id>
    )
  and TOP_TASK_ID=<P_TOP_TASK_ID>
  GROUP BY project_id;
  
FOR PROJECT 

  SELECT project_id,
    (SUM(budget) - SUM(actuals)) "funds"
  FROM PA_PRJ_FC_RESULTS_V
  WHERE project_id     =<p_project_id>
  AND start_date       > '31-MAR-15'
  AND end_date         < '1-APR-16'
  AND budget_version_id=
    (SELECT MAX(budget_version_id)
    FROM PA_PRJ_FC_RESULTS_V
    WHERE project_id=<p_project_id>
    )
  GROUP BY PROJECT_ID;

Blocking Outlook Calendar through PLSQL Code

-- Following code can be used for blocking the calendar of the recipients through email 
-- sent using PLSQL Code.
-- Create the following function

CREATE OR REPLACE FUNCTION ical_event (
   p_summary         IN VARCHAR2
 , p_organizer_name  IN VARCHAR2
 , p_organizer_email IN VARCHAR2
 , p_start_date      IN DATE
 , p_end_date        IN DATE
 , p_version         IN VARCHAR2 := NULL
 , p_prodid          IN VARCHAR2 := NULL
 , p_calscale        IN VARCHAR2 := NULL
 , p_method          IN VARCHAR2 := NULL
)
   RETURN VARCHAR2 

AS  

   l_retval VARCHAR2(32767);
   l_lf     CHAR(1) := CHR(10);

BEGIN

   l_retval := ''
      || 'BEGIN:VCALENDAR' || l_lf
      || 'VERSION:' || NVL(p_version,'2.0') || l_lf
      || 'PRODID:' || NVL(p_prodid,'-//Your company name//NONSGML ICAL_EVENT//EN') || l_lf
      || 'CALSCALE:' || NVL(p_calscale,'GREGORIAN') || l_lf
      || 'METHOD:' || NVL(p_method,'REQUEST') || l_lf
      || 'BEGIN:VEVENT' || l_lf
      || 'SUMMARY:' || p_summary || l_lf
      || 'ORGANIZER;CN="' || p_organizer_name || '":MAILTO:' || p_organizer_email || l_lf
      || 'DTSTART:' || TO_CHAR(p_start_date,'YYYYMMDD') || 'T' || TO_CHAR(p_start_date,'HH24MISS') || l_lf
      || 'DTEND:' || TO_CHAR(p_end_date,'YYYYMMDD') || 'T' || TO_CHAR(p_end_date,'HH24MISS') || l_lf
      || 'DTSTAMP:' || TO_CHAR(SYSDATE,'YYYYMMDD') || 'T' || TO_CHAR(SYSDATE,'HH24MISS') || l_lf
      || 'UID:' || RAWTOHEX(SYS_GUID()) || '@yoururl.com' || l_lf
      || 'STATUS:NEEDS-ACTION' ||  l_lf
      || 'END:VEVENT' || l_lf
      || 'END:VCALENDAR';
   
   RETURN l_retval;
      
END ical_event;


--Create the following procedure (replace "yoururl" as needed): 

CREATE OR REPLACE PROCEDURE send_ical_email (
   p_from      IN VARCHAR2
 , p_to        IN VARCHAR2
 , p_subj      IN VARCHAR2
 , p_body_html IN VARCHAR2
 , p_body_ical IN VARCHAR2
)

AS

   l_connection UTL_SMTP.CONNECTION;
   l_mail_serv  VARCHAR2(50) := 'mail.yoururl.com';
   l_mail_port  PLS_INTEGER := '25';
   l_lf         CHAR(1) := CHR(10);
   l_msg_body   VARCHAR2(32767);

BEGIN
   
   l_msg_body :=
         'Content-class: urn:content-classes:calendarmessage' || l_lf
      || 'MIME-Version: 1.0' || l_lf
      || 'Content-Type: multipart/alternative;' || l_lf
      || ' boundary="----_=_NextPart"' || l_lf
      || 'Subject: ' || p_subj || l_lf 
      || 'Date: ' || TO_CHAR(SYSDATE,'DAY, DD-MON-RR HH24:MI') || l_lf
      || 'From: <' || p_from || '> ' || l_lf 
      || 'To: ' || p_to || l_lf 
      || '------_=_NextPart' || l_lf
      || 'Content-Type: text/plain;' || l_lf
      || ' charset="iso-8859-1"' || l_lf
      || 'Content-Transfer-Encoding: quoted-printable' || l_lf
      || l_lf
      || 'You must have an HTML enabled client to view this message.' || l_lf
      || l_lf
      || '------_=_NextPart' || l_lf
      || 'Content-Type: text/html;' || l_lf
      || ' charset="iso-8859-1"' || l_lf
      || 'Content-Transfer-Encoding: quoted-printable' || l_lf
      || l_lf
      || p_body_html || l_lf
      || l_lf
      || '------_=_NextPart' || l_lf
      || 'Content-class: urn:content-classes:calendarmessage' || l_lf
      || 'Content-Type: text/calendar;' || l_lf
      || '  method=REQUEST;' || l_lf
      || '  name="meeting.ics"' || l_lf
      || 'Content-Transfer-Encoding: 8bit' || l_lf
      || l_lf
      || p_body_ical || l_lf
      || l_lf
      || '------_=_NextPart--';
            
   l_connection := utl_smtp.open_connection(l_mail_serv, l_mail_port);
   utl_smtp.helo(l_connection, l_mail_serv);
   utl_smtp.mail(l_connection, p_from);
   utl_smtp.rcpt(l_connection, p_to);
   utl_smtp.data(l_connection, l_msg_body);
   utl_smtp.quit(l_connection);
   
END send_ical_email;

-- Create a page process similar to the following that fires 
-- when the submit button is pressed (this will vary depending on step 3): 

DECLARE

   l_ical_event VARCHAR2(32767);

BEGIN

   l_ical_event := ical_event(
      p_start_date      => TO_DATE(:PXX_START_DATE || :PXX_START_TIME,'DD-MON-YYYYHH:MIPM')
    , p_end_date        => TO_DATE(:PXX_END_DATE || :PXX_END_TIME,'DD-MON-YYYYHH:MIPM')
    , p_summary         => :PXX_SUBJ
    , p_organizer_name  => :PXX_USER_NAME
    , p_organizer_email => :PXX_USER_EMAIL
   );

   send_ical_email( 
      p_to        => :PXX_TO_ADDRESS
    , p_from      => :PXX_USER_EMAIL
    , p_subj      => :PXX_SUBJ
    , p_body_html => :PXX_BODY_HTML 
    , p_body_ical => l_ical_event
   );
   
END;

That should do it. Submit the page to send the request. 

Tuesday 8 March 2016

OAF - Redirecting to a sub tab

Redirecting to a sub tab in OAF page by passing the SubTab id in hashmap:

HashMap hashmap = new HashMap(2); hashmap.put("porMode", "display"); 

hashmap.put("OA_SubTabIdx", 1); 

pageContext.forwardImmediately("ICX_POR_CHECKOUT_LINES", (byte)0, null, hashmap, true, null); 

OAF - How to Display multiple errors?

Sometimes you have to show all the error messages at one shot,instead of showing the error messages one by one. In that case, we have to use bundled exception to show multiple error message. Below are the steps:

1. Add the import statements:

import com.sun.java.util.collections.ArrayList;
import oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.common.MessageToken;

2. Declare an array list.

ArrayList errorMsg= new ArrayList();
3. Raise OAException.
for (int i=0; i< hMember.size(); i++)
{
MessageToken[] token = {
new MessageToken("USER", getOADBTransaction().getUserName()),
new MessageToken("NUM",hMember.getChildNumber())
};
errorMsg.add(new OAException((String)(getOADBTransaction().getMessage("XXCH","XXCH_NO_ACCESS",token))));
}
OAException.raiseBundledOAException(errorMsg);

OAF - Dynamically assigning VO and VO attributes

Below code sample search the component on a page. Replaces the default VO with new/custom VO. Then maps the VO attribute to the identified component.

OAMessageStyledTextBean oamessagestyledtextbean = (OAMessageStyledTextBean)oawebbean.findIndexedChildRecursive("ProjectNum");

oamessagestyledtextbean.setViewUsageName("VOInstanceName");

oaformvaluebean4.setViewAttributeName("XXProjectNum");

OAF - Copying or Duplicating a records within a VO

Below code copies the row from AssignEOVO with primary id as AssignId and EmpId and creates a new record as duplicate: 

try
{
AssignEOVOImpl VO1 = (AssignEOVOImpl)getAssignEOVO1();  
VO1.initQuery(AssignId,EmpId);   //Query the record which needs to be duplicated.
Row[] currentRow = VO1.getFilteredRows("AssignId", AssignId); //Get Queried records in a Array of Row
//System.out.println("currentRow.length" + currentRow.length);
AssignEOVORowImpl copyRow = (AssignEOVORowImpl)currentRow[0];
//System.out.println("copyRow.getEmpId" + copyRow.getEmpId());
//System.out.println("copyRow.getEmpNumber()" + copyRow.getEmpNumber());
AssignEOVOImpl VO= getAssignEOVO1();            
if(!VO.isPreparedForExecution()) 
{
VO.executeQuery();
}            
AssignEOVORowImpl row = (AssignEOVORowImpl)VO.createRow();
VO.insertRow(row);
row.setEmpId(copyRow.getEmpId());
row.setEmpNumber(copyRow.getEmpNumber());
}catch(Exception jbo)
{  
throw new OAException("Exception.." + jbo,OAException.ERROR);
}

Sunday 6 March 2016

ADF Interview Questions - Set 5

Question: How to identify default activity in bounded task flow?
Answer: A green circle identifies the default activity in a task flow diagram.The first activity that you add to a new ADF bounded task flow diagram is automatically identified as the default activity. You can also right-click any activity in the task flow diagram and choose Mark Activity > Default Activity. The default can be any activity type and it can be located anywhere in the control flow of the ADF bounded task flow. To find the default activity, right-click anywhere on the task flow diagram and choose Go to Default Activity.

Question: What is <f:facet>?
Answer: This tag is used to add a child facet to the parent component. With the help of this tag we can add header and footer facet to the container component like panelGroup. This tag contains one attribute "name". This is the required attribute and is used to set the name of the facet. "header" and "footer" values can be used for this attribute.

Question: How to pass 'af:selectOneChoice' value to other page?
Answer: Add valuePassThru="true" attribute to select list. 

Question: What are types of ADF Faces components?
Answer: ADF Faces components:
Data components
Input components
Layout components
Navigational components
Output components

Question: What is Bundled Exception Mode in ADF?
Answer: An application module provides a feature called bundled exception mode which allows web applications to easily present a maximal set of failed validation exceptions to the end user, instead of presenting only the first error that gets raised. By default, the ADF Business Components application module pool enables bundled exception mode for web applications.

You typically will not need to change this default setting. However it is important to understand that it is enabled by default since it effects how validation exceptions are thrown. Since the Java language and runtime only support throwing a single exception object, the way that bundled validation exceptions are implemented is by wrapping a set of exceptions as details of a new "parent" exception that contains them. For example, if multiple attributes in a single entity object fail attribute-level validation, then these multipleValidationException objects will be wrapped in a RowValException. This wrapping exception contains the row key of the row that has failed validation. At transaction commit time, if multiple rows do not successfully pass the validation performed during commit, then all of the RowValException objects will get wrapped in an enclosing TxnValException object.

Question: What are UI Hints and List UI Hints?
Answer: UI Hints: VO -> Query -> Create or Edit view criteria -> click Tab UI Hints
Use to specify the default properties for a query search component’s runtime usage of individual named view criteria. Named view criteria that you create for view object collections can be used by the web page designer to create query-by-example search forms.



List UI Hints: Open view-object -> List UI Hints

Use to specify default LOV (list of values) hints when you want the LOV-enabled attributes of other view objects to inherit the list UI hints from the current view object. Use to specify the type of LOV (list of values) component and one or more attributes to display in the LOV for the attributes that you will LOV-enabled. Additionally, you can set properties of the LOV component to customize it behavior in the user interface.






ADF Interview Questions - Set 4

Question: Can you make View Link bidirectional?
Answer: Yes, you can make a view link bidirectional. It’s handled by view link query.
View Links created on Association are also bidirectional.

Question: How to create read only VO?
Answer: While creating View select option "Read-only access through SQL query". Also view is read-only if it does not have Primary Keys or if all its entity references are reference-only.

Question: Explain Data Control Palette hierarchy.
Answer: The Data Control Palette displays two types of actions/operations:
1. Actions that typically operate on all data collections in the current web page's binding context (such as Commit and Rollback) in the Operations folder at the root level of the hierarchy.
2. Operations on a specific data collection (for example, MyView1). Data collection-specific operations (such as Create and Delete) appear in the Operations folder as child nodes of the collection in the Data Control Palette.

Question: How many types of VOs we can create in Oracle ADF?
Answer: There are four types of VOs we can create as shown in below image, select radio button & create VO.
1. Updatable VO (Updatable access through entity objects) - Here EO need to be created for updatable VOs.
2. Read only VO (Read-only access through SQl query) - No need to create EO, VOs can be created using SQL queries, table, or views.
3. Rows populated programmatically, not based on query - This is also read-only view. Here add one or more attributes to use in program. In the Attribute Settings page, adjust any setting you may need to for the attributes you defined.
4. Static VO (Rows populated at design time- Static List): You use the Create View Object wizard to create static view objects. The wizard lets you define the desired attributes (columns) and enter as many rows of data as necessary. The wizard displays the static data table as you create it. Attributes can be added from a comma-separated value (CSV) file as well.

Question: Can we change DB connection for any particular AM?
Answer: Steps to change DB connection: 
1. Double click on AM.
2. Go to the configuration tab, click on configuration file bc4j.xml
3. Here we have attribute JDBCName under element AppModuleConfig, change the connection which is created for other DB.

Question: What is Managed Bean?
Answer: Managed bean is a java class, which is initialized by JSF framework. It is primarily used to hold view and controller logic. It is also used to execute java code to be executed on a user action like Button Click.
Managed bean describes how the bean is created and initialized. As you know, jsf uses the lazy initialization model. It means that the bean in the particular scope is created and initialized not at the moment when the scope is started, but on-demand, i.e. when the bean is first time required.

Question: What are Backing Bean?
Answer: Backing beans are those managed beans which have 1:1 mapping with a page. They defines a set of methods that perform functions for the component, such as getters and setters, validating the component’s data, handling events that the component fires and performing processing associated with navigation when the component activates.

Question: What is difference between managed and backing beans?
Answer: Backing bean has 1:1 relation with page whereas managed beans can be used in multiple pages.
Backing beans scope is limited to the page whereas managed beans can have other scopes too.

Question: How can you define custom component?
Answer: There is multiple way of creating the custom component
1. Declarative: Using this way you can create jspx page with adf components and provide property and methods which you want to expose to client.
2. Extending Component: You can extend your existing component to define custom component.

Question: Can Service Methods return type Void?
Answer: Yes, Service Methods can Return type Void

Question: What is the return type of Service Methods?
Answer: Service Methods can return Scalar or Primitive Data types.

Question: Can Service Methods return Complex Data types?
Answer: No, service methods can return only primitive/scalar data types.

Question: What is the Business Component Tester? 
Answer: The mostly used component of the model layer is the tester, which is used to run and check the data model that is implemented. This serves as the first line of defense to see if data is exposed as we need it and to test the data model without a need to create a UI.

Question: What is Association Accessor? 
Answer: It’s an operation by which an entity instance at one end of an association can access the related entity object instance at the other end of the association. An Accessor that travels from destination to source is called a source accessor and an accessor that travel from source to destination is called a destination accessor. It is described in the entity object definition xml files which can be used by view object and view link definition to specify cross entity relationship. Its return type will be the entity object class of associated entity object definition or ‘EntityImpl’ if the associated entity object definition has no entity object class.

Question: What are the various access scopes supported by ADF?
Answer: ADF Faces supports the following scopes:
1. Application Scope
2. Session Scope
3. PageFlow Scope
4. Request Scope
5. BackingBean Scope.

Question: What are the security application layers & how they handled in Oracle ADF?

ADF Code Example - Set 1

Question: Committing through java code in your managed bean.
Answer: 
DCBindingContainer bindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
 OperationBinding operationBinding = bindings.getOperationBinding(“Commit”);
 operationBinding.execute();

Question: Rollback transaction through java code in your managed bean.
Answer: 
DCBindingContainer bindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
 OperationBinding operationBinding = bindings.getOperationBinding(“Rollback”);
 operationBinding.execute();

Pay attention to the operation binding names, if you have CRUD operations from different application modules within the same page, those names will differ (generally: Commit1, Rollback1 etc)

Question: Calling a VO from another VO or AM.
Answer: 
//in you Application module Impl or VOImpl file have the follwing code written inside the //method which will set the value for another vo. Lets say UploadView is the View object that //you would want to set the value

ViewObject vo = findViewObject("tUploadView");

//if its not in Application Module, you will have to get the VO instance either from iterator if //you are using this code in the bean get the rowset of UploadView

RowSet rs = vo.getRowSet();
while(rs.hasNext()){    //iterate through
Row r = rs.next();       //get the row
r.setAttribute("ValueItem", value);  //set the value..
//ValueItem is the Attribute that you want to set
}
}

Question: Write  code to access the current row and/or the view object inside your bean?
Answer: Code to access the current row and or the view object inside your bean:

BindingContainer bc = BindingContext.getCurrent().getCurrentBindingsEntry();
DCBindingContainer dcbc = (DCBindingContainer) bc;
DCIteratorBinding lBinding = dcbc.findIteratorBinding("EmployeesViewIterator");
EmployeesViewRow row = (EmployeesViewRow) lBinding.getCurrentRow();
EmployeesView view = (EmployeesView) lBinding.getViewObject();

Question:How to declare the page navigation (navigation rules) in faces-config.xml file in ADF 10g?
Answer: Navigation rules tells JSF implementation which page to send back to the browser after a form has been submitted. We can declare the page navigation as follows:

<naviagation-rule>
<from-view-id>/index.jsp</from-view-id>
<navigation-case>
<from-outcome>login</from-outcome>
<to-view-id>/welcome.jsp</to-view-id>
</navigation-case>
</naviagation-rule>

This declaration states that the login action navigates to /welcome.jsp, if it occurred inside /index.jsp.

Question: Why 'timeZone' attribute is required when <af:convertDateTime> is used?
Answer: When <af:convertDateTime> is used it takes by default GMT time, for Indian timing we need to take GMT+5.30

<af:inputText id="compId3882"
label="#{messageBean['SS_DATE_OF_BIRTH']}"
disabled="true" maximumLength="50"
value="#{bindings.DateofBirth.inputValue}"
inlineStyle="font-size:smaller; font-weight:normal; font-family:Arial;color:rgb(69,69,69);">
   <af:convertDateTime timeZone="GMT+5:30" pattern="dd/MM/yyyy"/>

 </af:inputText>

Question: How to set the range of table?
Answer: <af:table rows=”#{bindings.LoggedInUserServiceRequests.rangeSize}”…/>

Question: How to Use the pageFlowScope Scope Within Java Code?
Answer: You can access pageFlow scope from within any Java code in your application. Remember to clear the scope once you are finished. To use pageFlowScope in Java code:
1. To get a reference to the pageFlowScope scope, use following method:
org.apache.myfaces.trinidad.context.RequestContext.getPageFlowScope();
2. For example, to retrieve an object from the pageFlowScope scope, you might use the following Java code:
import java.util.Map;
import org.apache.myfaces.trinidad.context.RequestContext;
3. Inside Java Method, write code below :
Map pageFlowScope = RequestContext.getCurrentInstance().getPageFlowScope();
Object myObject = pageFlowScope.get("myObjectName");
4. To clear the pageFlowScope scope, access it and then manually clear it. For example, you might use the following Java code to clear the scope:
RequestContext afContext = RequestContext.getCurrentInstance();
afContext.getPageFlowScope().clear();


Note: If your application uses ADF Controller, then you do not have to manually clear the scope.

Saturday 5 March 2016

ADF Interview Questions - Scenario 1

Scenario: Lets say i have 2 tables bound to 2 Different VOs[EO Based] which allow editing of data. After Editing of the data on both the tables , i call commit on the Data control Frame.
Now my understanding of AM is that it's a unit of work which is a collective representation of a functionality [let's say , Create PO].
So can there be a scenario that while processing commit , changes performed on one EO gets committed to the Database and the second EO threw some error , so the changes for second EO didn't go thru .
Or this scenario itself is hypothetical and if any of the VOs associated with AM threw error while committing data [not validating], rest of the committed data will also be deleted by framework .
Kindly explain or point to a resource on how multiple VOs would be handled by AM while committing .
Solution: A single AM contains the EO caches for changed rows. Strictly speaking, tables are not bound to VOs they are bound to EOs. VOs do not commit work. VOs describe the shape of the data and the query required for retrieving the data, which is then cached in the EO cache. Basically, if one commits an AM, all "dirty" EOs are validated and if they pass validation, are committed. If any rollback, they all rollback. This behavior can be changed by, for example, having separate AMs.

ADF Interview Questions - Set 3

Question: What is the difference between visible property and render property?
Answer: The visible property is set to true/false based on the requirement whether we want to see the field on the page or not at run time. The field or component still exists on the page, though hidden. The render property is used to conditionally load the component based on a criteria.

Question: How do you define pagination in ADF?
Answer: We define custom pagination in ADF by creating a custom table as a taskflow using the af:iterator tag. This renders the collection of data just as a table renders it. Now we bind the value property of iterator to collection model from ADF bindings declaration and set the number of visible row to, say 15.

Question: What are validators and converters?
Answer: Validators and Convertors are used to provide conversion and validation capabilities to the ADF input components respectively.Converters convert the values on ADF forms to the type in which the application accepts them after the values are edited on the form and submitted. Validators are used to impose validations on the input components.

Question: What is the difference between setting an immediate=true on a button and immediate=true on a text field? 
Answer: When immediate is true on a button, the command’s action and ActionListeners, including the default ActionListener provided by the JavaServer Faces implementation, will be executed during Apply Request Values phase of the request processing lifecycle, rather than waiting until the Invoke Application phase. Life Cycle for Immediate="true" on command component is
        Restore View->Apply Request Values->Render Response 

In case of a text field, by default, values are converted and validated together in the Process Validators phase. However, if you need access to the value of a component during Apply Request Values – for example, if you need to get the value from an actionListener on an immediate commandButton – then setting this to "immediate" makes that possible. Life Cycle for Immediate="true" on input component is

 Restore View->Apply Request Values->Process Validations->Update Model->Invoke App->Render Response 

Question: What are the different types of bindings in ADF?
Answer: ADF contains the following types of bindings:
1. Attribute Bindings: This is the binding to retrieve the value of a single view attribute in the iterator binding’s current view row. For eg; #{bindings.CustomerId.InputValue}
2. Tree Bindings: This is used for tables, tree-tables and trees. It is used to expose rows of a table in the iterator binding’s current range. Eg; All Customers-#{bindings.AllCustomers.labels.CustomerId}.
3. Action Bindings: This binding type is used when buttons or command links are dropped on the user interface and require an action to be performed on them. We can use data control operations on them, for eg, Create, Delete, First, Last, Commit, Rollback etc.
4. Method Bindings: This binding is used when you want to use custom methods to be executed.
5. Iterator Binding: This binding is created by the application to access the ADF binding context. It contains a reference to the page bound data collection, helps access it and iterates over its data objects.

Question: What is the difference between an action and an action listener?
Answer: Actions are designed for business logic and participate in navigation handling, whereas Action listeners typically perform user interface logic and do not participate in navigation handling.

Basically the "action" attribute refers to an action method which returns a String from which the Faces navigation model can use to decide whether or not a navigation is necessary based on the value of the string.

An actionlistener method compared to an action method does not return a String. Instead it returns void. It is basically identical to the action method but instead it just executes the code after an action event (button click or link click) but a navigation is not needed. Action listener is a class that wants to be notified when a command component fires an action event. An action listener contains an action listener method that processes the action event object passed to it by the command component.

Question: What is setActionListener?

Answer: The setActionListener tag is a declarative way to allow an action source to set a value before navigation. It is perhaps most useful in conjunction with the “processScope” EL scope provided in ADF Faces, as it makes it possible to pass details from one page to another without writing any Java code. This tag can be used both with ADF Faces commands and JSF standard tags.

Question: What is the difference between JSP-EL and JSF-EL?
Answer: JSP-EL
In JSP-EL the value expressions are delimited by ${…}.
The ${…} delimiter denotes the immediate evaluation of the expressions, at the time that the application server processes the page.
JSF-EL
In JSf-EL the value expressions are delimited by #{…}.
The #{…} delimiter denotes deferred evaluation. With deferred evaluation ,the application server retains the expression and evaluates it whenever a value is needed.

Question: What are Contextual events?
Answer: Contextual event is a way to communicate between taskflows. Sometimes we have taskflow open in a region and have to get some values from that taskflow. This scenario can be achieved by contextual event.
Contextual Event have two parts-
Publisher Event (Producer)- As button or any component that can raise event 
Handler Event (Customer)- that listens and process event published by producer

Question: What is inter-portlet communication?
Answer: Inter-portlet communication is achieved when an action in one portlet triggers a response in the second portlet. Its a communication bridge between two portlets. For eg, one portlet contains a checkbox containing list of products. When I choose a product from the list and click on submit, the other portlet displays the details of the respective product.

Question: What is meta data commit during life cycle phase of ADF?

Answer: The metadata changes are written to the MDS repository after the JSF Invoke Application phase in JSF life cycle.

ADF Interview Questions - Set 2

Question: What is PPR and how do you enable Partial Page Rendering(PPR)?
Answer: PPR is a feature supported by ADF Faces, using which we can render a small portion of a HTML Page, without refreshing the complete page. It is enabled by:
1. Setting AutoSubmit property to true on the triggering element.
2. Setting the PartialTriggers property of target component to refer to component id of the triggering element.

Question: In which xml do you configure the skin for your framework application?
Answer: In trinidad-config.xml file

Question: What is the purpose of jazn-data.xml?
Answer: This file is used for defining the permissions and privileges for various groups of users on various taskflows created in the application.

Question: What is policy store and identity store in OID?
Answer: Identity Store is used to store information about users and groups while the Policy Store is used to store information about security policies.

Question: What is the difference between databindings.cpx and datacontrol.dcx?
Answer: The DataBindings.cpx file contains the Oracle ADF binding context for your entire application and provides the metadata from which the Oracle ADF binding objects are created at runtime. The DataControls.dcx file is created when you register data controls on the business services. This file is not generated for Oracle ADF Business Components. It identifies the Oracle ADF model layer data control classes(factory classes) that facilitate the interaction between the client and the available business service.

Question: What is binding context and binding container?
Answer: Binding context is a runtime map between the data controls and page definition of pages in the application which is used to access the binding layer. It is accessible through the EL expression in your jspx pages. Binding container is a request-scoped map that is used to instantiate the page bindings. This is accessible through the EL expressions. Also, since it is request-scoped map, it is accessible during every page request.

Question: In case of java control or EJB, does it have a datacontrol.dcx file? 

Answer: datacontrols.dcx exists when you create custom data controls based on POJOs, web services, EJBs and the like. It describes or stores the metadata about the data control, essentially the wiring required to make the underlying service (e.g. POJOs, web services) exposed through the data control palette, and the runtime settings so the ViewController layer knows how to make use of it.

Question: What is the difference between trinidad.config and trinidad.skins?
Answer: trinidad.config file is created when you create a webcenter portal application. This is used to register the skin-family you are going to use for your entire application. Trinidad.skins is used when we use skin as a Jar file. This file provides a mapping between the Skin Id and the actual path where the skin exists.

Question: How do you decide whether the application should be deployed as an EAR or a WAR?
Answer: If the application contains run-time customizations using MDS, it must be bundles as an EAR. For simple webcenter portal application with no such customizations, WAR can be created.

Question: What is Top Link?
Answer: Top Link is an Object-Relational Mapping layer that provides a map between the Java objects that the model uses and the database that is the source of their data. By default, a session is created named default. In the following steps, you create a new session.

Question: Describe life cycle of an ADF Page?
Answer: ADF page is an extension of JSF and has following phases in its lifecycle:
1.       Initialize Context: In this phase the ADF page initializes the Lifecycle Context with information that will be used during the Lifecycle.
2.       Prepare Model:  In this phase UI model is prepared and initialized. In this phase page parameters are set and methods in the executable section of the page definition of the ADF page are executed.
3.       Apply Input Values: This phase handles the request parameters. The values from the HTML are sent to the server and applied to the page binding in page definitions.
4.       Validate Input Values:  This phase validates the values that were built in the Apply input values phase
5.       Update Model:  Validated values supplied from user are sent to ADF business components data model
6.       Validate Model Updates:  In this phase the business components will validate user supplied values.
7.       Invoke Application:  This phase will process the UI events stack built during the life cycle of page and also fire navigational events
8.       Prepare Render:  This is the final phase where HTML code is generated from the view tree.

Question: What are the different kinds of Bean Scopes in JSF?
Answer: JSF supports three Bean Scopes:
1. Request Scope: The request scope is short-lived. It starts when an HTTP request is submitted and ends when the response is sent back to the client.
2. Session Scope: The session scope persists from the time that a session is established until session termination.
3. Application Scope: The application scope persists for the entire duration of the web application. This scope is shared among all the requests and sessions.

Question: Explain type of Scopes in Fusion Web Applications?
Answer: There are seven types of scopes in a Fusion web application: Scopes listed below in descending order with first one having longest life time and last one lowest life time.

Application scope -> Session scope ->Page flow scope -> View scope ->Request scope ->Backing bean scope

1. Application scope: An application scope object is available for the duration of the application and is shared among users. This scope may be used to hold static objects that are the same for all users.
2. Session scope: The object is available for the duration of the session, which is user instance-specific. A use case for a session scope bean is a user info bean that stores information about a user, which is read from the database or an LDAP server, to avoid unnecessary queries.
3. Page flow scope (Task flow scope): A pageFlow scope exists for each task flow instance and has a lifespan between request and session scope. The lifetime of the scope spans across all pages in a bounded task flow.
4. Request scope: The object is available from the time an HTTP request is made until a response is sent back to the client. From another perspective, a request scope starts with a request to be issued from one view to another for navigation cases that don't perform a redirect but a default server-side forward. The scope spans across all non-view activities that follow the view of interest to the next view activity.
5. Backing bean scope: The backing bean scope is comparable to the request scope, with the difference in that it exists for a specific client component. In general, all managed beans used in reusable components should be configured to backingBean scope. For example, bounded task flows that are designed to be regions on a page should use the backingBean scope if more than one instance of the task flow is expected to be on a single page.
6.View scope (Page Scope): The object is available until the view ID for the current view activity changes. This becomes handy when you use partial page rendering. If you have a dependent list box, you might send a server request to refresh the list box. When a response is returned, the request scope will be gone but the view scope will be still there. Therefore, view scope can be used to store data when partial rendering request comes back. The view scope exists not only for views that are rendered by JSPX pages, but also for views rendered by page fragments, as is the case in task flows that are built to execute in a region. The view scope of the parent page is not accessible from components added to a page fragement in a region, and the view scope of a view in a region is not accessible for the parent page.
7. None:  When you create objects (such as a managed bean) that require you to define a scope, you can set the scope to none, meaning that it will not live within any particular scope, but will instead be instantiated each time it is referenced. You should set a bean's scope to none when it is referenced by another bean.

Out of these View scope, Backing bean scope and page flow scope are ADF specific. Rest comes with JSF. This is the reason you must define ADF specific scoped backing beans ether in "adf-config.xml" or task flow. You access objects in those scopes via expression language with scope qualification. For instance, to reference the aaBean managed bean from viewScope scope, your expression would be:  #{viewScope .aaBean }.

Question: What is JSR-227 Specification?
Answer: Oracle has submitted a new JSR called "A Standard Data Binding & Data Access Facility for J2EE". This proposed spec will define a framework of classes called Declarative Bindings, that formalize the interactions between typical UI components and values and methods available in your business logic.