接口中定义的方法在抽象类中实现(二)

2014-11-24 07:40:06 · 作者: · 浏览: 1
es().add(role);

// function
sql = "select f.id funId,f.name funName,r.id resId,r.name resName from function f join resource r on f.resid = r.id and f.id in (select funid from role_function where roleid= )";
PreparedStatement funPstmt = db.prepare(conn, sql);
ResultSet funRs = db.getResult(funPstmt,
new Object[] { roleId });
Function function = null;
Resource resource = null;
while (funRs.next()) {
resource = new Resource();
long resId = funRs.getLong("resId");
String resName = funRs.getString("resName");
resource.setId(resId);
resource.setObject(resName);

String funName = funRs.getString("funName");

// 得到默认的操作
function = FunctionFactory.getDefaultFunction(funName,
resource);
role.getFunctions().add(function);
}
db.close(funPstmt, funRs);
}
db.close(rolePstmt, roleRs);
}
// db.close(conn, pstmt, rs);
db.close(pstmt, rs);

return user;

}

// public static void main(String[] args) throws SQLException,
// ClassNotFoundException {
// UserDAO dao = new UserDAO();
// dao.logger.debug("12") ;
// System.out.println(dao.conn);
// }

}


摘自 akwolf