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

Thursday, 12 April 2018

ADF Basics: Set Background Image for a Page(.jsf) in ADF 12c

In this post, I will give hint to set background image for a page in ADF 12c(12.1.3.0.0).


As you know, when you create .jsf page immediately after root component of jsf page(f:view) we have ad:document component.

So, if we set background image for this component, then it occupy entire page.


Tuesday, 6 February 2018

How to remove "Query By Example" feature from Panel collection(ADF Table)

Sometimes, we may do not want to "Query By Example" feature provided by panel collection in Oracle ADF.

If you want to hide / remove it, then do as mentioned below.

Remove these attributes from the panel collection

filterModel="#{bindings.TestVO1Query.queryDescriptor}"
                  queryListener="#{bindings.TestVO1Query.processQuery}"
                  filterVisible="true"

Hope this helps!.

Showing loading image during page load in Oracle ADF form which is created based BPM Human task flow

Hi All, 

We have an ADF form based on BPM Human task flow.  Page rendering was taking little time, during page load, user clicking on select one choice component. This causing an issue in dependent  list of values. And issue is coming only for the existing tasks.

So thought of providing loading image during page load and hide it once page is loaded completely to indicate a user not to click on anything during page load

Since bpm task open in an iframe window behavior, was not able to get adf component. So I used html,css and javascript approach to achieve this.
In my case, I have .jspx page not the .jsff


Step 1: Just below the af:document tag added div tag which contains loading giff image and text message as shown below

<div id="loading">
        <img id="loading-image" src="img/clock_positive_lg.gif" width="43"
             height="48" alt="loading gif"/>
             <p id ="text"><strong>Please wait...Page is still loading</strong></p>
            
      </div>

Step 2: Created css file to align the image and text as appropriate as shown below

<af:resource type="css">#loading { position:absolute; left:50%; top:50%;
                              border-radius:20px; padding:25px; z-index:100  }
                              #loading-image {}
                              #text{margin-left:-60px;}
      </af:resource>

Step 3: Main challenge I faced to hide the loading icon once page is loaded. Window.onload function was somehow not working in my case. So I used below approach

<af:resource type="javascript">
        
          window.addEventListener('load',function(){
             
              document.getElementById("loading").style.display = "none";
          },false);
         
    </af:resource>


This solves my problem

Friday, 6 May 2016

LOV selection issue in ADF - Key Attribute

I have faced small issue in LOV selection today.

Whenever you select value in LOV, always first value was selected. Even If you input valid value and tab out , first value was getting selected.

Solution: In my case reason is straightforward.

 I have created view accessors to have LOV for a attribute.

The source VO has only one attribute and I have not marked it as "Key Attribute" check box.

So, always make sure VO has primary key or mark the attribute to avoid issues like above.

Hope it helps!

Tuesday, 5 April 2016

java.lang.IllegalArgumentException issue when you filter(QBE) transient date field in VO (ADF 12.2.1)

Issue: java.lang.IllegalArgumentException when you try to filter(QBE) transient Date field in ADF

Approach followed to resolve the issue:

If the transient Date field which you created in your VO is of type java.sql.date then convert it to oracle.jbo.domain.Date type.

Also make sure, the Queryable check box is checked on this transient attrbute

Monday, 4 April 2016

af query search panel customization & some handy tips(ADF 12.2.1)

Topics covered

1. Passing user entered values in search panel to a DB package before executing a search.
2. How to get 2 date values entered using between operator in advanced mode for further processing.
3. How to hide Advanced button from af:query search panel?
4. How to hide Match All and Any radio option in af:query panel?
5. How to restrict operators for search fields in advanced mode in af:query panel  if field is part of view criteria?
6. How to restrict operators for search fields in advanced mode in af:query panel if field is not part of view criteria?
7. How to hide “Add Fields” button in af:query search panel?
8. Code snippet to handle "on-before" and "on-after" as well handling null values in default between operator


ADF Search Query Panel (af:query)

    The af:query component displays a search panel with various elements and it executes a query based on search criteria . In this document, I will explain possible customizations and some handy tips.
