/** * With scan index forward flag. * @param fwd Forward flag * @return New query valve * @see QueryRequest#withScanIndexForward(Boolean) * @checkstyle AvoidDuplicateLiterals (5 line) */ public QueryValve withScanIndexForward(final boolean fwd) { return new QueryValve( this.limit, fwd, Arrays.asList(this.attributes), this.index, this.select, this.consistent ); }
/** * With scan index forward flag. * @param fwd Forward flag * @return New query valve * @see QueryRequest#withScanIndexForward(Boolean) * @checkstyle AvoidDuplicateLiterals (5 line) */ public QueryValve withScanIndexForward(final boolean fwd) { return new QueryValve( this.limit, fwd, Arrays.asList(this.attributes), this.index, this.select, this.consistent ); }
/** * With given limit. * @param lmt Limit to use * @return New query valve * @see QueryRequest#withLimit(Integer) * @checkstyle AvoidDuplicateLiterals (5 line) */ public QueryValve withLimit(final int lmt) { return new QueryValve( lmt, this.forward, Arrays.asList(this.attributes), this.index, this.select, this.consistent ); }
/** * With index name. * @param idx Index name * @return New query valve * @see QueryRequest#withIndexName(String) * @since 0.10.2 * @checkstyle AvoidDuplicateLiterals (5 line) */ public QueryValve withIndexName(final String idx) { return new QueryValve( this.limit, this.forward, Arrays.asList(this.attributes), idx, this.select, this.consistent ); }
/** * With consistent read. * @param cnst Consistent read * @return New query valve * @see QueryRequest#withConsistentRead(Boolean) * @since 0.12 * @checkstyle AvoidDuplicateLiterals (5 line) */ public QueryValve withConsistentRead(final boolean cnst) { return new QueryValve( this.limit, this.forward, Arrays.asList(this.attributes), this.index, this.select, cnst ); }
/** * With given limit. * @param lmt Limit to use * @return New query valve * @see QueryRequest#withLimit(Integer) * @checkstyle AvoidDuplicateLiterals (5 line) */ public QueryValve withLimit(final int lmt) { return new QueryValve( lmt, this.forward, Arrays.asList(this.attributes), this.index, this.select, this.consistent ); }
/** * With consistent read. * @param cnst Consistent read * @return New query valve * @see QueryRequest#withConsistentRead(Boolean) * @since 0.12 * @checkstyle AvoidDuplicateLiterals (5 line) */ public QueryValve withConsistentRead(final boolean cnst) { return new QueryValve( this.limit, this.forward, Arrays.asList(this.attributes), this.index, this.select, cnst ); }
/** * With index name. * @param idx Index name * @return New query valve * @see QueryRequest#withIndexName(String) * @since 0.10.2 * @checkstyle AvoidDuplicateLiterals (5 line) */ public QueryValve withIndexName(final String idx) { return new QueryValve( this.limit, this.forward, Arrays.asList(this.attributes), idx, this.select, this.consistent ); }
/** * With these extra attributes to pre-fetch. * @param names Name of attributes to pre-load * @return New query valve * @see QueryRequest#withAttributesToGet(Collection) * @checkstyle AvoidDuplicateLiterals (5 line) */ public QueryValve withAttributesToGet(final String... names) { return new QueryValve( this.limit, this.forward, Iterables.concat( Arrays.asList(this.attributes), Arrays.asList(names) ), this.index, this.select, this.consistent ); }
/** * With this extra attribute to pre-fetch. * @param name Name of attribute to pre-load * @return New query valve * @see QueryRequest#withAttributesToGet(Collection) * @checkstyle AvoidDuplicateLiterals (5 line) */ public QueryValve withAttributeToGet(final String name) { return new QueryValve( this.limit, this.forward, Iterables.concat( Arrays.asList(this.attributes), Collections.singleton(name) ), this.index, this.select, this.consistent ); }
/** * With this extra attribute to pre-fetch. * @param name Name of attribute to pre-load * @return New query valve * @see QueryRequest#withAttributesToGet(Collection) * @checkstyle AvoidDuplicateLiterals (5 line) */ public QueryValve withAttributeToGet(final String name) { return new QueryValve( this.limit, this.forward, Iterables.concat( Arrays.asList(this.attributes), Collections.singleton(name) ), this.index, this.select, this.consistent ); }
/** * With these extra attributes to pre-fetch. * @param names Name of attributes to pre-load * @return New query valve * @see QueryRequest#withAttributesToGet(Collection) * @checkstyle AvoidDuplicateLiterals (5 line) */ public QueryValve withAttributesToGet(final String... names) { return new QueryValve( this.limit, this.forward, Iterables.concat( Arrays.asList(this.attributes), Arrays.asList(names) ), this.index, this.select, this.consistent ); }
/** * With attributes to select. * @param slct Select to use * @return New query valve * @see QueryRequest#withSelect(Select) * @since 0.10.2 * @checkstyle AvoidDuplicateLiterals (5 line) */ public QueryValve withSelect(final Select slct) { return new QueryValve( this.limit, this.forward, Arrays.asList(this.attributes), this.index, slct.toString(), this.consistent ); }
/** * With attributes to select. * @param slct Select to use * @return New query valve * @see QueryRequest#withSelect(Select) * @since 0.10.2 * @checkstyle AvoidDuplicateLiterals (5 line) */ public QueryValve withSelect(final Select slct) { return new QueryValve( this.limit, this.forward, Arrays.asList(this.attributes), this.index, slct.toString(), this.consistent ); }
@Override @Cacheable(lifetime = 1, unit = TimeUnit.HOURS) public Counter get(final String name) { return new DyCounter( this.table.frame() .through(new QueryValve().withLimit(1)) .where(DyCounters.HASH, Conditions.equalTo(this.owner)) .where(DyCounters.RANGE, Conditions.equalTo(name)) .iterator() .next() ); }
@Override public void unlock(final String name) { Iterables.removeIf( this.table.frame() .through(new QueryValve()) .where(DyLocks.HASH, this.owner.toString()) .where(DyLocks.RANGE, name), Predicates.alwaysTrue() ); }
@Override public String label(final String name) throws IOException { final Iterator<Item> items = this.table.frame() .through(new QueryValve()) .where(DyLocks.HASH, this.owner.toString()) .where(DyLocks.RANGE, name) .iterator(); String msg = ""; if (items.hasNext()) { msg = items.next().get(DyLocks.ATTR_LABEL).getS(); } return msg; } }
@Override @Cacheable(forever = true) public boolean exists() { return this.region.table(DefaultUser.TOKENS) .frame().through(new QueryValve()) .where(DefaultUser.HASH, Conditions.equalTo(this.name)) .iterator().hasNext(); }
@Override @Cacheable.FlushAfter public void delete(final String name) { Iterators.removeIf( this.table.frame() .through(new QueryValve().withLimit(1)) .where(DyCounters.HASH, Conditions.equalTo(this.owner)) .where(DyCounters.RANGE, Conditions.equalTo(name)) .iterator(), Predicates.alwaysTrue() ); }
@Override @Cacheable(lifetime = 1, unit = TimeUnit.HOURS) public String token() throws IOException { final Iterator<Item> items = this.region.table(DefaultUser.TOKENS) .frame().through(new QueryValve()) .where(DefaultUser.HASH, Conditions.equalTo(this.name)) .iterator(); final String token; if (items.hasNext()) { token = items.next().get(DefaultUser.ATTR_TOKEN).getS(); } else { this.refresh(); token = this.token(); } return token; }