19 package org.turro.user.activity;
21 import java.util.Date;
22 import java.util.EnumSet;
23 import java.util.HashSet;
25 import org.turro.dossier.db.DossierPU;
26 import org.turro.dossier.entity.Participant;
27 import org.turro.elephant.db.WhereClause;
28 import org.turro.jpa.Dao;
29 import org.turro.plugin.contacts.IContact;
50 Set<Activity>
set =
new HashSet<>();
52 set.addAll(getParticipations(contact, from, types));
57 private Set<Activity> getParticipations(
IContact contact, Date from, Set<ActivityType> types) {
59 wc.
addClause(
"select p from Participant p");
66 wc.
addClause(
"and p.idContact = :participator");
70 Set<Activity>
set =
new HashSet<>();
71 for(Participant p :
getDao().getResultList(Participant.class, wc, 100)) {
72 Activity activity = convertToActivity(types, p);
73 if(activity !=
null)
set.add(activity);
78 private Activity convertToActivity(Set<ActivityType> types, Participant p) {
79 return new Activity(p.getCreation(), ActivityType.ACTIVITY_PARTICIPATE, p.getIdContact(),
80 DossierPU.getObjectPath(p.getDossier()), p);
void addClause(String clause)
void addNamedValue(String name, Object value)
Set< Activity > getActivity(IContact contact, Date from, Set< ActivityType > types)
Set< ActivityType > getAllowed()