Friday 20 December 2013

Generate the DB sequence number without loosing

Generally we use sequence number in EntityImpl class create() method using the following code

       SequenceImpl seq=new SequenceImpl("EMPLOYEES_SEQ",getDBTransaction());
        setEmployeeId(seq.getSequenceNumber());

or we will set expression in default attribute of Entity Object xml file. If we follow this approach we will loose the sequence numbers. To avoid this use the following approach

Step 1: Go to entity object xml file  --> select the EmployeeID -- > go to defalu value and set -999 or -9999. Because the sequence number never reach the negetive value.


Step 2: Generate the java class for EO and override the doDML() method

    protected void doDML(int operation, TransactionEvent e) {
     
        if(operation==this.DML_INSERT){
            SequenceImpl seq=new SequenceImpl("EMPLOYEES_SEQ",getDBTransaction());
            this.setEmployeeId(seq.getSequenceNumber().intValue());
        }
        super.doDML(operation, e);
    }
   
Step 3: Run the application

Wednesday 18 December 2013

Populate dynamic Panel Accordion in ADF page

In this post i will show you how to create dynamic panel accordion. Sometimes you may get requirement to populate the accordion dynamically based on user login or some criteria.

Step1: Create the Business components on Department Table.



Step2: Create on jspx page --> go to data bindings and create Tree Bindings as shown below


Step3:  Add the data source DepartmentView1 and add the rule. Select the department name as shown below.




Step4: Drag and drop panel accordion on jspx page. Select the af:showDetailItem in structure window and surround with af:ForEach




Step5: Set the attributes in forEach tag as shown below.



Step6:  Change the Text attribute value to #{dept.DepartmentName} in af:showdetailsItem



Step7: Run the jspx page 




Tuesday 17 December 2013

Hiding unwanted operators in Advance mode of ADF Query Search

Sometimes you may get a requirement to hide the unwanted operators in advance mode of adf query search.
 I have created view criteria on employess table with FirstName. Now the requirment is i want to hide the BETWEEN and NOTBETWEEN operators for FirstName Field in advance search mode.
By using the below code you can hide the operators.

         <CompOper 
           Name="Name" 
           Oper="BETWEEN" 
           ToDo="-1" 
           MinCardinality="0" 
           MaxCardinality="0"/> 

Here is my view criteria code.

     <ViewCriteriaRow
      Name="EmployeesViewCriteria_row_0"
      UpperColumns="1">
      <ViewCriteriaItem
        Name="FirstName"
        ViewAttribute="FirstName"
        Operator="="
        Conjunction="AND"
        Value=":bFname"
        IsBindVarValue="true"
        Required="Optional">
         <CompOper 
           Name="Name" 
           Oper="BETWEEN" 
           ToDo="-1" 
           MinCardinality="0" 
           MaxCardinality="0"/> 
         <CompOper 
           Name="Name" 
           Oper="NOTBETWEEN" 
           ToDo="-1" 
           MinCardinality="0" 
           MaxCardinality="0"/>          

          
        </ViewCriteriaItem>
      <ViewCriteriaItem
        Name="LastName"
        ViewAttribute="LastName"
        Operator="="
        Conjunction="AND"
        Value=":bLname"
        IsBindVarValue="true"
        Required="Optional">
      
        </ViewCriteriaItem>
    </ViewCriteriaRow>