Showing posts with label VO. Show all posts
Showing posts with label VO. Show all posts

Tuesday, April 25, 2017

Check duplicate rows in View object ADF

    /**Method to check for duplicate rows
     * @param fileNm
     * @return
     */
    public String checkDuplicateRows(String fileNm) {
        ViewObject fileVo = this.getFileViewObject();
        Row duplFile[] = fileVo.getFilteredRows("FileName", fileNm);
        if (duplFile.length > 0) {
            return "Duplicate_Row_Exists";
        } else {
            return "No_Duplicate_Exists";
        }
    }

Other ways could be @ http://adfknowhow.blogspot.com/2015/01/how-to-filter-rows-in-vo.html

Wednesday, February 17, 2016

Check if the VO Row is updated! ADF


  • Add a Transient Attribute to the View Object (e.g Row Status(Integer / BigDecimal), make sure this attribute is made Updatable - Always)
  • Define the Row Impl for the VO
  • Getter method the row-

 
    /**
     * Gets the attribute value for the calculated attribute RowStatus.
     * @return the RowStatus
     */
    public Integer getRowStatus() {
        //return (Integer) getAttributeInternal(ROWSTATUS);
        byte entityState = this.getEntity(0).getEntityState();
        return new Integer(entityState);
    }
   

Integer values:
2 - Modified
0 - New
1 - Unmodified
-1 - Initialized 


// In the backingBean, We can update this row (e.g Last Updated by) only if the RowStatus is 2 













http://docs.oracle.com/cd/B14099_19/web.1012/b14022/oracle/jbo/server/EntityImpl.html

// Example
byte entityState= eo.getEntityState();
if(entityState==EntityImpl.STATUS_MODIFIED)
// .....