19 package org.turro.alliance.provider;
21 import java.util.List;
22 import org.turro.alliance.db.AlliancePU;
23 import org.turro.jpa.Dao;
24 import org.turro.json.Jsons;
25 import org.turro.server.db.entities.AxMemberPreferences;
26 import org.turro.sql.SqlClause;
27 import org.turro.string.Strings;
28 import org.turro.util.Cached;
29 import org.turro.ws.WsMember;
30 import org.turro.ws.content.JsonServerProvider;
39 super(member, reason, criteria);
48 if(preferences ==
null) {
52 return Jsons.read(preferences.
toJson());
57 List<Long> ids = criteria.getArrayValues(
"categoryIds", Long.class);
58 String search = criteria.getString(
"search",
"");
59 int phase = criteria.getInt(
"phase", -1);
60 return SqlClause.select(
"count(p)").from(
"AxProject p")
61 .startIf(ids !=
null && !ids.isEmpty())
62 .where().in(
"categoryId", ids)
64 .startIf(!Strings.isBlank(search))
65 .whereOrAnd().partial(search,
"p.code",
"p.name",
"p.summary")
68 .whereOrAnd().equal(
"p.phaseIndex", phase)
71 .singleResult(Long.class, 0L);
74 private final Cached<Dao> dao = Cached.instance(() ->
new AlliancePU());
PreferencesProvider(WsMember member, String reason, Jsons criteria)
Jsons loadData(WsMember member, String reason, Jsons criteria)
long count(WsMember member, String reason, Jsons criteria)
void setMemberId(Long memberId)