Java Code Examples for org.jooq.Record1#value1()

The following examples show how to use org.jooq.Record1#value1() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SecretSeriesDAO.java    From keywhiz with Apache License 2.0 6 votes vote down vote up
public int setCurrentVersion(long secretId, long secretContentId, String updater, long now) {
  long checkId;
  Record1<Long> r = dslContext.select(SECRETS_CONTENT.SECRETID)
      .from(SECRETS_CONTENT)
      .where(SECRETS_CONTENT.ID.eq(secretContentId))
      .fetchOne();
  if (r == null) {
    throw new BadRequestException(
        String.format("The requested version %d is not a known version of this secret",
            secretContentId));
  }

  checkId = r.value1();
  if (checkId != secretId) {
    throw new IllegalStateException(String.format(
        "tried to reset secret with id %d to version %d, but this version is not associated with this secret",
        secretId, secretContentId));
  }

  return dslContext.update(SECRETS)
      .set(SECRETS.CURRENT, secretContentId)
      .set(SECRETS.UPDATEDBY, updater)
      .set(SECRETS.UPDATEDAT, now)
      .where(SECRETS.ID.eq(secretId))
      .execute();
}
 
Example 2
Source File: JooqJobActivityPublisherStore.java    From titus-control-plane with Apache License 2.0 5 votes vote down vote up
private long getInitialQueueIndex() {
    long startTimeMs = System.currentTimeMillis();
    Record1<Long> record = DSL.using(dslContext.configuration())
            .select(max(ACTIVITY_QUEUE.QUEUE_INDEX))
            .from(ACTIVITY_QUEUE)
            .fetchOne();
    databaseMetrics.registerSelectLatency(startTimeMs, ACTIVITY_QUEUE.getName(), Collections.emptyList());

    // No record is present, start index at 0
    if (null == record.value1()) {
        return 0;
    }
    // Otherwise start one higher than the current max
    return record.value1() + 1;
}
 
Example 3
Source File: UserDao.java    From waltz with Apache License 2.0 5 votes vote down vote up
public String getPassword(String userName) {
    Record1<String> possiblePassword = dsl.select(USER.PASSWORD)
            .from(USER)
            .where(USER.USER_NAME.equalIgnoreCase(userName))
            .fetchOne();

    if (possiblePassword != null) {
        return possiblePassword.value1();
    } else {
        return null;
    }
}