Search in sources :

Example 1 with OfcUserRecord

use of org.openforis.collect.persistence.jooq.tables.records.OfcUserRecord 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;
}
Also used : User(org.openforis.collect.model.User) UserDSLContext(org.openforis.collect.persistence.UserDao.UserDSLContext) OfcUserRecord(org.openforis.collect.persistence.jooq.tables.records.OfcUserRecord) Record(org.jooq.Record) OfcUserRecord(org.openforis.collect.persistence.jooq.tables.records.OfcUserRecord) OfcUserRoleRecord(org.openforis.collect.persistence.jooq.tables.records.OfcUserRoleRecord)

Example 2 with OfcUserRecord

use of org.openforis.collect.persistence.jooq.tables.records.OfcUserRecord 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;
}
Also used : User(org.openforis.collect.model.User) UserDSLContext(org.openforis.collect.persistence.UserDao.UserDSLContext) OfcUserRecord(org.openforis.collect.persistence.jooq.tables.records.OfcUserRecord)

Aggregations

User (org.openforis.collect.model.User)2 UserDSLContext (org.openforis.collect.persistence.UserDao.UserDSLContext)2 OfcUserRecord (org.openforis.collect.persistence.jooq.tables.records.OfcUserRecord)2 Record (org.jooq.Record)1 OfcUserRoleRecord (org.openforis.collect.persistence.jooq.tables.records.OfcUserRoleRecord)1