zoukankan      html  css  js  c++  java
  • 校验基于EO的VO中的字段是否发生变化

    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.

    if(row.getEntity(0).getPostState()==2){

      //your logic 

    }

     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());

                  }

    最佳答案:

    ssue 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();

              }

         }

    参考资料:

    How to get Row Status of VO Rows

  • 相关阅读:
    如何制作Python百分比进度条
    如何按列表的元素中的第二个元素排序
    map的用法Python
    上一个问题增加用户名密码登陆
    最近alex买了个Tesla Model S,通过转账的形式,并且支付了5%的手续费,tesla价格为95万。账户文件为json,请用程序实现该提现行为。
    最近alex买了个Tesla Model S,通过转账的形式,并且支付了5%的手续费,tesla价格为95万。账户文件为json,请用程序实现该转账行为。
    写一个6位随机验证码程序,要求验证码中至少包含一个数字,一个小写字母,一个大写字母
    传统html和html5网页布局
    图片路径问题
    面向对象编程的一个形象比喻
  • 原文地址:https://www.cnblogs.com/huanghongbo/p/4903711.html
Copyright © 2011-2022 走看看