use of jooq.steve.db.tables.records.UserRecord in project steve by RWTH-i5-IDSG.
the class UserRepositoryImpl method getDetails.
@Override
public User.Details getDetails(int userPk) {
// -------------------------------------------------------------------------
// 1. user table
// -------------------------------------------------------------------------
UserRecord ur = ctx.selectFrom(USER).where(USER.USER_PK.equal(userPk)).fetchOne();
if (ur == null) {
throw new SteveException("There is no user with id '%s'", userPk);
}
// -------------------------------------------------------------------------
// 2. address table
// -------------------------------------------------------------------------
AddressRecord ar = addressRepository.get(ctx, ur.getAddressPk());
// -------------------------------------------------------------------------
// 3. ocpp_tag table
// -------------------------------------------------------------------------
String ocppIdTag = null;
if (ur.getOcppTagPk() != null) {
Record1<String> record = ctx.select(OCPP_TAG.ID_TAG).from(OCPP_TAG).where(OCPP_TAG.OCPP_TAG_PK.eq(ur.getOcppTagPk())).fetchOne();
if (record != null) {
ocppIdTag = record.value1();
}
}
return User.Details.builder().userRecord(ur).address(ar).ocppIdTag(Optional.ofNullable(ocppIdTag)).build();
}
Aggregations