Java 类org.jooq.Record1 实例源码

项目:InComb    文件:ContentSourceDao.java   
/**
 * 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;
}
项目:InComb    文件:UserDao.java   
/**
 * 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);
}
项目:InComb    文件:UserDao.java   
/**
 * 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;
}
项目:InComb    文件:NewsDao.java   
/**
 * 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);
}
项目:steve-plugsurfing    文件:OcppServerRepositoryImpl.java   
@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());
}
项目:steve-plugsurfing    文件:ChargePointRepositoryImpl.java   
@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);
}
项目:steve-plugsurfing    文件:EvcoIdRepositoryImpl.java   
@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);
}
项目:steve-plugsurfing    文件:EvcoIdRepositoryImpl.java   
private static Optional<String> getOptional(Record1<String> record) {
    if (record == null) {
        return Optional.absent();
    } else {
        return Optional.fromNullable(record.value1());
    }
}
项目:steve-plugsurfing    文件:SessionRepositoryImpl.java   
@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();
}
项目:steve-plugsurfing    文件:SessionRepositoryImpl.java   
@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());
}
项目:steve-plugsurfing    文件:SessionRepositoryImpl.java   
@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;
}
项目:steve-plugsurfing    文件:StationRepositoryImpl.java   
@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;
}
项目:steve-plugsurfing    文件:StationRepositoryImpl.java   
@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());
    }
}
项目:steve-plugsurfing    文件:StationRepositoryImpl.java   
@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;
}
项目:steve-plugsurfing    文件:OcppExternalTagRepositoryImpl.java   
@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;
}
项目:steve-plugsurfing    文件:OcppExternalTagRepositoryImpl.java   
@Override
public boolean isExternal(String rfid) {
    Record1<Integer> externalAndActive =
            ctx.select(OCPP_TAG.OCPP_TAG_PK)
               .from(OCPP_TAG)
               .join(PS_OCPP_TAG).on(OCPP_TAG.OCPP_TAG_PK.eq(PS_OCPP_TAG.OCPP_TAG_PK))
               .where(OCPP_TAG.ID_TAG.eq(rfid))
               // since we mark the user as blocked/unblocked in the ocpp tag table based
               // on the response from PS (see PlugSurfingAuthenticator.verifyRfid())
               // we need to check this constraint !
               .and(OCPP_TAG.BLOCKED.isFalse())
               .fetchOne();

    return externalAndActive != null;
}
项目:steve-plugsurfing    文件:ConnectorRepositoryImpl.java   
@Override
public int getConnectorPkFromTransactionPk(int transactionPK) {
    Record1<Integer> recordId = ctx.select(CONNECTOR.CONNECTOR_PK)
                                   .from(CONNECTOR)
                                   .join(TRANSACTION)
                                   .on(CONNECTOR.CONNECTOR_PK.eq(TRANSACTION.CONNECTOR_PK))
                                   .where(TRANSACTION.TRANSACTION_PK.eq(transactionPK))
                                   .fetchOne();
    if (recordId == null) {
        throw new SteveException("No such PK for given transactionPK : %s", transactionPK);
    }
    return recordId.value1();
}
项目:steve-plugsurfing    文件:ConnectorRepositoryImpl.java   
private List<Integer> getDiscoveredConnPks(Condition chargeBoxSelectCondition) {
    return ctx.selectDistinct(CONNECTOR.CONNECTOR_PK)
              .from(CONNECTOR)
              .join(CHARGE_BOX).on(CHARGE_BOX.CHARGE_BOX_ID.eq(CONNECTOR.CHARGE_BOX_ID))
              .join(PS_CHARGEBOX).on(PS_CHARGEBOX.CHARGE_BOX_PK.eq(CHARGE_BOX.CHARGE_BOX_PK))
              .where(chargeBoxSelectCondition)
              .and(CONNECTOR.CONNECTOR_ID.notEqual(0))
              .fetch()
              .map(Record1::value1);
}
项目:redpipe    文件:PagesRecord.java   
/**
 * {@inheritDoc}
 */
