T
- public class FilterChain<T extends Model> extends Object implements Iterable<T>
Modifier and Type | Field and Description |
---|---|
protected ArrayList<io.stallion.dataAccess.filtering.FilterOperation> |
operations |
Constructor and Description |
---|
FilterChain(FilterChain chain,
LocalMemoryStash<T> stash) |
FilterChain(String bucket,
List<T> originalObjects,
io.stallion.dataAccess.filtering.FilterOperation op,
LocalMemoryStash<T> stash) |
FilterChain(String bucket,
List<T> originalObjects,
LocalMemoryStash<T> stash) |
FilterChain(String bucket,
LocalMemoryStash<T> stash) |
Modifier and Type | Method and Description |
---|---|
List<T> |
all()
Executes the filters and returns all matching items.
|
FilterChain<T> |
andAnyOf(List<String>... tuples) |
FilterChain<T> |
andAnyOf(Map<String,Object> allowedMatches) |
FilterChain<T> |
andAnyOf(Or... ors) |
protected boolean |
checkSkipCache(String key) |
protected FilterChain<T> |
cloneChainAndAddOperation(io.stallion.dataAccess.filtering.FilterOperation operation) |
<Y> List<Y> |
column(String name)
Executes the filters, and returns a list of all values of the given property name
for all matching objects.
|
int |
count()
Executes the filters and returns the total matching count.
|
List<FilterGroup<T>> |
countBy(String... fieldNames)
Count the objects matching this filter, grouped by fieldNames.
|
boolean |
empty()
Executes the filters and returns true if there are no matching items found.
|
FilterChain |
exclude(String name,
Object value)
Excludes all matching items instead of including them.
|
FilterChain |
exclude(String name,
Object value,
String op)
Excludes all matching items instead of including them.
|
FilterChain<T> |
excludeAnyOf(Or... ors) |
FilterChain |
excludeBy(String name,
Object value,
FilterOperator op)
Excludes all matching items instead of including them.
|
FilterChain<T> |
filter(String name,
Comparable value)
Do a basic equality filter.
|
FilterChain<T> |
filter(String name,
Comparable value,
String op) |
FilterChain<T> |
filter(String name,
Object val)
Do a basic equality filter
|
FilterChain<T> |
filter(String name,
Object value,
String op)
Add a filter to the chain
|
FilterChain<T> |
filterBy(String name,
Comparable value,
FilterOperator op)
Add a filter to the chain with a custom operator
|
FilterChain<T> |
filterBy(String name,
Object value,
FilterOperator op)
Add a filter to the chain with a custom operator
|
T |
first()
Executes the filters and returns the first matching item.
|
void |
forEach(Consumer<? super T> action) |
String |
getBucket() |
protected Object |
getCached(String methodName) |
String |
getExtraCacheKey() |
Boolean |
getIncludeDeleted() |
protected Integer |
getMatchingCount() |
protected List<T> |
getObjects() |
ArrayList<io.stallion.dataAccess.filtering.FilterOperation> |
getOperations() |
SortDirection |
getSortDirection() |
String |
getSortField() |
List<FilterGroup<T>> |
groupBy(String... fieldNames)
Group the matching objects by field names.
|
FilterChain<T> |
includeDeleted() |
boolean |
isEmpty()
Alias for empty(), no matching items.
|
Iterator<T> |
iterator() |
protected FilterChain<T> |
newCopy()
Create a copy this filter chain.
|
Pager |
pager(Integer page)
Alias for pager(page, 10) (default page size of 10);
|
Pager |
pager(Integer page,
Integer size)
Executes the filters and returns a pager object.
|
protected void |
process()
Alias for process(0, 100000, false)
|
protected void |
process(int page,
int size,
boolean fetchTotalMatching)
Actually applies all filters and sorts to reduce the originalObjects into
a subset of matched objects.
|
FilterChain<T> |
search(String value,
String... fields)
Searches for @value in all @fields, using a case-insensitive
string contains search.
|
protected void |
setBucket(String bucket) |
protected void |
setCached(String methodName,
Object val) |
protected void |
setExtraCacheKey(String extraCacheKey) |
protected FilterChain<T> |
setIncludeDeleted(Boolean includeDeleted) |
protected void |
setMatchingCount(Integer matchingCount) |
protected void |
setObjects(List<T> objects) |
protected void |
setSortDirection(SortDirection sortDirection) |
protected void |
setSortField(String sortField) |
FilterChain<T> |
sort(String fieldName,
String direction)
Adds a sort direction the filter chain response.
|
FilterChain<T> |
sortBy(String fieldName,
SortDirection direction)
Adds a sort direction the filter chain response.
|
Spliterator<T> |
spliterator() |
protected ArrayList<io.stallion.dataAccess.filtering.FilterOperation> operations
public FilterChain(String bucket, LocalMemoryStash<T> stash)
public FilterChain(String bucket, List<T> originalObjects, LocalMemoryStash<T> stash)
public FilterChain(String bucket, List<T> originalObjects, io.stallion.dataAccess.filtering.FilterOperation op, LocalMemoryStash<T> stash)
public FilterChain(FilterChain chain, LocalMemoryStash<T> stash)
public FilterChain<T> filter(String name, Object val)
name
- val
- public FilterChain<T> filter(String name, Comparable value)
name
- value
- public FilterChain<T> filter(String name, Object value, String op)
name
- value
- op
- public FilterChain<T> filter(String name, Comparable value, String op)
public FilterChain<T> filterBy(String name, Object value, FilterOperator op)
name
- value
- op
- public FilterChain<T> filterBy(String name, Comparable value, FilterOperator op)
name
- value
- op
- public FilterChain<T> search(String value, String... fields)
value
- value
- public FilterChain exclude(String name, Object value)
name
- value
- public FilterChain exclude(String name, Object value, String op)
name
- value
- op
- public FilterChain excludeBy(String name, Object value, FilterOperator op)
name
- value
- op
- public FilterChain<T> andAnyOf(List<String>... tuples)
public FilterChain<T> andAnyOf(Or... ors)
public FilterChain<T> excludeAnyOf(Or... ors)
protected FilterChain<T> cloneChainAndAddOperation(io.stallion.dataAccess.filtering.FilterOperation operation)
protected FilterChain<T> newCopy()
public List<FilterGroup<T>> countBy(String... fieldNames)
fieldNames
- public List<FilterGroup<T>> groupBy(String... fieldNames)
fieldNames
- public boolean empty()
public boolean isEmpty()
public <Y> List<Y> column(String name)
Y
- name
- public int count()
public FilterChain<T> sort(String fieldName, String direction)
fieldName
- direction
- - either asc or descpublic FilterChain<T> sortBy(String fieldName, SortDirection direction)
fieldName
- direction
- public Pager pager(Integer page)
page
- public Pager pager(Integer page, Integer size)
page
- - which page to returnsize
- - how many items are on a pageprotected void process()
protected void process(int page, int size, boolean fetchTotalMatching)
page
- - the page to start from when returning resultssize
- - the number of results per page (the number of results to return)fetchTotalMatching
- - hydrate the total matching count field, even if
we are returning a subetprotected boolean checkSkipCache(String key)
public Spliterator<T> spliterator()
spliterator
in interface Iterable<T extends Model>
public String getSortField()
protected void setSortField(String sortField)
public SortDirection getSortDirection()
protected void setSortDirection(SortDirection sortDirection)
public String getExtraCacheKey()
protected void setExtraCacheKey(String extraCacheKey)
public Boolean getIncludeDeleted()
protected FilterChain<T> setIncludeDeleted(Boolean includeDeleted)
public FilterChain<T> includeDeleted()
public ArrayList<io.stallion.dataAccess.filtering.FilterOperation> getOperations()
protected Integer getMatchingCount()
protected void setMatchingCount(Integer matchingCount)
protected List<T> getObjects()
protected void setObjects(List<T> objects)
Copyright © 2016. All rights reserved.