Wednesday, August 29, 2012

PPR On Radio Group



Steps to Create Properties View Object (PVO)
1.       Project à New ADF Business Components àView Object
2.       Specify the Name of View Object as XXTestPVO and give the corresponding package name
3.       Select Rows Populated Automatically Not Based on Query.
4.       Click Next after Step 3 , click on New and create the transient variables
5.       Create one attribute main_Attr of Type String
Select KeyAttribute ,passivate and Updatable always
6.       Create two other attributes display_rn1, display_rn2  of Type Boolean
Select Passivate and updatable always
7.       Click on Next , again Next , Select  Generate Java File , click on Next and then Finish
8.       Click on XXTestPVO and click on Tuning and select including all Transient Variables if it is not checked
9.       Now Attach it to PageAM 


Steps to implement PPR on Radio Group

1.       Create a Properties View Object (XXTestPVO) .create one Transient attribute (main_Attr) of String Type, Boolean Type Attributes as per requirement.(In Above case we created two display_rn1, display_rn2  )
2.       Since we are implementing PPR on a radiogroup item create a dummy VO
TO CREATE dummy VO Follow the below steps ;
i.                     Create a table using the following query : create table xxdummy (dummycol varchar2(30))
ii.                   Insert into xxdummy(‘abc’),insert into xxdummy(‘def’)
iii.                  Now use select dummycol from xxdummy as query and create VO , give the name as XXTestVO
iv.                 Attach it to pageAM


3.       Provide Itemname, ItemStyle, Picklist View Instance, Picklist Display Attribute , Picklist View Attribute ,Action, Event Name and parameters ,Rendered property for the item which you want to take do PPR in the Property Pallette.
Eg:
     Item Name: radGrpItm
   Item Style: MessageRadioGroup
 Picklist View Instance : XXTestVO1
Picklist Display Attribute: dummycol
Picklist View Attribute: dummycol
Action type : Fire Partial Action
     Event Name : PPREvt
     Under parameters
    Name : PPRParam
    Value : ${oa. XXTestPVO1. dummycol }
   RenderedProperty: ${oa. XXTestPVO1. main_Attr }
4.       In the Page Region 1 set Rendered as ${oa. XXTestPVO1. display_rn1 }
5.       In the Page Region 2 set rendered as ${oa. XXTestPVO1.display_rn2 }

Process Request of the CO :
      am.invokeMethod("initPPR");
Process Form Request of the CO:

     //Code for PPR
     if("PPREvt ".equals(pageContext.getParameter(OAWebBeanConstants.EVENT_PARAM)))
{
       String radioGroupValue = pageContext.getParameter("radGrpItm "); 
System.out.println("radio group value is :"+radioGroupValue);
   
    if(radioGroupValue!=null)
    {
    System.out.println("radioGroupValue is not null , going to AM method ");
    Serializable rgvS[]={radioGroupValue};
    System.out.println("serializable value of radio button passing to AM is :"+ rgvS);
    am.invokeMethod("execPPR", rgvS);
    System.out.println("back to Co after executing payePPR method in AM");
   
    }
     }



AMImpl

  public void initPPR ()
   {
     System.out.println("in initPPR ---am");
  
     OAViewObject pvo =
       (OAViewObject)findViewObject("XXTestPVO1");
    
     pvo.executeQuery();
    
     OAViewObject vo = (OAViewObject)findViewObject("XXTestPVO1");
     if (vo.getFetchedRowCount() == 0)
      vo.setMaxFetchSize(0);
     
     XXTestPVORowImpl pprrow= (     XXTestPVO RowImpl)vo.createRow();
     pprrow.setNewRowState(OARow.STATUS_INITIALIZED);
     vo.insertRow(pprrow);
 pprrow.setAttribute("main_Attr", Boolean.TRUE);
 pprrow.setAttribute("display_rn1", Boolean.TRUE);
pprrow.setAttribute("display_rn2", Boolean.FALSE);
   }
   public void execPPR(String param)
   {
     System.out.println("inside execPPR method with payee name :"+ param);
      OAViewObject vo = (OAViewObject)findViewObject("XXTestPVO1");
     if (vo.getFetchedRowCount() == 0)
      vo.setMaxFetchSize(0);
XXTestPVORowImpl pprrow= (XXTestPVORowImpl)vo.createRow();
vo.insertRow(pprrow);
     pprrow.setNewRowState(OARow.STATUS_INITIALIZED);

     
     if ("abc’".equals(param))
      {
      System.out.println("value is abc");
pprrow.setAttribute("main_Attr", Boolean.TRUE);
 pprrow.setAttribute("display_rn1", Boolean.TRUE);
pprrow.setAttribute("display_rn2", Boolean.FALSE);
      }
    else  if ("def".equals(param))
      
      {      
        System.out.println("value is def”);
pprrow.setAttribute("main_Attr", Boolean.TRUE);
 pprrow.setAttribute("display_rn1", Boolean.FALSE);
pprrow.setAttribute("display_rn2", Boolean.TRUE);
      }
   }

regards
Rekha Kasyap .





No comments: