argos/dmp-backend/queryable/src/main/java/eu/eudat/queryable/QueryableList.java

71 lines
2.1 KiB
Java
Raw Normal View History

package eu.eudat.queryable;
2018-05-28 11:50:42 +02:00
import eu.eudat.queryable.jpa.predicates.*;
2018-03-21 11:16:32 +01:00
import eu.eudat.queryable.queryableentity.DataEntity;
2018-02-08 09:42:02 +01:00
import eu.eudat.queryable.types.SelectionField;
import javax.persistence.TypedQuery;
import javax.persistence.criteria.Expression;
2018-02-07 10:56:30 +01:00
import javax.persistence.criteria.Subquery;
import java.util.List;
import java.util.Map;
2018-02-07 10:56:30 +01:00
import java.util.concurrent.CompletableFuture;
2018-02-20 08:50:17 +01:00
public interface QueryableList<T extends DataEntity> {
QueryableList<T> where(SinglePredicate<T> predicate);
<R> List<R> select(SelectPredicate<T, R> predicate);
2018-02-21 11:07:31 +01:00
<R> CompletableFuture<List<R>> selectAsync(SelectPredicate<T, R> predicate);
List<T> toList();
<V> void update(EntitySelectPredicate<T> selectPredicate, V value);
2018-02-23 11:36:51 +01:00
QueryableList<T> withFields(List<String> fields);
List<Map> toListWithFields();
2018-02-07 10:56:30 +01:00
CompletableFuture<List<T>> toListAsync();
2018-01-19 10:31:05 +01:00
T getSingle();
2018-02-07 10:56:30 +01:00
CompletableFuture<T> getSingleAsync();
2018-01-30 13:23:47 +01:00
T getSingleOrDefault();
2018-02-07 10:56:30 +01:00
CompletableFuture<T> getSingleOrDefaultAsync();
QueryableList<T> skip(Integer offset);
QueryableList<T> take(Integer length);
QueryableList<T> distinct();
2018-02-02 16:24:06 +01:00
QueryableList<T> orderBy(OrderByPredicate<T> predicate);
2018-01-25 16:24:21 +01:00
2018-01-19 10:31:05 +01:00
QueryableList<T> withHint(String hint);
2018-01-25 16:24:21 +01:00
2017-12-19 15:09:49 +01:00
Long count();
2018-02-02 11:33:37 +01:00
2018-02-08 09:42:02 +01:00
QueryableList<T> where(NestedQuerySinglePredicate<T> predicate);
2018-02-07 10:56:30 +01:00
CompletableFuture<Long> countAsync();
Subquery<T> query(List<SelectionField> fields);
2018-02-16 11:34:02 +01:00
Subquery<T> subQuery(SinglePredicate<T> predicate, List<SelectionField> fields);
2018-02-08 09:42:02 +01:00
Subquery<T> subQuery(NestedQuerySinglePredicate<T> predicate, List<SelectionField> fields);
Subquery<Long> subQueryCount(NestedQuerySinglePredicate<T> predicate, List<SelectionField> fields);
Subquery<Long> subQueryCount(SinglePredicate<T> predicate, List<SelectionField> fields);
2019-05-20 13:24:15 +02:00
<U> QueryableList<T> initSubQuery(Class<U> uClass);
2018-03-19 13:40:04 +01:00
2018-02-16 11:34:02 +01:00
<U extends Comparable> Subquery<U> subQueryMax(SinglePredicate<T> predicate, List<SelectionField> fields, Class<U> uClass);
2018-02-07 10:56:30 +01:00
2018-02-16 11:34:02 +01:00
<U extends Comparable> Subquery<U> subQueryMax(NestedQuerySinglePredicate<T> predicate, List<SelectionField> fields, Class<U> uClass);
}