@Override
public Record1<Integer> key() {
    return (Record1) super.key();
}
项目:SA-Jericho    文件:CategoriesRecord.java   
/**
 * {@inheritDoc}
 */
@Override
public Record1<Integer> key() {
    return (Record1) super.key();
}
项目:SA-Jericho    文件:JokesRecord.java   
/**
 * {@inheritDoc}
 */
@Override
public Record1<Integer> key() {
    return (Record1) super.key();
}
项目:vertx-zero    文件:SecUserRecord.java   
/**
 * {@inheritDoc}
 */
@Override
public Record1<String> key() {
    return (Record1) super.key();
}
项目:oneops    文件:CrawlEntitiesRecord.java   
/**
 * {@inheritDoc}
 */
@Override
public Record1<Long> key() {
    return (Record1) super.key();
}
项目:oneops    文件:DjRfcCiRecord.java   
/**
 * {@inheritDoc}
 */
@Override
public Record1<Long> key() {
    return (Record1) super.key();
}
项目:oneops    文件:CmsVarsRecord.java   
/**
 * {@inheritDoc}
 */
@Override
public Record1<Long> key() {
    return (Record1) super.key();
}
项目:oneops    文件:CmOpsActionsRecord.java   
/**
 * {@inheritDoc}
 */
@Override
public Record1<Long> key() {
    return (Record1) super.key();
}
项目:oneops    文件:CmsCiEventQueueRecord.java   
/**
 * {@inheritDoc}
 */
@Override
public Record1<Long> key() {
    return (Record1) super.key();
}
项目:oneops    文件:MdClassAttributesRecord.java   
/**
 * {@inheritDoc}
 */
@Override
public Record1<Integer> key() {
    return (Record1) super.key();
}
项目:oneops    文件:DjReleasesRecord.java   
/**
 * {@inheritDoc}
 */
@Override
public Record1<Long> key() {
    return (Record1) super.key();
}
项目:oneops    文件:NsOptTagRecord.java   
/**
 * {@inheritDoc}
 */
@Override
public Record1<Long> key() {
    return (Record1) super.key();
}
项目:oneops    文件:CmsEventTypeRecord.java   
/**
 * {@inheritDoc}
 */
@Override
public Record1<Integer> key() {
    return (Record1) super.key();
}
项目:oneops    文件:MdRelationsRecord.java   
/**
 * {@inheritDoc}
 */
@Override
public Record1<Integer> key() {
    return (Record1) super.key();
}
项目:oneops    文件:CmOpsProceduresRecord.java   
/**
 * {@inheritDoc}
 */
@Override
public Record1<Long> key() {
    return (Record1) super.key();
}
项目:oneops    文件:CmCiAttributesRecord.java   
/**
 * {@inheritDoc}
 */
@Override
public Record1<Long> key() {
    return (Record1) super.key();
}
项目:oneops    文件:MdRelationAttributesRecord.java   
/**
 * {@inheritDoc}
 */
@Override
public Record1<Integer> key() {
    return (Record1) super.key();
}
项目:oneops    文件:CmOpsActionStateRecord.java   
/**
 * {@inheritDoc}
 */
@Override
public Record1<Integer> key() {
    return (Record1) super.key();
}
项目:oneops    文件:CmCiRecord.java   
/**
 * {@inheritDoc}
 */
@Override
public Record1<Long> key() {
    return (Record1) super.key();
}
项目:oneops    文件:CmCiStateRecord.java   
/**
 * {@inheritDoc}
 */
@Override
public Record1<Integer> key() {
    return (Record1) super.key();
}
项目:oneops    文件:MdClassRelationsRecord.java   
/**
 * {@inheritDoc}
 */
@Override
public Record1<Integer> key() {
    return (Record1) super.key();
}
项目:oneops    文件:DjRfcRelationRecord.java   
/**
 * {@inheritDoc}
 */
@Override
public Record1<Long> key() {
    return (Record1) super.key();
}