1 package net.avcompris.examples.users3.dao;
2
3 import javax.annotation.Nullable;
4
5 import net.avcompris.commons3.api.UserSessionFiltering;
6 import net.avcompris.commons3.dao.EntitiesDtoQuery;
7
8 public interface UserSessionsDtoQuery extends EntitiesDtoQuery<UserSessionFiltering, UserSessionFiltering.Field> {
9
10 @Override
11 @Nullable
12 UserSessionFiltering getFiltering();
13
14 enum SortBy implements EntitiesDtoQuery.SortBy {
15
16 SORT_BY_USERNAME, SORT_BY_USERNAME_DESC,
17 SORT_BY_USER_SESSION_ID, SORT_BY_USER_SESSION_ID_DESC,
18 SORT_BY_CREATED_AT, SORT_BY_CREATED_AT_DESC,
19 SORT_BY_UPDATED_AT, SORT_BY_UPDATED_AT_DESC,
20 SORT_BY_EXPIRES_AT, SORT_BY_EXPIRES_AT_DESC,
21 SORT_BY_EXPIRED_AT, SORT_BY_EXPIRED_AT_DESC;
22
23
24
25
26 private final String sqlField;
27
28
29
30
31 private final boolean isDesc;
32
33 SortBy() {
34
35 this.sqlField = EntitiesDtoQuery.SortBy.toSqlField(name());
36 this.isDesc = EntitiesDtoQuery.SortBy.isDesc(name());
37 }
38
39 @Override
40 public String toSqlField() {
41
42 return sqlField;
43 }
44
45 @Override
46 public boolean isDesc() {
47
48 return isDesc;
49 }
50 }
51
52 enum Expand implements EntitiesDtoQuery.Expand {
53 EXPAND_ALL,
54 EXPAND_USERNAME,
55 EXPAND_USER_SESSION_ID,
56 EXPAND_CREATED_AT,
57 EXPAND_UPDATED_AT,
58 EXPAND_EXPIRES_AT,
59 EXPAND_EXPIRED_AT,
60 }
61
62 @Override
63 SortBy[] getSortBys();
64
65 @Override
66 Expand[] getExpands();
67
68
69 UserSessionsDtoQuery setFiltering(@Nullable UserSessionFiltering filtering);
70
71 UserSessionsDtoQuery setSortBys(SortBy... sortBys);
72
73 UserSessionsDtoQuery setExpands(Expand... expands);
74
75 @Override
76 UserSessionsDtoQuery setStart(int start);
77
78 @Override
79 UserSessionsDtoQuery setLimit(int limit);
80 }