Thursday, January 19, 2012

ADF 11G : How to Check the Existing User, Programatically?

Put the below code to AMImpl.java & Expose it as Client Interface:
------------------------------------------------------------------

public boolean isExistingUser(String userName,String password){
try {
ViewObjectImpl vo = getTestusersView1();
RowSetIterator itr = vo.createRowSetIterator(null);
while (itr.hasNext()) {
Row row = itr.next();
if (row.getAttribute("Username").equals(userName) &&
row.getAttribute("Password").equals(password)) {
return true;
} //end if


} //end while
} catch (Exception e) {
e.printStackTrace();
}
return false;
}