Tuesday, December 25, 2018

createRowSetIterator vs getAllRowsInRange

--------------------createRowSetIterator----------------------------   

    Map sessionScope=  ADFContext.getCurrent().getSessionScope();
        String passOrFailVal = (String)sessionScope.get("passOrFailVal");
        if("P".equalsIgnoreCase(passOrFailVal)){
        System.out.println("wf actiondt at wf before save CommonCode.getCurrentDate();  " +
                           CommonCode.getCurrentDate());
        ViewObject vo = CommonCode.getAM().findViewObject("PiProdPriceDefnVO2");
        RowSetIterator rowSetIter = vo.createRowSetIterator(null);
        oracle.jbo.domain.Date currentDate = CommonCode.getCurrentDate();
        while(rowSetIter.hasNext()){
            Row rw = rowSetIter.next();
            oracle.jbo.domain.Timestamp vldtodt = (oracle.jbo.domain.Timestamp)rw.getAttribute("ValidToDt");
            System.out.println(vldtodt+" with time  "+currentDate+" vldtodt.compareTo(currentDate) "+vldtodt.compareTo(currentDate)+" currentDate.compareTo(vldtodt) "+currentDate.compareTo(vldtodt));
            if(vldtodt.compareTo(currentDate)<0){
                CommonCode.errmsg("Valid to date expired", "");
                return false;
            }
        }
       
        rowSetIter.closeRowSetIterator();
        }

--------------------getAllRowsInRange----------------------------


         Row[] r = vo.getAllRowsInRange();
        for (int i = 0; i < r.length; i++) {
            oracle.jbo.domain.Timestamp vldtodt = (oracle.jbo.domain.Timestamp)r[i].getAttribute("ValidToDt");
            oracle.jbo.domain.Date currentDate = CommonCode.getCurrentDate();
            oracle.jbo.domain.Timestamp other = null;
            java.sql.Date sqlvldtodt = null;
            java.sql.Date currentdt = null;
            try {
                sqlvldtodt = vldtodt.dateValue();
                currentdt = currentDate.dateValue();
            } catch (SQLException e) {
            }
            System.out.println(currentdt+" without time sql dates before "+sqlvldtodt);
            System.out.println(vldtodt+" with time  "+currentDate+" vldtodt.compareTo(currentDate) "+vldtodt.compareTo(currentDate)+" currentDate.compareTo(vldtodt) "+currentDate.compareTo(vldtodt));
            //if (currentdt.before(sqlvldtodt)) {
            if(vldtodt.compareTo(currentDate)<0){
                CommonCode.errmsg("Valid to date expired", "");
                return false;
            }
            System.out.println("vldtodt at before wfsave " + vldtodt);
        } 

No comments:

Post a Comment