当前位置: 首页>>代码示例>>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;未经允许,请勿转载。