Saturday, September 29, 2012

Error -Could not create the Java virtual machine" in Jdeveloper 11g

If you notice below error while starting Weblogic server using Jdeveloper 11g, Try below options, It may resolve the issue.

"Could not create the Java virtual machine" in Jdeveloper 11g"

Right click on My Computer, go to properties->Advanced->Environment Variables.
In user Variables add a New variables with below details:

Variable name: EXTRA_JAVA_PROPERTIES
Variable Valute: -Xms256m -Xmx256m

Thursday, September 27, 2012

How to determine the selected tab name with component


Use Case :  If there are multiple <af:showDetailTab> components in <af::pnaelTabbed> , How to identify what tab has been selected ?

Solution :   Use <af:setPropertyListener> component inside <af:showDetailTab> and specify 'type =disclosure' and set a specific value to a page flow scope variable or any binding attribute.



            <af:showDetailItem text="Employee" id="sdi2" >
                <af:setPropertyListener from="EMP"
                                        to="#{bindings.TabName.inputValue}"
                                        type="disclosure"/>
              </af:showDetailItem>


#{bindings.TabName.inputValue} - View object attribute Or you can also specify #{pageFlowScope.tabName}

Tuesday, September 25, 2012

How to use returnListener in ADF


Use case : If you have to invoke a method before any 'Return' activity from any event (eg : Popup, dialog, etc..)

Solution : Use 'returnListener' component as below


     <af:commandButton text="Employee Lookup" id="cb4"
         rendered="true" 
         action="planlookup" 
         windowEmbedStyle="window" useWindow="true" 
         windowModalityType="modeless" windowHeight="480" 
         windowWidth="650"
         returnListener="#{pageFlowScope.empBean.onReturn}"/>

                                           

AFStretchWidth



Specify below styleClass for <af::panelCollection> and <af:panelStrechLayout> components to automatically adjust the width of containing UI Components

 styleClass="AFStretchWidth"


Saturday, September 22, 2012

How to enable Content Style to 'Upper Case' while typing in Input text box


Use Case : Always enable 'Upper Case' while typing for any input text component

Solution :  Set 'contentStyle' attribute value to 'text-transform:uppercase' for all input components.


Wednesday, September 19, 2012

How to keep track of history data using 'Effective Dated Entities' using ADF


Usecase :   How to keep track of database entries with all the previous changes from the time when the row got created
   - > How many times a specific row has been modified ?
   - > Who are all modified a specific row when and what modified ?

Approach
              - Create below four columns in Database table, synchronize the respective entity to reflect these attributes.




 - Modify the Entity Object to 'EffectiveDated' , Open the Entity, Select 'General' , Modify the 'Effective Date Type' attribute to 'EffectiveDated' using property inspector.


 - Set 'Sequece' attribute value to 'true' for 'EffectiveSeq' attribute using Property Inspector

 - Set 'Sequece Flag' attribute value to 'true' for EffectiveSeqFlag' attribute using Property Inspector


 - Set 'Start Date' attribute value to 'true' for 'StartDate' attribute using Property Inspector
 - Set 'End Date' attribute value to 'true' for 'EndDate' attribute using Property Inspector

- Set 'Effective Dated' attribute of corresponding View Object to 'true' using property inspector

- Finally, Set the 'EffeciveDateMode' at row level, You can set this property wherever needed based on the requirement, In this example, I am setting this at constructor of the Row Impl class, so whenever new row inserted/updated/deleted/created this will be invoked and set the value accordingly.
                  
-  Below shows what exactly meant for each mode level in ADF, Mode level can be set based on the requirement.

Row.EFFDT_UPDATE_MODE: When an effective dated row is updated in "update" mode, the modified row is end dated on the effective date and a new row is created with the changed values.

Row.EFFDT_UPDATE_CHANGE_INSERT_MODE: When an effective dated row is updated in "change insert" mode, the modified row is end dated on the effective date and a new row is inserted that fits between the effective date and the start date of the next row in the effective date time line.