To achieve basic functionality of search panel, all we have to do is to drag and drop “All Queriable Attributes” (Named Criteria) from Data control panel. If we want specific criteria then we create view criteria on the particular view and will drag and drop on to a page as a query panel.
Now I will explain different use cases where you have to do customization and achieve the functionality.

1: Suppose, I want to pass user entered values in search panel to a DB package before executing a search. Or to put it in other way, I need to hold the values for some business logic before executing search.

Solution: Customize the queryListener of your af:query panel.

When you drag and drop view criteria to a page as a query panel, by default query listener of your af:query is queryListener="#{bindings.<vo>CriteriaQuery.processQuery}"  .

Change this and execute processQuery operation from your bean method
Ex:
#{backingBeanScope.Test BackingBean.customQueryListener}

Now logic for your cutomQueryListener method is as follows

 public void cutomQueryListener(QueryEvent  queryEvent){
 String EmployeeId = null;
        // Query Event is delivered when a query action is triggered
        QueryDescriptor qd = queryEvent.getDescriptor();
     
        // This line will represent group of criterion objects
        ConjunctionCriterion conCrit = qd.getConjunctionCriterion();
     
        //access the list of all search fields
        List<Criterion> criterionList = conCrit.getCriterionList();

        for (Criterion criterion : criterionList) {
            AttributeDescriptor attrDescriptor =  ((AttributeCriterion)criterion).getAttribute();

            if (attrDescriptor.getName().equalsIgnoreCase("EmployeeId")) { // EmployeeId is one of the query items in the search panel
             EmployeeId  =  (String)((AttributeCriterion)criterion).getValues().get(0);
           
            //This is how we will access the query field
             System.out.println("EmployeeId :" + EmployeeId );

            }

Note: At this moment, I have value entered in EmployeeId field. So, I can do whatever validation on the user entered value or pass it to package call before executing search query.

//Execute the query Listener using EL. This will execute the query component .If u see the exp , this was initially applied to QueryListener.. Later we assigned QueryListener to our custom method.
   
   invokeMethodExpression("#{bindings.VOCriteriaQuery.processQuery}", queryEvent);
     
    }
 
      //helper method to execute the QueryListener EL

       private void invokeMethodExpression(String expr, QueryEvent queryEvent) {
        FacesContext fctx = FacesContext.getCurrentInstance();
        ELContext elContext = fctx.getELContext();
        ExpressionFactory eFactory =
            fctx.getApplication().getExpressionFactory();
        MethodExpression mexpr =
            eFactory.createMethodExpression(elContext, expr, Object.class,
                                            new Class[] { QueryEvent.class });
        mexpr.invoke(elContext, new Object[] { queryEvent });
   }

 2: How to get 2 date values entered using between operators in advanced mode for further processing.

Say for Example, we have “Active Date” field in search panel and we want to get “FromActiveDate” and “ToActiveDate”  from this search field. In this case, we need to find whether search panel is in advanced mode or basic mode.

You can achieve this by using below line of code

qdesc.getUIHints().get(QueryDescriptor.UIHINT_MODE).equals(QueryDescriptor.QueryMode.ADVANCED)

Complete code logic is as shown below

if (attrDescriptor.getName().equalsIgnoreCase("ActiveDate")) {

                // Checking whether it is advanced mode
                if (qdesc.getUIHints().get(QueryDescriptor.UIHINT_MODE).equals(QueryDescriptor.QueryMode.ADVANCED)) {
                 
                    Map<AttributeCriterion, Operator> changedAttrs = new HashMap<AttributeCriterion, Operator>();
                    AttributeCriterion ac = (AttributeCriterion) criterion;
                    Operator operator = ac.getOperator();
                    if ("BETWEEN".equalsIgnoreCase(operator.getValue().toString())) {
                        oracle.jbo.domain.Date effFromDate1 =
                            (oracle.jbo.domain.Date) ((AttributeCriterion) criterion).getValues().get(0);

                        if (null != effFromDate1) {
                         
                            effectiveFromDate = effFromDate1.getValue();
                        }


                        oracle.jbo.domain.Date effToDate1 =
                            (oracle.jbo.domain.Date) ((AttributeCriterion) criterion).getValues().get(1);

                        if (null != effToDate1) {
                         
                            effectiveToDate = effToDate1.getValue();
                        }
                    } else {
                        oracle.jbo.domain.Date effFromDate1 =
                            (oracle.jbo.domain.Date) ((AttributeCriterion) criterion).getValues().get(0);

                        if (null != effFromDate1) {
                         
                            effectiveFromDate = effFromDate1.getValue();
                        }
                    }


                    //Basic mode:
                } else {
                    oracle.jbo.domain.Date effectiveFromDate1 =
                        (oracle.jbo.domain.Date) ((AttributeCriterion) criterion).getValues().get(0);
                    if (null != effectiveFromDate1) {
                        effectiveFromDate = effectiveFromDate1.getValue();
                    }

                }

3. How to hide Advanced button from af:query

From the af:Query properties, set  property values as modeChangeVisible="false"
Select af:query in the page, and from the properties window, under appearance section you can find the modeChangeVisible property as shown below screenshot






4. How to hide Match All and Any radio option in af:query panel

1. Edit View Criteria
2. In the Criteria UI hints – Un check the Show Match all  and Match Any check box




Note: To make  required and put **  for the af:query panel attributes make criteria item as required for * and selectively required for **

5. How to restrict operators for search fields in advanced mode in af:query panel

1. Edit view criteria
2. Under Criteria Definition tab, select criteria item
3. Go to “Custom Operators” tab in the bottom
4. Remove operators which you do not want to show for particular attributes in advanced mode



6. What if field is not part of your view criteria and still you want to restrict the operators.
Approach to be followed


In the above case you still achieve like the way we used to do in 11g by using
<CompOper>

To make our life easier,
1) first add attribute to view criteria,
2)remove unnecessary operators form custom operators
3)Go to source mode, copy CompOper from view criteria item and put it some where for reference
4)remove the attribute from view criteria
5)Go to source mode, find the attribute then copy the CompOper properties which you copied in step3


