◆ ProjectProvider()
org.turro.alliance.provider.ProjectProvider.ProjectProvider |
( |
WsMember |
member, |
|
|
String |
reason, |
|
|
Jsons |
criteria |
|
) |
| |
Definition at line 41 of file ProjectProvider.java.
42 super(member, reason, criteria);
43 banned = Banned.of(member).getBannedIds();
◆ count()
long org.turro.alliance.provider.ProjectProvider.count |
( |
WsMember |
member, |
|
|
String |
reason, |
|
|
Jsons |
criteria |
|
) |
| |
|
protected |
Definition at line 76 of file ProjectProvider.java.
77 List<Long> ids = criteria.getArrayValues(
"categoryIds", Long.class);
78 String search = criteria.getString(
"search",
"");
79 int phase = criteria.getInt(
"phase", -1);
80 boolean withBanned = criteria.getBoolean(
"withBanned",
false);
81 return SqlClause.select(
"count(p)").from(
"AxProject p")
82 .startIf(ids !=
null && !ids.isEmpty())
83 .where().in(
"categoryId", ids)
85 .startIf(!Strings.isBlank(search))
86 .whereOrAnd().partial(search,
"p.code",
"p.name",
"p.summary")
89 .whereOrAnd().equal(
"p.phaseIndex", phase)
92 .whereOrAnd().notIn(
"id", banned)
95 .singleResult(Long.class, 0L);
◆ loadData()
Jsons org.turro.alliance.provider.ProjectProvider.loadData |
( |
WsMember |
member, |
|
|
String |
reason, |
|
|
Jsons |
criteria |
|
) |
| |
|
protected |
Definition at line 47 of file ProjectProvider.java.
48 Jsons projects = Jsons.array();
49 List<Long> ids = criteria.getArrayValues(
"categoryIds", Long.class);
50 String search = criteria.getString(
"search",
"");
51 int phase = criteria.getInt(
"phase", -1);
52 boolean withBanned = criteria.getBoolean(
"withBanned",
false);
53 SqlClause.select(
"p").from(
"AxProject p")
54 .startIf(ids !=
null && !ids.isEmpty())
55 .where().in(
"categoryId", ids)
57 .startIf(!Strings.isBlank(search))
58 .whereOrAnd().partial(search,
"p.code",
"p.name",
"p.summary")
61 .whereOrAnd().equal(
"p.phaseIndex", phase)
64 .whereOrAnd().notIn(
"id", banned)
66 .orderBy(
"p.creation desc")
67 .start(criteria.getInt(
"curr", -1)).max(criteria.getInt(
"page", -1))
69 .resultList(AxProject.class).forEach(project -> {
70 projects.addValue(Jsons.read(project.toJson(Map.of(
"banned", withBanned && banned.contains(project.getId())))));
The documentation for this class was generated from the following file: