@Test public void addBucketConstraintsWithWhereForMultipleBuckets() throws Exception { buckets.add(makeBucket("orid2")); StringBuilder query = new StringBuilder(); underTest.addBucketConstraints(null, buckets, query); assertThat(query.toString(), is(equalTo(" where (bucket=orid or bucket=orid2)"))); }
protected void addBucketConstraints(@Nullable final String whereClause, @Nullable final Iterable<Bucket> buckets, final StringBuilder query) { if (buckets != null && !isEmpty(buckets)) { if (whereClause == null) { query.append(" where "); } else { query.append(" and "); } query.append('('); Joiner.on(" or ").appendTo(query, Iterables.transform(buckets, bucket -> String.format("%s=%s", P_BUCKET, bucketEntityAdapter.recordIdentity(bucket).toString()) )); query.append(')'); } }
MetadataNodeEntityAdapter extends IterableEntityAdapter<T> { protected void addBucketConstraints(@Nullable final String whereClause, @Nullable final Iterable<Bucket> buckets, final StringBuilder query) { if (buckets != null && !isEmpty(buckets)) { if (whereClause == null) { query.append(" where "); } else { query.append(" and "); } query.append('('); Joiner.on(" or ").appendTo(query, Iterables.transform(buckets, bucket -> String.format("%s=%s", P_BUCKET, bucketEntityAdapter.recordIdentity(bucket).toString()) )); query.append(')'); } } }
MetadataNodeEntityAdapter extends IterableEntityAdapter<T> { protected void addBucketConstraints(@Nullable final String whereClause, @Nullable final Iterable<Bucket> buckets, final StringBuilder query) { if (buckets != null && !isEmpty(buckets)) { if (whereClause == null) { query.append(" where "); } else { query.append(" and "); } query.append('('); Joiner.on(" or ").appendTo(query, Iterables.transform(buckets, bucket -> String.format("%s=%s", P_BUCKET, bucketEntityAdapter.recordIdentity(bucket).toString()) )); query.append(')'); } } MetadataNodeEntityAdapter(final String typeName, final BucketEntityAdapter bucketEntityAdapter); }
MetadataNodeEntityAdapter extends IterableEntityAdapter<T> { protected void addBucketConstraints(@Nullable final String whereClause, @Nullable final Iterable<Bucket> buckets, final StringBuilder query) { if (buckets != null && !isEmpty(buckets)) { if (whereClause == null) { query.append(" where "); } else { query.append(" and "); } query.append('('); Joiner.on(" or ").appendTo(query, Iterables.transform(buckets, bucket -> String.format("%s=%s", P_BUCKET, bucketEntityAdapter.recordIdentity(bucket).toString()) )); query.append(')'); } } MetadataNodeEntityAdapter(final String typeName, final BucketEntityAdapter bucketEntityAdapter);  }
MetadataNodeEntityAdapter extends IterableEntityAdapter<T> { protected void addBucketConstraints(@Nullable final String whereClause, @Nullable final Iterable<Bucket> buckets, final StringBuilder query) { if (buckets != null && !isEmpty(buckets)) { if (whereClause == null) { query.append(" where "); } else { query.append(" and "); } query.append('('); Joiner.on(" or ").appendTo(query, Iterables.transform(buckets, bucket -> String.format("%s=%s", P_BUCKET, bucketEntityAdapter.recordIdentity(bucket).toString()) )); query.append(')'); } } MetadataNodeEntityAdapter(final String typeName, final BucketEntityAdapter bucketEntityAdapter);  static final String P_ATTRIBUTES; static final String P_BUCKET; static final String P_FORMAT; static final String P_NAME; }