Then go to source mode and then find out the attribute for which you want to restrict the operators then use <CompOper>
for Ex, In below example, I have restricted all the operators except equals for string attribute

<ViewAttribute
    Name="Status"
    IsPersistent="false"
    PrecisionRule="true"
    Precision="1"
    Type="java.lang.String"
    ColumnType="VARCHAR2"
    AliasName="STATUS"
    Expression="STATUS"
    SQLType="VARCHAR"
    LOVName="LOV_Status">
    <DesignTime>
      <Attr Name="_DisplaySize" Value="1"/>
    </DesignTime>
    <CompOper
      Name="Status_Oper"
      ToDo="-1"
      Oper="&lt;"
      MinCardinality="1"
      MaxCardinality="1"/>
    <CompOper
      Name="Status_Oper1"
      ToDo="-1"
      Oper="&lt;="
      MinCardinality="1"
      MaxCardinality="1"/>
    <CompOper
      Name="Status_Oper2"
      ToDo="-1"
      Oper="&lt;>"
      MinCardinality="1"
      MaxCardinality="1"/>
    <CompOper
      Name="Status_Oper3"
      ToDo="-1"
      Oper=">"
      MinCardinality="1"
      MaxCardinality="1"/>
    <CompOper
      Name="Status_Oper4"
      ToDo="-1"
      Oper=">="
      MinCardinality="1"
      MaxCardinality="1"/>
    <CompOper
      Name="Status_Oper5"
      ToDo="-1"
      Oper="BETWEEN"
      MinCardinality="1"
      MaxCardinality="1"/>
    <CompOper
      Name="Status_Oper6"
      ToDo="-1"
      Oper="CONTAINS"
      MinCardinality="1"
      MaxCardinality="1"/>
    <CompOper
      Name="Status_Oper7"
      ToDo="-1"
      Oper="DOESNOTCONTAIN"
      MinCardinality="1"
      MaxCardinality="1"/>
    <CompOper
      Name="Status_Oper8"
      ToDo="-1"
      Oper="ENDSWITH"
      MinCardinality="1"
      MaxCardinality="1"/>
    <CompOper
      Name="Status_Oper9"
      ToDo="-1"
      Oper="ISBLANK"
      MinCardinality="1"
      MaxCardinality="1"/>
    <CompOper
      Name="Status_Oper10"
      ToDo="-1"
      Oper="ISNOTBLANK"
      MinCardinality="1"
      MaxCardinality="1"/>
    <CompOper
      Name="Status_Oper11"
      ToDo="-1"
      Oper="NOTBETWEEN"
      MinCardinality="1"
      MaxCardinality="1"/>
    <CompOper
      Name="Status_Oper12"
      ToDo="-1"
      Oper="STARTSWITH"
      MinCardinality="1"
      MaxCardinality="1"/>
    <Properties>
      <SchemaBasedProperties>
        <CONTROLTYPE
          Value="choice"/>
      </SchemaBasedProperties>
    </Properties>
  </ViewAttribute>

