Thursday 1 November 2018

Frequently Asked Oracle ADF Interview Question and Answer Part 2

Hi Guys, In this post I'll share some interview questions and answers which i have faced or asked in interview panel.You can read my Part 1 QA by using url PART 1 QA.

1). How to declare the page navigation (navigation rules) in faces-config.xml file in ADF 10g?
Ans).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.

2). how to Set the range in table?
Ans).<af:table rows=”#{bindings.LoggedInUserServiceRequests.rangeSize}”…/>

3). Which component in ADF BC manages transaction ?
Ans).Application Module, manages transaction.

4). Can an entity object be based on two Database Objects(tables/views) or two Web services ?
Ans).No entity objects will always have one to one relationship with a database object or web service.

5). Where is that we write business rules/validations in ADF and why?
Ans).We should ideally be writing validations at Entity Object level, because they provide highest degree of reuse.

6). What are the JSF life-cycle phases?
Ans).Below are the JSF life cycle phases -
1. Restore view
2. Apply request values; process events
3.Process validations; process events
4. Update model values; process events
5. Invoke application; process events
6. Render response

7). Explain briefly the life-cycle phases of JSF?
Ans).1. Restore View :A request comes through the FacesServlet controller. The controller examines the request and extracts the view ID, which is determined by the name of the JSP page.
2. Apply request values: The purpose of the apply request values phase is for each component to retrieve its current state. The components must first be retrieved or created from the FacesContext object, followed by their values.
3. Process validations: In this phase, each component will have its values validated against the application’s validation rules.
4. Update model values: In this phase JSF updates the actual values of the server-side model ,by updating the properties of your backing beans.
5. Invoke application: In this phase the JSF controller invokes the application to handle Form submissions.
6. Render response
: In this phase JSF displays the view with all of its components in their current state.

8). What is setActionListener?
Ans).The setActionListener tag is a declarative way to allow an action source ( , , etc.) to set a value before navigation. It is perhaps most useful in conjunction with the “processScope” EL scope provided by 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.
Exmaple of this can be as follows. Suppose we have a table “employee”.We want to fetch the salary of an employee of some particular row and want to send this salary in
Next page in process scope or request scope etc.So using this we can do this.
It have two attributes :
From – the source of the value; can be an EL expression or a constant value
To – the target for the value; must be an EL expression
1
<af:setActionListenerfrom="#{row.salary}"
2
to="#{processScope.salary1}"/>
This setActionListener will pick value of salary of that row and store this value into salary1 variable.So anyone can use this salary
As processScope.salary1 . It is very simple to use. And very useful.

9). What are the advantages of using ADF?
Ans). Below are Some Advantages -
  • It supports Rapid Application Development.
  • It is based on MVC architecture
  • Declarative Approach (XML Driven)
  • Secure
  • Reduces maintenance cost and time
  • SOA Enabled 
10). ADF Bean Scopes?
Ans).Scope for ADF Managed Beans:
 Application - The application scope lasts until the application stops. Values that you store in a managed bean with this scope are available to every session and every request that uses the application.

Avoid using this scope in a task flow because it persists beyond the life span of the task flow
·         Session - The session scope begins when a user first accesses a page in the application and ends when the user's session times out due to inactivity, or when the application invalidates the session.
Use this scope only for information that is relevant to the whole session, such as user or context information. Avoid using it to pass values from one task flow to another. Instead, use parameters to pass values between task flows. Using parameters gives your task flow a clear contract with other task flows that call it or are called by it. Another reason to avoid use of session scope is because it may persist beyond the life span of the task flow.
·         pageFlow - A managed bean that has a pageFlow scope shares state with pages from the task flow that access it. A managed bean that has a pageFlow scope exists for the life span of the task flow.
If another task flow’s page references the managed bean, the managed bean creates a separate instance of this object and adds it to the pageFlow scope of its task flow.
You can specify page flow scope as the memory scope for passing data between activities within the ADF bounded task flow. Page flow scope defines a unique storage area for each instance of an ADF bounded task flow. Its lifespan is the ADF bounded task flow, which is longer than request scope and shorter than session scope.
When one task flow calls another, the calling task flow cannot access the called task flow’s pageFlow scope. This means, for example, that a UI component on a page referenced by a task flow’s view activity cannot access the pageFlow scope of another task flow even if this task flow is an ADF region embedded in the same page as the UI component.
·         View Use this scope for managed bean objects that are needed only within the current view activity and not across view activities. It defines scope for each view port that ADF Controller manages, for example, a root browser window or an ADF region.
The life span of this scope begins and ends when the current viewId of a view port changes. If you specify view, the application retains managed bean objects used on a page as long as the user continues to interact with the page. These objects are automatically released when the user leaves the page.
·         Request – Use request scope when the managed bean does not need to persist longer than the current request.
·         Backing Bean A backing bean is a convention to describe a managed bean that stores accessors for UI components and event handling code on a JSF page. It exists for the duration of a request and should not be used to maintain state.
Use this scope if it is possible that your task flow appears in two ADF regions on the same JSF page and you want to isolate each instance of ADF region.

