use of io.divide.shared.transitory.TransientObject in project divide by HiddenStage.
the class DaoUtils method getUserById.
/**
* Convience method to do a Credentials query against an user id.
* @param serverDao dao object to query against.
* @param userId user id used in query.
* @return Credentials object found or null.
* @throws io.divide.shared.server.DAO.DAOException
*/
public static Credentials getUserById(DAO serverDao, String userId) throws DAO.DAOException {
Query query = new QueryBuilder().select().from(Credentials.class).where(Credentials.OWNER_ID_KEY, OPERAND.EQ, userId).build();
TransientObject to = (TransientObject) ObjectUtils.get1stOrNull(serverDao.query(query));
if (to == null) {
return null;
} else {
return to(Credentials.class, to);
}
}
Aggregations