7. How to hide “Add Fields” button in af:query search panel?

In the, jsff(or in your page), within af:query component add a facet footer and specify width and height as 1 as shown below
<af:query id="qryId1" headerText="SEARCH"
                                          disclosed="true"
                                          value="#{bindings.TestVOCriteriaQuery.queryDescriptor}"
                                          model="#{<model bidning value> }"
                                          queryListener="#{<query listener value>}"
                                          queryOperationListener="#{bindings. VOCriteriaQuery.processQueryOperation}"
                                          maxColumns="2" rows="3" fieldWidth="30%" labelWidth="70%"
                                          resultComponentId="::at1:_ATp:t1">
                                    <f:facet name="footer">
                                        <af:spacer width="1" height="1" id="s3"/>
                                    </f:facet>
                                </af:query>

8.  Code snippet to handle "on-before" and "on-after" as well handling null values in default between operator

            if (attrDescriptor.getName().equalsIgnoreCase("ActiveDate")) {



                 
                    Map<AttributeCriterion, Operator> changedAttrs = new HashMap<AttributeCriterion, Operator>();
                    AttributeCriterion ac = (AttributeCriterion) criterion;
                    Operator operator = ac.getOperator();
                    if ("BETWEEN".equalsIgnoreCase(operator.getValue().toString())) {
                        oracle.jbo.domain.Date effFromDate1 =
                            (oracle.jbo.domain.Date) ((AttributeCriterion) criterion).getValues().get(0);

                        if (null != effFromDate1) {
                         
                            effectiveFromDate = effFromDate1.getValue();
                        }


                        oracle.jbo.domain.Date effToDate1 =
                            (oracle.jbo.domain.Date) ((AttributeCriterion) criterion).getValues().get(1);

                        if (null != effToDate1) {
                         
                            effectiveToDate = effToDate1.getValue();
                        }
                        String op = null;
                                                            String opDate = null;
                                                            Object val = null;
                                                            List<Object> list = (List<Object>)ac.getValues();
                                                            if (list.get(0) == null && list.get(1) != null) {
                                                                                op = "<=";
                                                                                opDate = "ONORBEFORE";
                                                                                val = "1900-01-01";
                                                                                list.set(0, val);
                                                            } else if (list.get(1) == null && list.get(0) != null) {
                                                                                op = ">=";
                                                                                opDate = "ONORAFTER";
                                                                                val = "9999-01-01";
                                                                                list.set(1, val);
                                                            }
                                                            if (op != null) {
                                                                changedAttrs.put(ac, operator);
                                                                for (Operator o : ac.getAttribute().getSupportedOperators()) {
                                                                    if (o.getValue().toString().equalsIgnoreCase(op) || o.getValue().toString().equalsIgnoreCase(opDate)) {
                                                                        operator = o;
                                                                        break;
                                                                    }
                                                                }
                                                                ac.setOperator(operator);
                                                            }
                    } else {
                        oracle.jbo.domain.Date effFromDate1 =
                            (oracle.jbo.domain.Date) ((AttributeCriterion) criterion).getValues().get(0);

                        if (null != effFromDate1) {
                         
                            effectiveFromDate = effFromDate1.getValue();
                        }
                    }


}



