當前位置: 首頁>>代碼示例>>Java>>正文


Java Record類代碼示例

本文整理匯總了Java中org.jooq.Record的典型用法代碼示例。如果您正苦於以下問題:Java Record類的具體用法?Java Record怎麽用?Java Record使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Record類屬於org.jooq包,在下文中一共展示了Record類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getCombItems

import org.jooq.Record; //導入依賴的package包/類
/**
 * Returns all {@link News} where a {@link CombItem} of the given {@link User} exists.
 * The News are sorted by the add_date descending.
 * @param userId the {@link User} to get the {@link CombItem}s.
 * @param onlyUnread if <code>true</code> only {@link CombItem} with no read_date
 * 			will be returned.
 * @return {@link List} containing {@link News}.
 */
public List<News> getCombItems(final long userId, final boolean onlyUnread) {
	final SelectConditionStep<Record> sql = DSL.using(jooqConfig).
			select().
			from(COMB_ITEM_TABLE.
				join(CONTENT_TABLE).
					on(COMB_ITEM_TABLE.CONTENT_ID.eq(CONTENT_TABLE.ID)).
				join(NEWS_TABLE).
					on(CONTENT_TABLE.ID.eq(NEWS_TABLE.CONTENT_ID))).
			where(COMB_ITEM_TABLE.USER_ID.eq(userId));

	if(onlyUnread) {
		sql.and(COMB_ITEM_TABLE.READ_DATE.isNull());
	}

	return sql.orderBy(COMB_ITEM_TABLE.ADD_DATE.desc()).
			fetchInto(News.class);
}
 
開發者ID:XMBomb,項目名稱:InComb,代碼行數:26,代碼來源:CombItemDao.java

示例2: notExists

import org.jooq.Record; //導入依賴的package包/類
private ValidationResult notExists(final DSLContext context, final ColumnPermutation lhs,
    final ColumnPermutation rhs) {

  final Table<Record> lhsAlias = context.select(fields(lhs))
      .from(tables(lhs))
      .where(notNull(lhs))
      .asTable();

  final int violators = context.selectCount().from(
      selectFrom(lhsAlias).whereNotExists(
          context.selectOne()
              .from(tables(rhs))
              .where(row(fields(rhs)).eq(row(lhsAlias.fields())))
      ).limit(1)
  ).fetchOne().value1();

  return new DefaultValidationResult(violators == 0);
}
 
開發者ID:HPI-Information-Systems,項目名稱:AdvancedDataProfilingSeminar,代碼行數:19,代碼來源:Queries.java

示例3: setUp

import org.jooq.Record; //導入依賴的package包/類
public void setUp() throws Exception {
  connection = DriverManager.getConnection("jdbc:hsqldb:mem:myDb");
  context = DSL.using(connection, SQLDialect.HSQLDB, new Settings().withRenderNameStyle(
      RenderNameStyle.AS_IS));

  final List<Field<String>> fields = getFields();

  context.createTable(relationName)
      .columns(fields)
      .execute();

  try (InputStream in = resourceClass.getResourceAsStream(csvPath)) {
    final Loader<Record> loader = context.loadInto(table(name(relationName)))
        .loadCSV(in)
        .fields(fields)
        .execute();

    assertThat(loader.errors()).isEmpty();
  }
}
 
開發者ID:HPI-Information-Systems,項目名稱:AdvancedDataProfilingSeminar,代碼行數:21,代碼來源:TestDatabase.java

示例4: init

import org.jooq.Record; //導入依賴的package包/類
private void init(Connection conn) {
    DSLContext create = DSL.using(conn, SQLDialect.POSTGRES);
    Result<Record> coresAttributes = create.select().from(MD_CLASS_ATTRIBUTES)
    .join(MD_CLASSES).on(MD_CLASS_ATTRIBUTES.CLASS_ID.eq(MD_CLASSES.CLASS_ID))
    .where(MD_CLASSES.CLASS_NAME.like("bom%Compute"))
    .and(MD_CLASS_ATTRIBUTES.ATTRIBUTE_NAME.eq("cores")).fetch();

    for (Record coresAttribute : coresAttributes) {
        coresAttributeIds.add(coresAttribute.getValue(MD_CLASS_ATTRIBUTES.ATTRIBUTE_ID));
    }

    create = DSL.using(conn, SQLDialect.POSTGRES);
    Result<Record> computeClasses = create.select().from(MD_CLASSES)
            .where(MD_CLASSES.CLASS_NAME.like("bom%Compute")).fetch();
    for (Record computeClass : computeClasses) {
        computeClassIds.add(computeClass.get(MD_CLASSES.CLASS_ID));
    }
    log.info("cached compute class ids: " + computeClassIds);
    log.info("cached compute cores attribute ids: " + coresAttributeIds);
}
 
開發者ID:oneops,項目名稱:oneops,代碼行數:21,代碼來源:CMSCrawler.java

示例5: getDeployments

import org.jooq.Record; //導入依賴的package包/類
private List<Deployment> getDeployments(Connection conn, Environment env) {

        List<Deployment> deployments = new ArrayList<>();
        DSLContext create = DSL.using(conn, SQLDialect.POSTGRES);
        Result<Record> records = create.select().from(DJ_DEPLOYMENT)
                .join(DJ_DEPLOYMENT_STATES).on(DJ_DEPLOYMENT_STATES.STATE_ID.eq(DJ_DEPLOYMENT.STATE_ID))
                .join(NS_NAMESPACES).on(NS_NAMESPACES.NS_ID.eq(DJ_DEPLOYMENT.NS_ID))
                .where(NS_NAMESPACES.NS_PATH.eq(env.getPath()+ "/" + env.getName() + "/bom"))
                .and(DJ_DEPLOYMENT.CREATED_BY.notEqual("oneops-autoreplace"))
                .orderBy(DJ_DEPLOYMENT.CREATED.desc())
                .limit(1)
                .fetch();
        for (Record r : records) {
            Deployment deployment = new Deployment();
            deployment.setCreatedAt(r.getValue(DJ_DEPLOYMENT.CREATED));
            deployment.setCreatedBy(r.getValue(DJ_DEPLOYMENT.CREATED_BY));
            deployment.setState(r.getValue(DJ_DEPLOYMENT_STATES.STATE_NAME));
            deployments.add(deployment);
        }
        return deployments;
    }
 
開發者ID:oneops,項目名稱:oneops,代碼行數:22,代碼來源:CMSCrawler.java

示例6: getOneopsEnvironments

import org.jooq.Record; //導入依賴的package包/類
private List<Environment> getOneopsEnvironments(Connection conn) {
    List<Environment> envs = new ArrayList<>();
    DSLContext create = DSL.using(conn, SQLDialect.POSTGRES);
    log.info("Fetching all environments..");
    Result<Record> envRecords = create.select().from(CM_CI)
            .join(MD_CLASSES).on(CM_CI.CLASS_ID.eq(MD_CLASSES.CLASS_ID))
            .join(NS_NAMESPACES).on(CM_CI.NS_ID.eq(NS_NAMESPACES.NS_ID))
            .where(MD_CLASSES.CLASS_NAME.eq("manifest.Environment"))
            .fetch(); //all the env cis
    log.info("Got all environments");
    for (Record r : envRecords) {
        long envId = r.getValue(CM_CI.CI_ID);
        //now query attributes for this env
        Environment env = new Environment();
        env.setName(r.getValue(CM_CI.CI_NAME));
        env.setId(r.getValue(CM_CI.CI_ID));
        env.setPath(r.getValue(NS_NAMESPACES.NS_PATH));
        env.setNsId(r.getValue(NS_NAMESPACES.NS_ID));
        envs.add(env);
    }
    return envs;
}
 
開發者ID:oneops,項目名稱:oneops,代碼行數:23,代碼來源:CMSCrawler.java

示例7: getActiveClouds

import org.jooq.Record; //導入依賴的package包/類
private List<String> getActiveClouds(Platform platform, Connection conn) {
    DSLContext create = DSL.using(conn, SQLDialect.POSTGRES);
    List<String> clouds = new ArrayList<>();
    Result<Record> consumesRecords = create.select().from(CM_CI_RELATIONS)
            .join(MD_RELATIONS).on(MD_RELATIONS.RELATION_ID.eq(CM_CI_RELATIONS.RELATION_ID))
            .join(CM_CI_RELATION_ATTRIBUTES).on(CM_CI_RELATION_ATTRIBUTES.CI_RELATION_ID.eq(CM_CI_RELATIONS.CI_RELATION_ID))
            .where(CM_CI_RELATIONS.FROM_CI_ID.eq(platform.getId()))
            .and(CM_CI_RELATION_ATTRIBUTES.DF_ATTRIBUTE_VALUE.eq("active"))
            .fetch();
    for (Record r : consumesRecords) {
        String comments = r.getValue(CM_CI_RELATIONS.COMMENTS);
        String cloudName = comments.split(":")[1];
        cloudName = cloudName.split("\"")[1];
        clouds.add(cloudName);
    }
    return clouds;
}
 
開發者ID:oneops,項目名稱:oneops,代碼行數:18,代碼來源:CMSCrawler.java

示例8: getKeyType

import org.jooq.Record; //導入依賴的package包/類
/**
 * Copied from JavaGenerator
 * @param key
 * @return
 */
