use of org.openforis.collect.persistence.UserDao.UserDSLContext in project collect by openforis.
the class UserDao method loadByUserName.
public User loadByUserName(String userName, Boolean enabled) {
UserDSLContext dsl = dsl();
SelectConditionStep<OfcUserRecord> query = dsl.selectFrom(OFC_USER).where(OFC_USER.USERNAME.equal(userName));
if (enabled != null) {
String enabledFlag = enabled ? "Y" : "N";
query.and(OFC_USER.ENABLED.equal(enabledFlag));
}
Record r = query.fetchOne();
User user = r != null ? dsl.fromRecord(r) : null;
return user;
}
use of org.openforis.collect.persistence.UserDao.UserDSLContext in project collect by openforis.
the class UserDao method getUserId.
public int getUserId(String username) {
UserDSLContext jf = dsl();
Record record = jf.select(OFC_USER.ID).from(OFC_USER).where(OFC_USER.USERNAME.equal(username)).fetchOne();
Integer id = record.getValue(OFC_USER.ID);
return id;
}
use of org.openforis.collect.persistence.UserDao.UserDSLContext in project collect by openforis.
the class UserDao method loadAll.
@Override
public List<User> loadAll() {
UserDSLContext dsl = dsl();
Result<OfcUserRecord> r = dsl.selectFrom(OFC_USER).orderBy(OFC_USER.USERNAME).fetch();
List<User> users = r != null ? dsl.fromResult(r) : null;
return users;
}
use of org.openforis.collect.persistence.UserDao.UserDSLContext in project collect by openforis.
the class UserDao method loadById.
@Override
public User loadById(Integer id) {
UserDSLContext dsl = dsl();
SelectQuery<?> query = dsl.selectByIdQuery(id);
Record r = query.fetchOne();
User user = r != null ? dsl.fromRecord(r) : null;
return user;
}
Aggregations