Hi,
Here am posting the code for applying Duplicate validation in ADF Applications through Java Bean. This can be used to check duplicate records in the oracle ADF Application.
If you have any Questions regarding the above code. Feel free to ask. :)
Here am posting the code for applying Duplicate validation in ADF Applications through Java Bean. This can be used to check duplicate records in the oracle ADF Application.
public void empIdValidator(FacesContext facesContext, UIComponent uIComponent, Object object) { if (object != null) { // 'am' is the applcation module ViewObjectImpl vo = am.getVo(); // To get current Row off the Vo Row cRow = vo.getCurrentRow(); // Create a Iterator to Iterate Over the ViewObject Vo // There is a also a method called vo.getRowSetIterator() but it is advised to use vo.createRowSetIterator(null) Integer count = 0; RowSetIterator rsi = vo.createRowSetIterator(null); while (rsi.hasNext()) { Row rw = rsi.next(); if (rw != cRow) { if (rw.getAttribute("EmpId") != null) { Integer empId = (Integer) rw.getAttribute("EmpId"); if (empId = (Integer) object) { count = 1; } } } } // Closing the iterator is advised after the use rsi.closeRowSetIterator(); if (count == 1) { FacesMessage message2 = new FacesMessage("Duplicate EmpId !"); message2.setSeverity(FacesMessage.SEVERITY_ERROR); throw new ValidatorException(message2); } } }
If you have any Questions regarding the above code. Feel free to ask. :)
Hi
ReplyDeleteit is validating for static value, can you provide us for dynamic value validation on page level, not on DB Level.
Sudheer