Monday, June 6, 2016

find out the comparsion between user modifed and DB stored value in ADF

Sometimes for drop down  we need to check current changed value with DB value.
so following are the steps to get DB value from EO:


1)From value changed Listener get column name and new value in managed bean



 public void countryIdChanged(ValueChangeEvent valueChangeEvent) {

 String newcountryId = valueChangeEvent.getNewValue().toString();

        OperationBinding executeVerifyActualColumnValue = ADFUtils.findOperation("verifyActualValue");//method return in VOImpl
        executeVerifyActualColumnValue.getParamsMap().put("columnName", countryid);
        executeVerifyActualColumnValue.getParamsMap().put("columnValue", newcountryId );
        executeVerifyActualColumnValue.execute();



2)in VOImpl write this method "verifyActualValue"

 public boolean verifyActualColumnValue(String columnName, String newcountryId ) {
 CountryVORowImpl currentRow = (CountryVORowImpl ) this.getCurrentRow();

GoalsEOImpl countryEntity = (CountryEOImpl) currentRow.getEntity(0);
 String oldColumnValue = null;                   
 oldColumnValue =
                        (String) countryEntity.getAttribute(countryEntity .COUNTRYID, countryEntity.ORIGINAL_VERSION);

//here oldColumnValue is DB Value and compare this value with DB Value

}


No comments:

Post a Comment