References:

1. ADF code corner: af:query component field validation by Frank Nimphius
2. http://www.jobinesh.com/2013/01/prart-2-hiding-unwanted-operators-in.html - By Jobinesh Purushothaman

Friday, 4 December 2015

Issue with ‘Set Source Order’ in VO wizard - ADF

Problem statement: 
I had VO with few Transient Attributes. These attribute values needs be populated based on calling DB package call. 
I already had Java wrapper class contains logic to call DB packages
So I  override my createInstanceFromResultSet method in VO Impl to populate transient attributes.
My page is search page, so created view criteria on VO to create standard query panel.
At later point, I wanted to re-order or shuffle attributes/fields in the standard query panel.
So I used ‘Set Source Order’ option to re-order the attributes.
Problem it created: attribute mis-match happened and one attribute showing another attribute value.
                                                                                       
Solution I did: Taken backup of VO impl custom method(other than setter and getter methods)and VO Row Impl and Client interface(VO-Java file),
          Go to VO wizard.
       From the Java section un- check for VO impl and VO Row Impl
      Select  ‘Query’  options from the left panel and click on ‘Update Mappings’ button

Once done, just restart the JDeveloper, and Generate VOImpl , VORow Impl  and Client interface java
Copy custom method you implemented in VOImpl from back up file and re-run. It works fine for me.

As per my observation, whenever you want to change VO query/ attribute order, it is better to do it in source mode instead of directly doing in wizard

Hope it helps!...

Monday, 23 November 2015

ORA-01446: cannot select ROWID from......... in ADF VO

I have search page - (af:querypanel  based on view criteria and result will be displayed in af:table) based on entity based VO and query contains union operation

My VO does not have primary key attribute so i have added ROWID from entity as a primary key.

When I run the page and hit on search button in the standard query panel, I was getting below mentioned error

ORA-01446: cannot select ROWID from, or sample, a view with DISTINCT, GROUP BY, etc

From the on line resources I found that, either I have to remove ROWID or remove DISTINCT, GORUP By clause.

Solution I have did to overcome from this issue,

Since mine is search screen and does not involve any transactions so better approach would be to create query based VO(or Read only VO) instead of Entity based VO to avoid ROWID.

So, I have just re-shuffle the Selected Entity under "Entity Objects" in VO overview editor to convert entity based vo to read only or query based VO.

So, try to have one primary key attribute for your VO if it is entity based VO. If read only VO meets your requirement then go for it to avoid unnecessary errors.

Hope it helps :)

Saturday, 21 November 2015

Programmatically executing View criteria in VOImpl in ADF

Below is the code snippet to execute view criteria in your VOImpl

ViewCriteria vc = this.getViewCriteriaManager().getViewCriteria("DeptVOCriteria");

//Manages named variables and their values.         
VariableValueManager vvm = vc.ensureVariableManager();

// Set bind parameter values  
 vvm.setVariableValue("bindDept", <dept value>);

//apeend View Criteria
this.appendViewCriteria(vc);

// Executing the query          
 this.executeQuery();

Friday, 28 August 2015

JDev 12c Performance Improvement tips

Hi All,

When working with ADF 12c project with JDev 12c(12.1.3.0.0) I faced issues related to J Developer slowness.
So, from the online I found few tips to improve the speed/performance of J Developer and documented here for my reference

1. Disable auto build on save
Tools -> Preferences -> Code Editor -> Save Actions -> Remove Build project on save(by Clicking on Save)

2. Change look and feel to Windows instead of Oracle theme
Tools -> Preferences -> Environment -> Look and Feel to ‘Windows’

3. Disable/Un-install updates which you are not using
Tools -> Features -> In Manage Features and Updates
Uncheck the updates which you are not using

4. In ide.conf file (located under Oracle home directory\jdeveloper\ide\bin)

AddVMOption  -Xms1024M
AddVMOption  -Xmx1024M

5. In jdev.conf file(located under Oracle Home Directory\jdeveloper\jdev\bin)

AddVMOption -Doracle.ide.osgi.buddy.delegate.resource.exempt.paths=META-INF/services/javax.xml.ws.spi.Provider
# optimize the JVM for strings / text editing
        AddVMOption -XX:+UseStringCache
        AddVMOption -XX:+OptimizeStringConcat
        AddVMOption -XX:+UseCompressedStrings

        # if on a 64-bit system, but using less than 32 GB RAM, this reduces object pointer memory size
        AddVMOption -XX:+UseCompressedOops

        # use an aggressive garbage collector (constant small collections)
        AddVMOption -XX:+AggressiveOpts

        # for multi-core machines, use multiple threads to create objects and reduce pause times
        AddVMOption -XX:+UseConcMarkSweepGC

6. Use Fast Swap Jdev feature to speedup the development
      Tools -> Preferences -> Run -> Weblogic -> Fast Swap

7. Use source editor for JSP and JSFF instead of design editor

     Tools -> Preferences -> File types -> Default editor

8. Also set high priority in the windows task manager as shown below
 
     Right click on jdev64w.exe -> set priority -> High



9. If you application does not use mds, locally you clean up contents of few folders in system directory on a daily basis. I see some bit of help by deleting contents of below folders daily. Do not delete folder itself. Just delete its contents.

.diagnostics , .history and .system cache 





Some of the Reference Blog link

1. Shay blog
https://blogs.oracle.com/shay/entry/is_your_jdeveloper_slow_it_sho

2. Oracle blog
https://blogs.oracle.com/angelo/entry/improving_the_performance_of_jdeveloper

3. http://waslleysouza.com.br/en/2014/04/increase-the-performance-of-jdeveloper-11g/

4. http://bexhuff.com/2012/09/jdeveloper-memory-and-performance

Thank you.

Sunday, 2 August 2015

Difference between BindingContext and BindingContainer in ADF


BindingContext is a container Object that holds a list of available data controls and data binding objects.It is the Java representation
of all cpx files marked in your adfm.xml file

BindingContext class is an interface that exposes generic methods to access the binding layer


The BindingContainer class represents Java representation of the page definition file.
To read bindings or executable entries present in the page definition we may need to access binding container object.

BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();

Thursday, 30 July 2015

Oracle ADF - Regular Expression and Attribute validation Notes

Regular Expression for Email validation


if you want to put this for optional field then we have to allow null/empty values as well

So the above expression becomes


^ begin of the string
$ is end of String
| is OR



Regular Expression for Alphanumeric character and also '_' (UnderScore) is allowed

[a-z A-Z 0-9 _]


Regular Expression for Number validation(Only Numbers are allowed not Decimals like 1.5)

[0-9]{1,10}|null

| -> OR
null -> the input text allows null values as well


Attribute validation 

We can perform attribute validation using <af:validateRegExp> component

For Ex, If input text is allowed to have only alphanumeric then put following <af:validateRegExp> within af:inputText component



<af:validateRegExp messageDetailNoMatch="Only alphanumeric, '_'(Underscore) and '-'(Hyphen) characters are allowed" pattern="[a-z A-Z 0-9]*"/>

Friday, 29 May 2015

Populating Primary key of table Using Sequence in ADF

-> Create the sequence
-> In the entity, identify the primary key attribute
-> Select Value Type as Expression in the Entity Attribute wizard
-> and provide expression value
ex value :
(new oracle.jbo.server.SequenceImpl("SXRCM0_COLUMN_MAPPINGS_ID_SEQ",object.getDBTransaction())).getSequenceNumber()

where "SXRCM0_COLUMN_MAPPINGS_ID_SEQ" is the name of the sequence

Saturday, 18 April 2015

ADF Basics - Memory scope

Here I am documenting Information on ADF Memory scopes which Frank Nimphius explained in ADF insider tutorial series for my quick reference.


