19 package org.turro.contacts.social;
21 import java.util.ArrayList;
22 import java.util.Date;
23 import java.util.List;
25 import java.util.TreeSet;
26 import org.turro.contacts.BusinessRelation;
27 import org.turro.contacts.db.ContactsPU;
28 import org.turro.elephant.db.WhereClause;
29 import org.turro.plugin.contacts.IContact;
30 import org.turro.security.SocialGroups;
31 import org.zkoss.bind.annotation.BindingParam;
32 import org.zkoss.bind.annotation.Command;
33 import org.zkoss.bind.annotation.NotifyChange;
42 private boolean active =
true, students =
false;
47 @NotifyChange(
"model")
54 @NotifyChange(
"model")
66 this.socialGroup = socialGroup;
82 this.students = students;
86 TreeSet<SocialGroupValue>
set =
new TreeSet<>();
88 set.add(
new SocialGroupValue(social.getName(), social.getId(), social.getType()));
93 @NotifyChange(
"model")
98 ArrayList<SocialRelation> list =
new ArrayList<>();
99 if(socialGroup !=
null) {
101 wc.
addClause(
"select br from BusinessRelation br");
102 wc.
addClause(
"where br.validated = TRUE");
104 wc.
addInRange(
"and",
"br.startDate",
"br.endDate",
"date",
new Date());
108 wc.
addClause(
"select s from Syndication s");
110 wc.
addClause(
"and s.contact = br.business");
112 wc.
addClause(
"select s from Syndication s");
114 wc.
addClause(
"and s.contact = br.contact");
116 wc.
addClause(
"select s from Syndication s");
118 wc.
addClause(
"and s.contact = br.business");
120 wc.
addClause(
"select s from Syndication s");
122 wc.
addClause(
"and s.contact = br.contact");
126 wc.
addClause(
"select b2 from BusinessRelation b2");
127 wc.
addClause(
"where b2.validated = TRUE");
128 wc.
addInRange(
"and",
"b2.startDate",
"b2.endDate",
"date",
new Date());
129 wc.
addClause(
"and b2.contact = br.contact");
130 wc.
addClause(
"and b2.business <> br.business");
132 wc.
addClause(
"select s from Syndication s");
134 wc.
addClause(
"and s.contact = b2.business");
139 wc.
addClause(
"order by br.business.name, br.contact.name");
void addInRange(String operator, String startField, String endField, String attribute, Date date)
void addClause(String clause)
void addNamedValue(String name, Object value)
static Collection< SecurityGroup > allowedSocialGroups()