本文整理匯總了Java中org.jooq.Record1類的典型用法代碼示例。如果您正苦於以下問題:Java Record1類的具體用法?Java Record1怎麽用?Java Record1使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Record1類屬於org.jooq包,在下文中一共展示了Record1類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getLocalesOfProvider
import org.jooq.Record1; //導入依賴的package包/類
/**
* Fetches all {@link Locale}s for which {@link ContentSource}s
* of the given {@link Provider} are available.
*
* @param providerId
* @return a List (never null) with the {@link Locale}s.
*/
public List<Locale> getLocalesOfProvider(final int providerId) {
final Result<Record1<String>> result = DSL.using(jooqConfig).
select(TABLE.LOCALE).
from(TABLE).
where(TABLE.PROVIDER_ID.eq(providerId)).
groupBy(TABLE.LOCALE).
fetch();
final List<Locale> locales = new ArrayList<>();
for (final String localeStr : result.getValues(TABLE.LOCALE)) {
locales.add(LocaleUtil.toLocale(localeStr));
}
return locales;
}
示例2: getLastId
import org.jooq.Record1; //導入依賴的package包/類
/**
* Returns the greatest news id.
* Can be used to get the auto incremented value after a {@link News} was inserted.
*/
private long getLastId() {
final Record1<Long> result = DSL.using(jooqConfig).
select(TABLE_CONTENT.ID).
from(TABLE_CONTENT).
orderBy(TABLE_CONTENT.ID.desc()).
limit(0, 1).
fetchOne();
return result == null ? 0 : result.getValue(TABLE_CONTENT.ID);
}
示例3: getIdForUsername
import org.jooq.Record1; //導入依賴的package包/類
/**
* Returns the user id for the given username.
* @param username the username to find the {@link User}.
* @return the id of the {@link User}.
*/
private long getIdForUsername(final String username) {
final Record1<Long> idRecord = DSL.using(jooqConfig).
select(TABLE.ID).
from(TABLE).
where(TABLE.USERNAME.eq(username)).
fetchOne();
if(idRecord == null) {
return 0;
}
return idRecord.getValue(TABLE.ID);
}
示例4: recordExists
import org.jooq.Record1; //導入依賴的package包/類
/**
* Checks if a {@link User} exists with the given value in the given field.
* @return <code>true</code> if a {@link User} exists.
*/
@Override
public boolean recordExists(final String fieldName, final Object value) {
final Record1<Integer> count = DSL.using(jooqConfig).
select(DSL.count()).
from(TABLE).
where(DSL.fieldByName(fieldName).eq(value)).
fetchOne();
return count.getValue(0, int.class) > 0;
}
示例5: updateTransaction
import org.jooq.Record1; //導入依賴的package包/類
@Override
public void updateTransaction(UpdateTransactionParams p) {
// -------------------------------------------------------------------------
// Step 1: Update transaction table
//
// After update, a DB trigger sets the user.inTransaction field to 0
// -------------------------------------------------------------------------
ctx.update(TRANSACTION)
.set(TRANSACTION.STOP_TIMESTAMP, p.getStopTimestamp())
.set(TRANSACTION.STOP_VALUE, p.getStopMeterValue())
.where(TRANSACTION.TRANSACTION_PK.equal(p.getTransactionId()))
.and(TRANSACTION.STOP_TIMESTAMP.isNull())
.and(TRANSACTION.STOP_VALUE.isNull())
.execute();
// -------------------------------------------------------------------------
// Step 2: Set connector status back to "Available" again
// -------------------------------------------------------------------------
SelectConditionStep<Record1<Integer>> connectorPkQuery =
DSL.select(TRANSACTION.CONNECTOR_PK)
.from(TRANSACTION)
.where(TRANSACTION.TRANSACTION_PK.equal(p.getTransactionId()));
insertConnectorStatus(connectorPkQuery, p.getStopTimestamp(), p.getStatusUpdate());
}
示例6: isRegistered
import org.jooq.Record1; //導入依賴的package包/類
@Override
public boolean isRegistered(String chargeBoxId) {
Record1<Integer> r = ctx.selectOne()
.from(CHARGE_BOX)
.where(CHARGE_BOX.CHARGE_BOX_ID.eq(chargeBoxId))
.fetchOne();
return (r != null) && (r.value1() == 1);
}
示例7: getOcppIdTag
import org.jooq.Record1; //導入依賴的package包/類
@Override
public Optional<String> getOcppIdTag(String evcoId) {
Record1<String> record = ctx.select(OCPP_TAG.ID_TAG)
.from(PS_EVCO_ID)
.join(OCPP_TAG).on(PS_EVCO_ID.OCPP_ID_TAG.eq(OCPP_TAG.ID_TAG))
.where(PS_EVCO_ID.EVCO_ID.eq(evcoId))
.fetchOne();
return getOptional(record);
}
示例8: getOptional
import org.jooq.Record1; //導入依賴的package包/類
private static Optional<String> getOptional(Record1<String> record) {
if (record == null) {
return Optional.absent();
} else {
return Optional.fromNullable(record.value1());
}
}
示例9: getOcppTagOfActiveTransaction
import org.jooq.Record1; //導入依賴的package包/類
@Override
public String getOcppTagOfActiveTransaction(int transactionPK) {
Record1<String> record = ctx.select(TRANSACTION.ID_TAG)
.from(TRANSACTION)
.where(TRANSACTION.TRANSACTION_PK.eq(transactionPK))
.and(TRANSACTION.STOP_TIMESTAMP.isNull())
.and(TRANSACTION.STOP_VALUE.isNull())
.fetchOne();
if (record == null) {
return null;
}
return record.value1();
}
示例10: getSessionPkFromTransactionPk
import org.jooq.Record1; //導入依賴的package包/類
@Override
public Optional<Integer> getSessionPkFromTransactionPk(int transactionPK) {
Record1<Integer> record = ctx.select(PS_SESSION.PS_SESSION_PK)
.from(PS_SESSION)
.where(PS_SESSION.TRANSACTION_PK.eq(transactionPK))
.fetchOne();
if (record == null) {
return Optional.absent();
}
return Optional.fromNullable(record.value1());
}
示例11: hasNoSession
import org.jooq.Record1; //導入依賴的package包/類
@Override
public boolean hasNoSession(String rfid) {
Record1<Integer> record = ctx.selectOne()
.from(PS_SESSION)
.where(PS_SESSION.OCPP_TAG_PK.eq(ctx.select(OCPP_TAG.OCPP_TAG_PK)
.from(OCPP_TAG)
.where(OCPP_TAG.ID_TAG.eq(rfid))))
.and(PS_SESSION.TRANSACTION_PK.isNull())
.and(PS_SESSION.EVENT_STATUS.notEqual(SessionStatus.EXPIRED.name()))
.fetchOne();
return record == null;
}
示例12: isExternal
import org.jooq.Record1; //導入依賴的package包/類
@Override
public boolean isExternal(String chargeBoxIdentity) {
Record1<Integer> record = ctx.select(PS_CHARGEBOX.CHARGE_BOX_PK)
.from(PS_CHARGEBOX)
.join(CHARGE_BOX).on(CHARGE_BOX.CHARGE_BOX_PK.eq(PS_CHARGEBOX.CHARGE_BOX_PK))
.where(CHARGE_BOX.CHARGE_BOX_ID.eq(chargeBoxIdentity))
.and(PS_CHARGEBOX.IS_ENABLED.isTrue())
.fetchOne();
return record != null;
}
示例13: getConnectorsNumber
import org.jooq.Record1; //導入依賴的package包/類
@Override
public Optional<Integer> getConnectorsNumber(String chargeBoxIdentity) {
Record1<Integer> record = ctx.select(PS_CHARGEBOX.NUMBER_OF_CONNECTORS)
.from(PS_CHARGEBOX)
.join(CHARGE_BOX).on(CHARGE_BOX.CHARGE_BOX_PK.eq(PS_CHARGEBOX.CHARGE_BOX_PK))
.where(CHARGE_BOX.CHARGE_BOX_ID.eq(chargeBoxIdentity))
.fetchOne();
if (record == null) {
return Optional.absent();
} else {
return Optional.of(record.value1());
}
}
示例14: isPosted
import org.jooq.Record1; //導入依賴的package包/類
@Override
public boolean isPosted(String chargeBoxIdentity) {
Record1<DateTime> dt = ctx.select(PS_CHARGEBOX.POST_TIMESTAMP)
.from(PS_CHARGEBOX)
.join(CHARGE_BOX).on(CHARGE_BOX.CHARGE_BOX_PK.eq(PS_CHARGEBOX.CHARGE_BOX_PK))
.where(CHARGE_BOX.CHARGE_BOX_ID.eq(chargeBoxIdentity))
.fetchOne();
return dt != null && dt.value1() != null;
}
示例15: isLocal
import org.jooq.Record1; //導入依賴的package包/類
@Override
public boolean isLocal(String rfid) {
Record1<Integer> onlyLocal = ctx.selectOne()
.from(OCPP_TAG)
.leftOuterJoin(PS_OCPP_TAG)
.on(OCPP_TAG.OCPP_TAG_PK.eq(PS_OCPP_TAG.OCPP_TAG_PK))
.where(PS_OCPP_TAG.OCPP_TAG_PK.isNull())
.and(OCPP_TAG.ID_TAG.eq(rfid))
.fetchOne();
return onlyLocal != null;
}