Showing posts with label Oracle ADF. Show all posts
Showing posts with label Oracle ADF. Show all posts

Tuesday, 6 November 2018

Frequently Asked Oracle ADF Interview Question and Answer Part 3

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 and ADF PART QA 2.



1). What are the ADF templates, jspx pages, jsff page & declarative components?
Ans). ADF Faces provides the following types of reusable building blocks
·  Page fragments(.jsff): Page fragments allow you to create parts of a page. A JSF page can be made up of one or more page fragments. For example, a large JSF page can be broken up into several smaller page fragments for easier maintenance. 
We can create an page fragments template & use to create page fragments.

·  Page templates (.jspx): By creating page templates, you can create entire page layouts using individual components and page fragments. For example, if you are repeatedly laying out some components in a specific way in multiple JSF pages, consider creating a page template for those pages. When you use the page template to build your pages, you can be sure that the pages are always consistent in structure and layout across the application. 
Using default layouts or creating new we can create page templates.
Ex. Using <f:facet> we can create page templates with header, footer, top, left & right regions etc. 

·  Declarative components: The declarative components feature allows you to assemble existing, individual UI components into one composite, reusable component, which you then declaratively use in one or more pages. 
For example, if you are always inserting a group of components in multiple places, consider creating a composite declarative component that comprises the individual components, and then reusing that declarative component in multiple places throughout the application. 
Declarative components can also be used in page templates. 
Declarative components can also be used in other applications, its possible after creating JAR file of that component.
2). What is region in Oracle ADF?
Ans). Tag name : <af:region>
The region tag allows dynamic content to be included in a master page. This tag is bound to a RegionModel. The model decides which viewId is to be included. The model has methods that allow pre and post processing of an include. See the javadoc for oracle.adf.view.rich.model.RegionModel. 
This component does not support any facets. 
Regions support nesting (one af:region component can contain another af:region component). 
Regions are not allowed to be placed inside of af:forEach, c:forEach, or other forEach-like tags because of limitations in how JSF handles component IDs and component state which would manifest in your application in obscure manners such as loss of component state. 
Regions are also not allowed to be placed inside of af:iterator because the region requires bindings to be established at the tag execution phase in order to perform its JSP include operations and the variables for iterators are not established until later in the life-cycle.
Regions in release 11g are reusable page flows. They have their own navigation rules, managed beans and ADFm page definitions. Each page within the region is a page fragment (jsff). Do not confuse the 11g af:region component with the 10.1.3 or Trinidad region. The 10.1.3 and Trinidad region components are single page fragments that do not have multiple pages, navigation rules nor managed beans. The 10.1.3 region is similar to the 11g page templates and declarative components.

The <af:region> will not stretch all included children, but it will stretch an included child if all of the following are true:

·         The region itself does not have a header
·         The region itself is being stretched
·         There is only a single included child
·         The child must be capable of being stretched
Example<af:region value="#{mybean.myRegionModel}"/>

3). What is <f:facet> ?
Ans). This tag is used to add a facet to the component means this tag is used to add its child as a facet of the closest 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.
4). How to skip validation in ADF?
Ans). Add immediate="true" to the button. This way all input fields which don't have immediate="true"will be skipped in processing.
This method mainly used for view layer validation skip.

5). How to make any field mandatory?
Ans). Add attribute required="true" to that specific field.

6). What is setActionListener?
Ans). SetActionListener – 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 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:setActionListener from="#{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.

7). How to pass Values Between Pages?
Ans). The ADF Faces pageFlowScope scope makes it easier to pass values from one page to another, thus enabling you to develop master-detail pages more easily. Values added to the pageFlowScope scope automatically continue to be available as the user navigates from one page to another, even if you use a redirect directive. But unlike session scope, these values are visible only in the current page flow or process. If the user opens a new window and starts navigating, that series of windows will have its own process. Values stored in each window remain independent.
Like objects stored in any standard JSF scope, objects stored in the pageFlow scope can be accessed through EL expressions. The only difference with the pageFlow scope is that the object names must use the pageFlowScope prefix. For example, to have a button's label provided by a managed bean stored in the pageFlow scope, and to have a method on the bean called when the button is selected, you might use the following code on your page:
<af:commandButton text="#{pageFlowScope.buttonBean.label}"
                  action="#{pageFlowScope.buttonBean.action}"/>