protected String getKeyType(UniqueKeyDefinition key){
    String tType;

    List<ColumnDefinition> keyColumns = key.getKeyColumns();

    if (keyColumns.size() == 1) {
        tType = getJavaType(keyColumns.get(0).getType());
    }
    else if (keyColumns.size() <= Constants.MAX_ROW_DEGREE) {
        String generics = "";
        String separator = "";

        for (ColumnDefinition column : keyColumns) {
            generics += separator + (getJavaType(column.getType()));
            separator = ", ";
        }

        tType = Record.class.getName() + keyColumns.size() + "<" + generics + ">";
    }
    else {
        tType = Record.class.getName();
    }

    return tType;
}
 
開發者ID:jklingsporn,項目名稱:vertx-jooq-async,代碼行數:31,代碼來源:AbstractVertxGenerator.java

示例9: getModelObjWithSpares

import org.jooq.Record; //導入依賴的package包/類
@Override
public ModelWrapper getModelObjWithSpares(long id) throws Exception {
    List<SpareWrapper> spares = jooq.select().from(Spares.SPARES)
        .join(Brands.BRANDS).on(Brands.BRANDS.ID.eq(Spares.SPARES.BRAND_ID))
        .join(SpareToModel.SPARE_TO_MODEL)
        .on(SpareToModel.SPARE_TO_MODEL.SPARE_ID.eq(Spares.SPARES.ID))
        .where(SpareToModel.SPARE_TO_MODEL.MODEL_ID.eq(id))
        .fetch(SpareWrapper::of);

    Record record = jooq.select().from(Models.MODELS)
        .join(Series.SERIES).on(Series.SERIES.ID.eq(Models.MODELS.SERIES_ID))
        .join(Brands.BRANDS).on(Brands.BRANDS.ID.eq(Series.SERIES.BRAND_ID))
        .where(Models.MODELS.ID.eq(id))
        .fetchOne();

    ModelWrapper model = new ModelWrapper(record);
    model.setSpares(spares);

    return model;
}
 
開發者ID:rumatoest,項目名稱:jdblender,代碼行數:21,代碼來源:RunnerJooq.java

示例10: getSpares

import org.jooq.Record; //導入依賴的package包/類
@Override
public Collection<SpareWrapper> getSpares(String label, Boolean flag, Integer numFromInclusive, Integer numToInclusive) throws Exception {
    SelectQuery<Record> query = jooq.selectQuery();
    query.addFrom(Spares.SPARES);

    if (label != null) {
        query.addConditions(Spares.SPARES.LABEL.eq(label));
    }

    if (flag != null) {
        query.addConditions(Spares.SPARES.FLAG.eq(flag));
    }

    if (numFromInclusive != null) {

        if (numToInclusive == null) {
            query.addConditions(Spares.SPARES.NUM.eq(numFromInclusive));
        } else {
            query.addConditions(Spares.SPARES.NUM.ge(numFromInclusive));
            query.addConditions(Spares.SPARES.NUM.le(numToInclusive));
        }
    }

    return query.fetch(SpareWrapper::of);
}
 
開發者ID:rumatoest,項目名稱:jdblender,代碼行數:26,代碼來源:RunnerJooq.java

示例11: merageRecord

import org.jooq.Record; //導入依賴的package包/類
private Map<String, Object> merageRecord(Record originalRecord, E freshEntity) {

		try {
			Map<String, Object> originalMap = this.converMap(originalRecord);
			Map<String, Object> freshMap = Mapper.object2Map(freshEntity);
			logger.debug("freshMap:{} ", freshMap);
			for (String oriKey : originalMap.keySet()) {
				Object oriValue = originalMap.get(oriKey);
				Object freshValue = freshMap.get(oriKey);
				if (freshValue == null && oriValue != null) {
					freshMap.put(oriKey, oriValue);
				} else if (freshValue == null && oriValue == null) {
					freshMap.remove(oriKey);
				} else if (freshValue.equals(oriValue)) {
					freshMap.remove(oriKey);
				}
			}
			logger.debug("change freshMap:{} ", freshMap);
			return freshMap;
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		}

		return null;
	}
 
開發者ID:SmallBadFish,項目名稱:practice,代碼行數:26,代碼來源:JooqMysqlProvider.java

示例12: testNewContext

import org.jooq.Record; //導入依賴的package包/類
@Test
public void testNewContext() {

    BQRuntime runtime = stack.app("--config=classpath:test.yml")
            .autoLoadModules()
            .createRuntime();

    try (DSLContext c = runtime.getInstance(JooqFactory.class).newContext()) {

        c.createTable(Tables.TEST_TABLE).columns(Tables.TEST_TABLE.fields()).execute();

        c.delete(Tables.TEST_TABLE).execute();
        c.insertInto(Tables.TEST_TABLE).set(Tables.TEST_TABLE.ID, 4).set(Tables.TEST_TABLE.NAME, "me").execute();
        Record r = c.select().from(Tables.TEST_TABLE).fetchOne();
        assertNotNull(r);
        assertEquals(Integer.valueOf(4), r.get(Tables.TEST_TABLE.ID));
        assertEquals("me", r.get(Tables.TEST_TABLE.NAME));
    }
}
 
開發者ID:bootique,項目名稱:bootique-jooq,代碼行數:20,代碼來源:JooqModuleIT.java

示例13: getDependencies

import org.jooq.Record; //導入依賴的package包/類
@Override
public List<DependencyLink> getDependencies(long endTs, @Nullable Long lookback) {
  try (Connection conn = datasource.getConnection()) {
    if (hasPreAggregatedDependencies.get()) {
      List<Date> days = getDays(endTs, lookback);
      List<DependencyLink> unmerged = context.get(conn)
          .selectFrom(ZIPKIN_DEPENDENCIES)
          .where(ZIPKIN_DEPENDENCIES.DAY.in(days))
          .fetch((Record l) -> DependencyLink.create(
              l.get(ZIPKIN_DEPENDENCIES.PARENT),
              l.get(ZIPKIN_DEPENDENCIES.CHILD),
              l.get(ZIPKIN_DEPENDENCIES.CALL_COUNT))
          );
      return DependencyLinker.merge(unmerged);
    } else {
      return aggregateDependencies(endTs, lookback, conn);
    }
  } catch (SQLException e) {
    throw new RuntimeException("Error querying dependencies for endTs " + endTs + " and lookback " + lookback + ": " + e.getMessage());
  }
}
 
開發者ID:liaominghua,項目名稱:zipkin,代碼行數:22,代碼來源:MySQLSpanStore.java

示例14: read

import org.jooq.Record; //導入依賴的package包/類
@NotNull
public List<PurpleCopyNumber> read(@NotNull final String sample) {
    List<PurpleCopyNumber> copyNumbers = Lists.newArrayList();

    Result<Record> result = context.select().from(COPYNUMBER).where(COPYNUMBER.SAMPLEID.eq(sample)).fetch();

    for (Record record : result) {
        copyNumbers.add(ImmutablePurpleCopyNumber.builder()
                .chromosome(record.getValue(COPYNUMBER.CHROMOSOME))
                .start(record.getValue(COPYNUMBER.START))
                .end(record.getValue(COPYNUMBER.END))
                .bafCount(record.getValue(COPYNUMBER.BAFCOUNT))
                .method(CopyNumberMethod.valueOf(record.getValue(COPYNUMBER.COPYNUMBERMETHOD)))
                .segmentStartSupport(SegmentSupport.valueOf(record.getValue(COPYNUMBER.SEGMENTSTARTSUPPORT)))
                .segmentEndSupport(SegmentSupport.valueOf(record.getValue(COPYNUMBER.SEGMENTENDSUPPORT)))
                .averageActualBAF(record.getValue(COPYNUMBER.ACTUALBAF))
                .averageObservedBAF(record.getValue(COPYNUMBER.OBSERVEDBAF))
                .averageTumorCopyNumber(record.getValue(COPYNUMBER.COPYNUMBER_))
                .build());
    }

    Collections.sort(copyNumbers);
    return copyNumbers;
}
 
開發者ID:hartwigmedical,項目名稱:hmftools,代碼行數:25,代碼來源:CopyNumberDAO.java

示例15: main

import org.jooq.Record; //導入依賴的package包/類
public static void main(String[] args) throws Exception {
    String user = System.getProperty("jdbc.user");
    String password = System.getProperty("jdbc.password");
    String url = System.getProperty("jdbc.url");
    String driver = System.getProperty("jdbc.driver");

    Class.forName(driver).newInstance();
    try (Connection connection = DriverManager.getConnection(url, user, password)) {
        DSLContext dslContext = DSL.using(connection, SQLDialect.MYSQL);
        Result<Record> result = dslContext.select().from(AUTHOR).fetch();

        for (Record r : result) {
            Integer id = r.getValue(AUTHOR.ID);
            String firstName = r.getValue(AUTHOR.FIRST_NAME);
            String lastName = r.getValue(AUTHOR.LAST_NAME);

            System.out.println("ID: " + id + " first name: " + firstName + " last name: " + lastName);
        }
    }
    catch (Exception e) {
        e.printStackTrace();
    }
}
 
開發者ID:hellokoding,項目名稱:jooq-mysql,代碼行數:24,代碼來源:Application.java


注:本文中的org.jooq.Record類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。