19 package org.turro.dossier.command;
21 import java.util.ArrayList;
22 import java.util.Arrays;
23 import java.util.List;
24 import org.turro.auth.Authentication;
25 import org.turro.dossier.db.DossierPU;
26 import org.turro.dossier.entity.Category;
27 import org.turro.dossier.entity.CategoryParticipant;
28 import org.turro.dossier.entity.ParticipantRole;
29 import org.turro.jpa.Dao;
30 import org.turro.plugin.contacts.IContact;
31 import org.zkoss.bind.annotation.BindingParam;
32 import org.zkoss.bind.annotation.Command;
33 import org.zkoss.bind.annotation.ExecutionArgParam;
34 import org.zkoss.bind.annotation.Init;
35 import org.zkoss.bind.annotation.NotifyChange;
47 if(contact !=
null) this.contact = contact;
52 public
void save(@BindingParam("entity") Object entity) {
60 public
void delete(@BindingParam("entity") Object entity) {
66 public List<CategoryParticipationWrapper>
getModel() {
67 ArrayList<CategoryParticipationWrapper> wrappers =
new ArrayList<>();
68 fillCategories(wrappers);
76 private void fillCategories(ArrayList<CategoryParticipationWrapper> wrappers) {
77 for(
Category category : (List<Category>) getDao().getResultList(
"select c from Category c order by c.fullDescription")) {
82 private CategoryParticipant getParticipant(Category category) {
83 for(CategoryParticipant cp : category.getParticipants()) {
84 if(contact.
getId().equals(cp.getIdContact())) {
88 return new CategoryParticipant();
95 private Dao getDao() {
97 _dao =
new DossierPU();
static IContact getIContact()