当前位置: 首页>>代码示例>>Java>>正文


Java Result类代码示例

本文整理汇总了Java中org.jooq.Result的典型用法代码示例。如果您正苦于以下问题:Java Result类的具体用法?Java Result怎么用?Java Result使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Result类属于org.jooq包,在下文中一共展示了Result类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getLocalesOfProvider

import org.jooq.Result; //导入依赖的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;
}
 
开发者ID:XMBomb,项目名称:InComb,代码行数:23,代码来源:ContentSourceDao.java

示例2: init

import org.jooq.Result; //导入依赖的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

示例3: getDeployments

import org.jooq.Result; //导入依赖的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

示例4: getOneopsEnvironments

import org.jooq.Result; //导入依赖的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

示例5: getActiveClouds

import org.jooq.Result; //导入依赖的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

示例6: shouldListAuthorsAndBooks

import org.jooq.Result; //导入依赖的package包/类
@Test
@DataSet("authors.yml,books.yml")
public void shouldListAuthorsAndBooks() {
    Result<?> result =
            DSL.using(connection)
                    .select(
                            Tables.AUTHOR.FIRST_NAME,
                            Tables.AUTHOR.LAST_NAME,
                            Tables.BOOK.ID,
                            Tables.BOOK.TITLE
                    )
                    .from(Tables.AUTHOR)
                    .join(Tables.BOOK)
                    .on(Tables.AUTHOR.ID.eq(Tables.BOOK.AUTHOR_ID))
                    .orderBy(Tables.BOOK.ID.asc())
                    .fetch();

    assertEquals(4, result.size());
}
 
开发者ID:database-rider,项目名称:database-rider,代码行数:20,代码来源:JooqDBUnitTest.java

示例7: read

import org.jooq.Result; //导入依赖的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

示例8: testBasicJooqSample

import org.jooq.Result; //导入依赖的package包/类
@Test
public void testBasicJooqSample() {
    CompanyDao companyDao = new CompanyDao(configuration());
    companyDao.findAll().stream().map(String::valueOf).forEach(log::info);

    Result<Record2<String, String>> results = dslContext()
            .select(COMPANY.ORGANISATIONNAME, USERPROFILE.EMAIL)
            .from(COMPANY)
            .join(USERPROFILE)
            .on(COMPANY.ID.eq(USERPROFILE.COMPANY_ID))
            .join(REGULARUSER)
            .on(REGULARUSER.ID.eq(USERPROFILE.ID))
            .fetch();

    // Loop and process results
}
 
开发者ID:MiguelGL,项目名称:jpa-samples-demo,代码行数:17,代码来源:SampleTest.java

示例9: main

import org.jooq.Result; //导入依赖的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

示例10: getSecretVersionsBySecretId

import org.jooq.Result; //导入依赖的package包/类
public Optional<ImmutableList<SecretContent>> getSecretVersionsBySecretId(long id,
    int versionIdx,
    int numVersions) {
  Result<SecretsContentRecord> r = dslContext.selectFrom(SECRETS_CONTENT)
      .where(SECRETS_CONTENT.SECRETID.eq(id))
      .orderBy(SECRETS_CONTENT.CREATEDAT.desc())
      .limit(versionIdx, numVersions)
      .fetch();

  if (r != null && r.isNotEmpty()) {
    ImmutableList.Builder<SecretContent> b = new ImmutableList.Builder<>();
    b.addAll(r.map(secretContentMapper));
    return Optional.of(b.build());
  } else {
    return Optional.empty();
  }
}
 
开发者ID:square,项目名称:keywhiz,代码行数:18,代码来源:SecretContentDAO.java

示例11: findAuthorsWithBooksJooqStreamedGroupBy

import org.jooq.Result; //导入依赖的package包/类
@Transactional(readOnly = true)
public Collection<AuthorWithBooks> findAuthorsWithBooksJooqStreamedGroupBy() {
	Result<Record> records = dslContext.select()
			.from(AUTHOR.leftOuterJoin(BOOK).on(BOOK.AUTHOR_ID.equal(AUTHOR.ID)))
			.fetch();

	Map<Long, List<Record>> collect = records.stream().collect(Collectors.groupingBy(r -> r.getValue(TAuthor.AUTHOR.ID)));

	return collect.entrySet().stream().map(e -> {
		AuthorWithBooks authorWithBooks = new AuthorWithBooks();
		authorWithBooks.setAuthor(authorRepository.mapper().map(e.getValue().get(0).into(TAuthor.AUTHOR)));
		List<Book> books = e.getValue().stream().map(r -> bookRepository.mapper().map(r.into(TBook.BOOK))).collect(Collectors.toList());
		authorWithBooks.setBooks(books);
		return authorWithBooks;
	}).collect(Collectors.toList());
}
 
