if (records.isEmpty()) { return SimpleTokenBackedResultsPage.create(null, ImmutableList.<RowResult<Set<Long>>>of(), false);
if (records.isEmpty()) { return SimpleTokenBackedResultsPage.create(null, ImmutableList.<RowResult<Value>>of(), false);
private Collection<Integer> extractIds(Result<Record> result, boolean categoryIds) { if (result.isEmpty()) { return null; } Collection<Integer> pageIds = new ArrayList<Integer>(); for(Record record : result) { pageIds.add(categoryIds ? record.getValue(Tables.CATEGORY_MEMBERS.CATEGORY_ID) : record.getValue(Tables.CATEGORY_MEMBERS.ARTICLE_ID) ); } return pageIds; }
private void putBatch(DSLContext ctx, TableReference tableRef, PutBatch batch, boolean allowReinserts) { InsertValuesStep4<Record, byte[], byte[], Long, byte[]> query = ctx.insertInto(table(tableName(tableRef)), field(ROW_NAME, byte[].class), field(COL_NAME, byte[].class), field(TIMESTAMP, Long.class), field(VALUE, byte[].class)); query = batch.addValuesForInsert(query); try { query.execute(); } catch (DataAccessException e) { if (allowReinserts) { Result<? extends Record> records = ctx .select(A_ROW_NAME, A_COL_NAME, A_TIMESTAMP, A_VALUE) .from(atlasTable(tableRef).as(ATLAS_TABLE)) .where(row(A_ROW_NAME, A_COL_NAME, A_TIMESTAMP).in(batch.getRowsForSelect())) .fetch(); if (records.isEmpty()) { throw e; } PutBatch nextBatch = batch.getNextBatch(records); if (nextBatch != null) { putBatch(ctx, tableRef, nextBatch, allowReinserts); return; } } throw new KeyAlreadyExistsException("Conflict on table " + tableRef, e); } }
public final R getReturnedRecord() { if (getReturnedRecords().isEmpty()) return null; return getReturnedRecords().get(0); }
private UniversalLinkGroup buildUniversalLinkGroup(Result<Record> result, boolean outlinks) throws DaoException { if (result == null || result.isEmpty()) { return null;
if (!returnedResult.isEmpty() || ctx.family() != HSQLDB) { result = returnedResult.size(); ctx.rows(result);
@Override public LocalLink getLink(Language language, int sourceId, int destId) throws DaoException { DSLContext context = getJooq(); try { Result<Record> result = context.select(). from(Tables.LOCAL_LINK). where(Tables.LOCAL_LINK.LANG_ID.eq(language.getId())). and(Tables.LOCAL_LINK.SOURCE_ID.eq(sourceId)). and(Tables.LOCAL_LINK.DEST_ID.eq(destId)). fetch(); //Work-around to avoid pages that have multiple links to the same page Record record; if (result.isEmpty()){ record = null; } else { record = result.get(0); } return buildLocalLink(record, true); } catch (RuntimeException e) { freeJooq(context); throw e; } }