This discussion is archived
8 Replies Latest reply: Sep 30, 2013 1:50 AM by Adnan.Salim RSS

How to get Row Status of VO Rows

Adnan.Salim Newbie
Currently Being Moderated

Hi,

 

I have a table region and there are multiple records fetching from a Entity based VO. Now I have updated one row or any of row, I require to display once changed records on next page. How can I display? I want to capture row status type thing while pressing the save button.

 

Thank you.

  • 1. Re: How to get Row Status of VO Rows
    Sushant Sharma Expert
    Currently Being Moderated

    If row is MODIFIED then entity status is "STATUS_MODIFIED".

    If row is NEW then entity status is "STATUS_NEW".

    row.getEntityState() method is there for EO based VO.

     

    --Sushant

  • 2. Re: How to get Row Status of VO Rows
    Adnan.Salim Newbie
    Currently Being Moderated

    I am using below code @ a button in PFR. but this getEntityState method not found in row. Any idea or am I doing something wrong?

     

              OAViewObject EmpPhoneVO = (OAViewObject)am.findViewObject("xxPerPhonesVO1");

              int empPhoneRowCnt = EmpPhoneVO.getRowCount();

              EmpPhoneVO.first();

              for (int i=1; i<=empPhoneRowCnt; i++){

                 OARow empPhoneRow = (OARow)EmpPhoneVO.getCurrentRow();

                 //gettting row status

                 empPhoneRow.getEntityState();

                 EmpPhoneVO.next();

              }

  • 3. Re: How to get Row Status of VO Rows
    Sushant Sharma Expert
    Currently Being Moderated

    Use like this:

    empPhoneRow.getxxPerPhonesEO().getEntityState()


    --Sushant


  • 4. Re: How to get Row Status of VO Rows
    Adnan.Salim Newbie
    Currently Being Moderated

    Thanks Sushant.... but I am unable to get this method in getxxPerPhonesEO() in empPhoneRow ? Any idea? I checked that VORowImpl file, there getxxPerPhonesEO() is exist.

  • 5. Re: How to get Row Status of VO Rows
    Sushant Sharma Expert
    Currently Being Moderated

    Try this:

    for (int i=1; i<=empPhoneRowCnt; i++){

                xxPerPhonesVORowImpl empPhoneRow = (xxPerPhonesVORowImpl)EmpPhoneVO.getCurrentRow();

                 //gettting row status

                 empPhoneRow.getxxPerPhonesEO().getEntityState();

     

    --Sushant

  • 6. Re: How to get Row Status of VO Rows
    Adnan.Salim Newbie
    Currently Being Moderated

    I am using below but getting exception on System.out.println("Row Status : " + updatedRow.getxxPerPhonesEO().getEntityState());

     

                 //getting updated rows

                  xxPerPhonesVORowImpl updatedRow = (xxPerPhonesVORowImpl)EmpContactsVO.getCurrentRow();          

                  System.out.println("Row Status : " + updatedRow.getxxPerPhonesEO().getEntityState());

                  if(updatedRow.getxxPerPhonesEO().getEntityState() == EntityImpl.STATUS_NEW  ) {

                      System.out.println("Row Status : Row # " + i + " : Modified value : "  + updatedRow.getEntity(0).getEntityState());

                  }

                 // Ends here

  • 7. Re: How to get Row Status of VO Rows
    Adnan.Salim Newbie
    Currently Being Moderated

    Found on helpful document but still have some issues;

     

    http://www.iwidi.org/index.php/ot-operation-theatere-for-oaf/ot-operation-theatere-for-oaf-child/19-an-analysis-of-entity-objects-eo

     

    Both of below always return 1 ... I don't know why...

     

     

                  System.out.println("Post : Row Status : " + empPhoneRow.getxxPerPhonesEO().getPostState());

                  System.out.println("Pre  : Row Status : " + empPhoneRow.getxxPerPhonesEO().getEntityState());

  • 8. Re: How to get Row Status of VO Rows
    Adnan.Salim Newbie
    Currently Being Moderated

    Issue resolved by creating a new field (IS_SUBMITTED) in database table to Flag the record status with the default value as N (update all the existing records if there are any in the table);

     

    Step 1 : Go to properties on your EO and navigate to Java and check Data Manipulation

    Step 2 : Go to your EOImpl class and search for doDML method

    Step 3 : Under doDML method add below code to set EO Attribute value;

     

                if (getIsSubmitted().equals("N")) {

                setIsSubmitted("M"); //where as M stands for Modified

                }

     

    Step 4 : Under your Controller Class @ PFR, write code for loop and set the attribute status like below;

     

          OAApplicationModule am = pageContext.getApplicationModule(webBean);

          if (pageContext.getParameter("SubmitButton") != null ) {

             am.invokeMethod("apply");   //saving the records so the EOImpl will set the is_submitted to 'M' wherever the record modified state found

             OAViewObject EmpPhoneVO = (OAViewObject)am.findViewObject("xxPerPhonesVO1");

             int empPhoneRowCnt = EmpPhoneVO.getRowCount();

             EmpPhoneVO.first();

             for (int i=1; i<=empPhoneRowCnt; i++){

                 OARow empPhoneRow = (OARow)EmpPhoneVO.getCurrentRow();

                 String lPhoneValidated = "Y";

                 // your validation if any

                 if (lPhoneValidated.equals("Y")) {


                     System.out.println("IsSubimtted After Get : " + empPhoneRow.getAttribute("IsSubmitted"));

                     if (empPhoneRow.getAttribute("IsSubmitted").equals("M")){

                         empPhoneRow.setAttribute("IsSubmitted","S");

                     }

                     System.out.println("IsSubimtted After Set : " + empPhoneRow.getAttribute("IsSubmitted"));

                     OAException submitMessage = new OAException("Employee Contact Details : Row # " + i +  " : Submitted for Approval to Employee Relation Officer.",

                                                    OAException.CONFIRMATION  );

                     pageContext.putDialogMessage(submitMessage);

                 }

                 EmpPhoneVO.next();

              }

         }


    regards,

    adnan..

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points