开发者ID:nithril,项目名称:sandbox-query-benchmark-jooq-hibernate-jdbc,代码行数:17,代码来源:AuthorQueries.java

示例12: findAllUsers

import org.jooq.Result; //导入依赖的package包/类
public List<User> findAllUsers() {
    Result<Record2<String, String>> records = dsl.select(USER.USER_NAME, USER_ROLE.ROLE)
            .from(USER)
            .leftOuterJoin(USER_ROLE)
            .on(USER.USER_NAME.eq(USER_ROLE.USER_NAME))
            .fetch();

    Map<String, List<Record2<String, String>>> byUserName = records.stream()
            .collect(groupingBy(r -> r.getValue(USER.USER_NAME)));

    return byUserName.entrySet().stream()
            .map( entry -> ImmutableUser.builder()
                    .userName(entry.getKey())
                    .roles(entry.getValue()
                            .stream()
                            .map(record -> record.getValue(USER_ROLE.ROLE))
                            .filter(roleName -> roleName != null)
                            .map(roleName -> Role.valueOf(roleName))
                            .collect(Collectors.toList()))
                    .build())
            .collect(toList());
}
 
开发者ID:khartec,项目名称:waltz,代码行数:23,代码来源:UserRoleDao.java

示例13: getUserPassword

import org.jooq.Result; //导入依赖的package包/类
public String getUserPassword ( String email ) {
	synchronized (DBManager.class) {

		System.out.println("TEST1");

		Result<Record> result = create.select().from(USER).fetch();

		System.out.println("TEST2");

		for (Record r : result) {
			System.out.print("Is " + r.getValue(USER.EMAIL).toString() + " the same as " + email + "? ");
			if (r.getValue(USER.EMAIL).toString().compareTo(email) == 0)
				return r.getValue(USER.PASSWORD).toString();
			System.out.println("No... ");
		}

		return null;
	}

}
 
开发者ID:ethragur,项目名称:SMRTMS,代码行数:21,代码来源:DBManager.java

示例14: getUserID

import org.jooq.Result; //导入依赖的package包/类
public String getUserID ( String email ) {
	synchronized (DBManager.class) {
		Result<Record> result = create.select().from(USER).fetch();

		System.out.println(("Looking for User ID......"));
		for (Record r : result) {
			System.out.println("Is " + r.getValue(USER.EMAIL).toString() + " the same as " + email + "? ");
			if (r.getValue(USER.EMAIL).toString().compareTo(email) == 0) {
				System.out.println("Found User ID! Its " + r.getValue(USER.ID).toString());
				return r.getValue(USER.ID).toString();
			}
			System.out.println("No...");
		}

		System.out.println("========= ERROR: Couldn't find the User ID!!!! ========");
		return null;
	}
}
 
开发者ID:ethragur,项目名称:SMRTMS,代码行数:19,代码来源:DBManager.java

示例15: getUserIDviaName

import org.jooq.Result; //导入依赖的package包/类
public int getUserIDviaName ( String name ) {
	synchronized (DBManager.class) {
		Result<Record> result = create.select().from(USER).fetch();

		System.out.println(("Looking for User ID by checking name......"));
		for (Record r : result) {
			System.out.println("Is " + r.getValue(USER.USERNAME).toString() + " the same as " + name + "? ");
			if (r.getValue(USER.USERNAME).toString().compareTo(name) == 0) {
				System.out.println("Found User ID! Its " + r.getValue(USER.ID).toString());
				return r.getValue(USER.ID);
			}
			System.out.println("No...");
		}

		System.out.println("========= ERROR: Couldn't find the User ID!!!! ========");
		return -1;
	}
}
 
开发者ID:ethragur,项目名称:SMRTMS,代码行数:19,代码来源:DBManager.java


注:本文中的org.jooq.Result类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。