11). How can you force ADF taskflow to use new transaction everytime taskflow is called?
Ans).Go taskflow overview and you will find Share data controls with calling task flow option as shown below 
Select always begin new transaction fron dropdown

12). How to use same transaction in ADF taskflow?
Ans).Select Always Use existing Transaction option.

13). How can you pass parameter to adf taskflow?
Ans).Go to overview select parameters link it will show screen like 

Here you can add multiple parameter which you want to pass to takflow while loading it.

14). What is the behavior of  router in ADF taskflow?
Ans).Based on some condition router can decide which route need to be follow. If none of condition match in that case router will follow default route defined by used.
15). Can ADF task flow hold more than 1 view activity?
Ans).Yes. ADF taskflow can have multiple view activity but 1 activity has to be defined as default activity. 

16). What is the Parent Action Activity in ADF Taskflow?
Ans).Parent action activity using it you can invoke the Control flow define in parent taskflow from child taskflow. 
Used to create new task flow using existing task flow.
17). What is method activity in Adf  Taskflow?
Ans).Using this activity you can invoke a method defined in manage-bean.

18). How to initialize ADF Taskflow?
Ans).Open the taskflow in Overview Mode select General option, there is initiallizer property. 
you can provide the any method reference which will get invoked whenever taskflow instance created.

19). How to convert an ADF bounded task flow to Unbounded Task Flow or Page Fragments?
Ans).In the editor, open the bounded task flow diagram. 
Right-click anywhere in the diagram other than on an activity or control flow. 

Choose a menu item such as Convert to Unbounded Task Flow or Convert to Task Flow with Page Fragments


If the bounded task flow contains fragments, the menu item will be Convert to Task Flow with Pages.


20). How to use same value in multiple activities of a Task Flow?
Ans).  Using Shared memory scope (for example, page flow scope) enables data to be passed between activities within the task flow. 
·         Page flow scope defines a unique storage area for each instance of an ADF bounded task flow. 
·         Any managed beans you decide to use within task-flow can be specified in page flow scope, so are isolated from the rest of the application

21). What are entry points for task flow?
Ans).task flow contains a number of view activities that are all entry points to the application.

22). How can one bounded task flow can call another?
Ans).One task flow can call another bounded task flow using a task flow call activity or a URL.


23). How to identify default activity in bounded task flow?
Ans).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.
24). What are the task Flow Activities ?
Ans).·         Method Call: Invokes a method, typically a method on a managed bean. A method call activity can be placed anywhere within an application’s control flow to invoke application logic based on control flow rules.
·         Parent Action: Allows a bounded task flow to generate outcomes that are passed to its parent view activity. 
·         Router: Evaluates an EL expression and returns an outcome based on the value of the expression. For example, a router in a credit check task flow might evaluate the return value from a previous method call and generate success, failure, or retry outcomes based on various cases. These outcomes can then be used to route control to other activities in the task flow. 
·         Save Point Restore: Restores a previous persistent save point, including application state and data, in an application supporting save for later functionality. 


·         Task Flow Call: Calls a bounded task flow from an unbounded task flow or another bounded task flow.
·         Task Flow Return: Identifies when a bounded task flow completes and sends control flow back to the caller. (Available for bounded task flows only). 
·         URL View: Redirects the root view port (for example, a browser page) to any URL-addressable resource, even from within the context of an ADF region. 
·         View: Displays a JSF page or page fragment. Multiple view activities can represent the same page or same page fragment
·         Control Flow Case: Identifies how control passes from one activity to the next in the application. 
·         Wildcard Control Flow Rule: Represents a control flow case that can originate from any activities whose IDs match a wildcard expression. For example, it can represent a control case from-activity-id containing a trailing wildcard such as foo*. 

25). If you want to show information to end users in a secondary browser, how will you show?
Ans).Use dialogs option from activities. 
Examples
1. you want to display help information to end users to assist them with a task in the primary browser window 
2. you want end users to select a value from a list of values

For more QA follow my next post.

Cheers :)

No comments:

Eclipse With Python

Hi Guys, Today i'll share how to start python project in eclipse IDE. to start Py development in eclipse we need to add Py Dev plugi...