19 package org.turro.alliance.provider;
21 import org.turro.alliance.db.AlliancePU;
22 import org.turro.alliance.db.entities.AxProjectGrant;
23 import org.turro.jpa.Dao;
24 import org.turro.json.Jsons;
25 import org.turro.sql.SqlClause;
26 import org.turro.string.Strings;
27 import org.turro.util.Cached;
28 import org.turro.ws.WsMember;
29 import org.turro.ws.content.JsonServerProvider;
38 super(member, reason, criteria);
43 Jsons projectGrants = Jsons.array();
44 String search = criteria.getString(
"search",
"");
45 boolean notSelf = criteria.getBoolean(
"notSelf",
false);
46 SqlClause.select(
"p").from(
"AxProjectGrant p")
47 .startIf(!Strings.isBlank(search))
48 .whereOrAnd().partial(search,
"p.title")
51 .whereOrAnd().notEqual(
"projectGrantId.memberId", member.
getMemberId())
53 .orderBy(
"p.endDate desc")
54 .start(criteria.getInt(
"curr", -1)).max(criteria.getInt(
"page", -1))
57 projectGrants.addValue(Jsons.read(projectGrant.toJson()));
64 String search = criteria.getString(
"search",
"");
65 boolean notSelf = criteria.getBoolean(
"notSelf",
false);
66 return SqlClause.select(
"count(p)").from(
"AxProjectGrant p")
67 .startIf(!Strings.isBlank(search))
68 .whereOrAnd().partial(search,
"p.title")
71 .whereOrAnd().notEqual(
"projectGrantId.memberId", member.
getMemberId())
74 .singleResult(Long.class, 0L);
77 private final Cached<Dao> dao = Cached.instance(() ->
new AlliancePU());
ProjectGrantProvider(WsMember member, String reason, Jsons criteria)
Jsons loadData(WsMember member, String reason, Jsons criteria)
long count(WsMember member, String reason, Jsons criteria)