Row.EFFDT_UPDATE_CORRECTION: When an effective dated row is updated in "correction" mode, the effective start date and effective end date is left unchanged.

Row.EFFDT_UPDATE_NEW_EARLIEST_CHANGE_MODE: Updating in "new earliest change" mode is supported only in Multiple Changes Per Day.

Row.EFFDT_UPDATE_OVERRIDE_MODE: When an effective dated row is updated in "override" mode, the modified row is end dated on the effective date and the start date of the next row in the effective date time line is set to effective date + 1 day.  

Row.EFFDT_NONE_MODE: Default state of the effective date mode on the row.
ADF Framework automatically updates for all the above attributes upon Create/Update/Delete operations

- All set, Run the app module, Create new row and see how the values are populated in DB table automatically.. ADF will take care of populating these values based on 'EffectiveDateMode'

   Thanks - I hope this may help.
             

How to generate Sequence Number using Groovy expression



Usecase : Generate a sequence number at entity level using Groovy expression
Solution : Goto Entity -> Select the attribute with 'Number' as data type -> Default Values -> Choose expression -> Paste below groovy expression ( Modify with your sequence name)

       

            (new oracle.jbo.server.SequenceImpl("XXATDTPR_AA_DET_S", adf.object.getDBTransaction())).getSequenceNumber()
       
 
(new oracle.jbo.server.SequenceImpl("EMPLOYEES_SEQ",adf.object.getDBTransaction())).getSequenceNumber()

Tuesday, September 18, 2012

How to use

Use case - Upon clicking on some button, Set a value to specific attribute

Solution : <af:setPropertyListener> component allows you to set a specific value to a attribute upon clicking on a button or changing a value for any component.

Ex :


              <af:commandButton text="Save" id="cb1"
                                action="#{pageFlowScope.EmployeeBean.addEmployee}"
                                immediate="true">
                <af:setPropertyListener from="#{bindings.EmpName.inputValue}"
                                        to="#{sessionScope.EmpName}"
                                        type="action"/>
              </af:commandButton>

from/to - This value can be anything, hard coded value, binding value or from any scope variable.


Wednesday, September 12, 2012

Filtering af:table Without Using ADF Model



I would like to share below URL, This is very useful especially if you want to perform 'Filter' on <af:table> component without using ADF Model.

http://jobinesh.blogspot.in/2012/03/filtering-aftable-without-using-adf.html


Tuesday, September 4, 2012

How to invoke various methods using Groovy Expressions

One of the interesting feature in ADF is using 'Groovy Expressions' , Using these expressions we can invoke various methods defined in ViewObjectImpl or Application Module Impl or access Application Module UserData session object

1. How to invoke a method defined in ViewObjectImpl class for a given specific attribute which is part of the same view object

You can define any method in ViewObject Impl something like as below

             public String getEmployeeName(){
                         return "EMP123"
             }

Define an attribute in a view object and modify its value (Groovy expression) as below
        adf.object.viewObject.getEmployeeName() - This will invoke the method defined in ViewObjectImpl class and hold the returned value.

2. How to access userData session object using Groovy expressions

Get the userData hash table in AM Impl class, and store whatever values you need as shown below

             Hashtable userData = getDBTransaction().getSession().getUserData();
             userData.put("employeeID","1234");

Use below groovy expression in any of the View objects which are part of respective application module , and access the data stored in userData session object.

          adf.userSession.userData.employeeID
Below is sample code how to get the user Session Data in App Module
Hashtable userdata = getDBTransaction().getSession().getUserData();

3. How to access a method defined in Application Module in any view object

    use below groovy expression in any of the view object which is part of respective application module
        adf.object.applicationModule.getEmployeeIDByName()

Monday, September 3, 2012

Jdeveloper Shortcut Keys

Below Jdeveloper Shortcut keys may helpful during development

1.If you have a larger application and you don't know specific class/object located , Go to Source of the file, then press Alt+Home button - This will take you to the corresponding project & Package where the selected file belongs.