ADF Memory scopes
There are 6 types of memory scopes
3 from standard JSF application
  1. Application Scope 2)Session scope 3)request scope
In addition to above ADF Faces provides the following
4) PageFlowScope  5)backingBeanscope 6) ViewScope
Application Scope :
- Attributes and managed beans are available for an entire application and shared among users.
- Information should not have session dependency.
- This scope may be used to hold static objects that are the same for all users.
Session Scope:  
- Attributes and beans are user instance specific, and exists from the
 time of their creation to the time they are deleted or the session ends
- Example usecase is a user info bean that stores information about a user
 to avoid unnecessary queries.


Page flow Scope:
- Available for the duration of a task flow
- Exited when exiting the task flow
- If used with nested task flows, the Page Flow Scope of the caller flow
  is suspended and activated upon return from the called Task Flow
- PageFlow scope is not available until after the JavaServer Faces Restore View phase
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.The object is available as long as the user continues navigating from one page to another. If the user opens a new browser window and begins navigating, that series of windows will have its own pageFlowScope scope.
View Scope
- Stores objects used by a single page
- Automatically released when the user leaves the page
- A View scope instance exists for each view that the ADF Controller manages
- The lifetime begins and ends with the change of the view id of a view port


Request scope:
- Represents the smallest available scope
- Lasts for the time it takes to transition from one view activity to the next
The object is available from the time an HTTP request is made until a response is sent back to the client. Use request scope when the managed bean does not need to persist longer than the current request. 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.
Backing bean scope:
- Special case of request scope
- Associated with a specific manage bean instance
- Used with declarative components,regions and page fragments that use a
 managed bean to hold view state information
- Allows multiple instances of the components to co-exists on a single page
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


None
- Use for beans that don't require to keep state so that bean does not need

to remain in memory

Monday, 10 November 2014

Populating who columns-createdBy,creationDate,lastUpdatedBy,lastModifiedBy(attributes) in ADF

Hi All,

I would like to thank "John Stegeman"  for his wonderful information on how to populate who columns -
createdBy,creationDate,lastUpdatedBy,last ModifiedBy declaratively on OTN.

I have exactly copied what ever he suggested for my reference and hope that it may helps for ADF beginners as well.

If you need to keep track of historical information in your entity object, such as when an entity was created or modified and by whom, or the number of times the entity has been modified, you specify an attribute with the History Column option selected (in the Edit Attribute dialog).

If an attribute's data type is Number, String, or Date, and if it is not part of the primary key, then you can enable this property to have your entity automatically maintain the attribute's value for historical auditing. How the framework handles the attribute depends which type of history attribute you indicate:

* Created On: This attribute is populated with the time stamp of when the row was created. The time stamp is obtained from the database.
* Created By: The attribute is populated with the name of the user who created the row. The user name is obtained using the getUserPrincipalName() method on the Session object.
* Modified On: This attribute is populated with the time stamp whenever the row is updated/created.
* Modified By: This attribute is populated with the name of the user who creates or updates the row.
* Version Number: This attribute is populated with a long value that is incremented whenever a row is created or updated.
If you choose Version Number from the History Column drop-down list,Oracle ADF will automatically increment the value of the numeric attribute every time the object is updated.



Screen shot for reference from JDev version 11.1.1.6 and 11.1.2.4















Note : I was getting "oracle.jbo.RowInconsistentException: JBO-25014: Another user has changed the row with primary key oracle.jbo.Key" error whenever i try to update any record 
Please refer below blog to find out exact reason for the issue
Reference blog
http://radio-weblogs.com/0118231/stories/2004/03/24/whyDoIGetOraclejborowinconsistentexception.html

In my case, i have resolved by checking tick mark for Change Indicator attribute for Id attribute(primary key) and it solves the error.


Change Indicator. This property defines specific attribute to be responsible for row data changes tracking, instead of checking every attribute. Only if Change Indicator attribute value will be changed in DB, then current row changes will be prevented and user will be informed about someone else changes in the same row.