本文整理汇总了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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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());
}
示例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;
}
示例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
}
示例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();
}
}
示例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();
}
}
示例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());
}
示例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());
}
示例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;
}
}
示例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;
}
}
示例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;
}
}