The pageFlowScope is a java.util.Map object that may be accessed from Java code. The setPropertyListener tag allows you to set property values onto a scope, and also allows you to define the event the tag should listen for. For example, when you use the setPropertyListener tag with the type attribute set to action, it provides a declarative way to cause an action source (for example, commandButton) to set a value before navigation. You can use the pageFlowScope scope with the setPropertyListener tag to pass values from one page to another, without writing any Java code in a backing bean. For example, you might have one page that uses the setPropertyListener tag and a command component to set a value in the pageFlowScope scope, and another page whose text components use the pageFlowScope scope to retrieve their values.
You can also use the pageFlowScope scope to set values between secondary windows such as dialogs. When you launch secondary windows from, for example, a commandButtoncomponent, you can use a launchEvent event and the pageFlowScope scope to pass values into and out of the secondary windows without overriding values in the parent process.
Tip: Instead of using the setActionListener tag (which may have been used in previous versions of ADF Faces), use the setPropertyListener tag and set the event type to action

8). How to Use the pageFlowScope Scope Within Java Code

Ans). You can access pageFlow scope from within any Java code in your application. Remember to clear the scope once you are finished.
Note: If your application uses ADF Controller, then you do not have to manually clear the scope.
To use pageFlowScope in Java code:
To get a reference to the pageFlowScope scope, use the org.apache.myfaces.trinidad.context.RequestContext. getPageFlowScope() method.
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;
Map pageFlowScope = RequestContext.getCurrentInstance().getPageFlowScope();
Object myObject = pageFlowScope.get("myObjectName");
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();

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

10). What are types of ADF Faces components?
Ans). ADF Faces components:
Data components
Input components
Layout components
Navigational components
Output components

11). Why 'timeZone' attribute is required when <af:convertDateTime is used?
Ans). When <af:convertDateTime is used it takes by default GMT time, for Indian timing we need to take GMT+5.30
EX.
<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>

12). What is the difference between trinidad.config and trinidad.skins?
Ans). trinidad.config file is ceated 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.

13). What is the difference between an action and an action listener?
Ans). 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.
Action listener is a class that wants to be notified when a command component fires an action event.
Action returns String ActionListner returns void.
·         Action used for page navigation with faces-config.xml or adf-config.xml, ActionListner is used for event handling, to retrieve data & other operations, its used with backing beans or bindings.
·         Action use - for page navigation, ActionListner use - check box, drop down box.

13). What is a view scope?
Ans). view-state allocates a new viewScope when it enters. This scope may be referenced within the view-state to assign variables that should live for the duration of the state. This scope is useful for manipulating objects over a series of requests from the same view.

14).What is the difference between visible property and render property
Ans).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.

15). How do you define pagination in adf?
Ans). It was not possible to do 
pagination on af:table component before R1 release 11.1.1.7, although this feature was exist in 10g but not available in previous 11g series.
In 11g series there were some customization approach for pagination: 
1. 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.
2. Using JavaScript
3. Customizing VO java code,

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

17). What is the difference between setting an immediate=true on a button and immediate=true on a text field?
Ans). 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.

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.

18). What is inter-portlet communication?
Ans). 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.

19). What is PPR and how do you enable Partial Page Rendering(PPR)?
Ans). 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.- Setting AutoSubmit property to true on the triggering element.
- Setting the PartialTriggers property of target component to refer to component id of the triggering element.

20). Explain Iterator RangeSize Attribute
Ans). Iterator bindings have a rangeSize attribute that the binding uses to determine the number of data objects to make available for the page for each iteration. This attribute helps in situations when the number of objects in the data source is quite large. Instead of returning all objects, the iterator binding returns only a set number, which then become accessible to the other bindings. Once the iterator reaches the end of the range, it accesses the next set. 
Example shows the default range size for the CustomerInfoVO iterator.
Example RangeSize Attribute for an Iterator
<iterator Binds="CustomerInfoVO" RangeSize="25" DataControl="StoreServiceAMDataControl" id="CustomerInfoVO1Iterator"
ChangeEventPolicy="ppr"/>

By default, the rangeSize attribute is set to 25.

You can set it to -1 to have the full record set returned.



Cheers Guys :)

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 :)

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...