18 package org.turro.dossier.dossier;
20 import java.util.Collection;
21 import java.util.HashSet;
23 import java.util.TreeSet;
24 import java.util.function.Predicate;
25 import org.turro.action.Contacts;
26 import org.turro.string.Strings;
27 import org.turro.auth.Authentication;
28 import org.turro.dossier.entity.CategoryParticipant;
29 import org.turro.dossier.entity.IDossierParticipant;
30 import org.turro.dossier.entity.IssueParticipant;
31 import org.turro.dossier.entity.IssueParticipantRole;
32 import org.turro.dossier.entity.Participant;
33 import org.turro.dossier.entity.ParticipantRole;
34 import org.turro.plugin.contacts.ContactList;
35 import org.turro.plugin.contacts.IContact;
36 import org.turro.visual.RoleUtil;
46 addAllExceptEmpties(collection);
54 public boolean addAll(Collection<? extends P> collection) {
55 addAllExceptEmpties(collection);
137 return getIDrivers().contains(getContact(contact));
169 return getISupport().contains(getContact(contact));
177 return getIFunding().contains(getContact(contact));
201 return getIAdmins().contains(getContact(contact));
205 for(Object obj :
this) {
208 if(dp.
getRole().equals(participation) && dp.
getIdContact().equals(getContact(contact).getId())) {
222 for(Object obj :
this) {
239 for(Object obj :
this) {
242 if(dp.
getIdContact().equals(getContact(contact).getId())) {
256 for(Object obj :
this) {
304 for(Object obj :
this) {
307 if(dp !=
null && !Strings.isBlank(discriminator) && discriminator.equalsIgnoreCase(dp.
getDiscriminator())
317 Set<String> discriminators =
new TreeSet<>();
318 for(Object obj :
this) {
325 return discriminators;
330 for(Object obj :
this) {
333 if((Strings.isBlank(discriminator) && Strings.isBlank(dp.
getDiscriminator())) ||
335 participants.add(dp);
349 for(Object obj :
this) {
362 for(Object obj :
this) {
366 participants.add(dp);
375 for(Object obj :
this) {
379 participants.add(dp);
387 HashSet<String>
set =
new HashSet<>();
389 for(Object obj :
this) {
481 this.stream().filter((dp) -> ((dp instanceof
IDossierParticipant) && whatIs.test(dp))).forEachOrdered((dp) -> {
490 for(Object obj :
this) {
503 for(Object obj :
this) {
574 .map((obj) -> (
IDossierParticipant) obj).filter((p) -> (whatIs.test(p))).forEachOrdered((p) -> {
575 list.
add(p.getIContact());
582 private void addAllExceptEmpties(Collection<? extends P> collection) {
583 for(P obj: collection) {
584 if(!isEmpty(obj)) add(obj);
588 private boolean isEmpty(Object obj) {
589 if(obj instanceof Participant) {
590 return ((Participant) obj).isEmpty();
591 }
else if(obj instanceof CategoryParticipant) {
592 return ((CategoryParticipant) obj).isEmpty();
593 }
else if(obj instanceof IssueParticipant) {
594 return ((IssueParticipant) obj).isEmpty();
601 private IContact _contact;
603 private IContact getContact(IContact contact) {
604 if(contact !=
null) {
607 if(_contact ==
null) {
608 _contact = Authentication.getIContact();
Collection< IssueParticipant > getResponsibles()
Collection< IDossierParticipant > getFunding()
boolean canShowIssue(IContact contact)
boolean isAssistant(IContact contact)
boolean isAdmin(IContact contact)
boolean isIssueActiveParticipant(IContact contact)
boolean isParticipant(IContact contact)
boolean isShowAllIssues(IContact contact)
boolean isResearch(IContact contact)
Collection< IDossierParticipant > getBeneficiaries()
Collection< IContact > getIBeneficiaries()
Collection< IDossierParticipant > getOwners()
boolean isSubject(IContact contact)
boolean isReceiveAllEmails(IContact contact)
Collection< IDossierParticipant > getCoordinators()
Collection< IDossierParticipant > getReceiveAllEmails()
boolean isDossierParticipant(IContact contact)
boolean isReporter(IContact contact)
Collection< IContact > getIConsortium()
Collection< IContact > getIDrivers()
Collection< IContact > getIContactsByFunction(Predicate whatIs)
String getDiscriminator(IContact contact)
Collection< IDossierParticipant > getConsortium()
boolean isSupport(IContact contact)
Collection< IDossierParticipant > getAssistants()
boolean addAll(Collection<? extends P > collection)
boolean canShowAllAttachments(IContact contact)
Collection< IContact > getISupport()
boolean isFunding(IContact contact)
Collection< IDossierParticipant > getSubjects()
boolean isCoordinator(IContact contact)
Collection< IDossierParticipant > getParticipantsByDiscriminator(String discriminator)
Collection< IDossierParticipant > getOfferers()
Object getActiveParticipation(IContact contact)
boolean canShowParticipants(IContact contact)
Collection< IContact > getIParticipants()
boolean isCategoryParticipant(IContact contact)
boolean isOwner(IContact contact)
Collection< IContact > getIShowAllIssues()
boolean isOfferer(IContact contact)
IDossierParticipant getActiveDossierParticipation(IContact contact)
boolean isShowAllAttachments(IContact contact)
Object participatesAs(IContact contact, Object participation)
Collection< IContact > getIShowParticipants()
Collection< IDossierParticipant > getDrivers()
boolean isBeneficiary(IContact contact)
Collection< IDossierParticipant > getBidingVote()
boolean isDriver(IContact contact)
boolean isParticipantByDiscriminator(IContact contact, String discriminator)
Collection< IDossierParticipant > getShowParticipants()
HashSet< String > getParticipationStrings(IContact contact)
Collection< IDossierParticipant > getShowAllIssues()
boolean isShowParticipants(IContact contact)
Collection< IDossierParticipant > getShowAllAttachments()
Collection< String > getDiscriminators()
Object getParticipation(IContact contact)
Collection< IssueParticipant > getReporters()
Collection< IDossierParticipant > getResearch()
Collection< IContact > getIAdmins()
Collection< IContact > getIBidingVote()
Collection< IDossierParticipant > getSupport()
Collection< IDossierParticipant > getByFunction(Predicate whatIs)
Collection< IContact > getVoteIParticipants()
boolean isQA(IContact contact)
boolean isConsortium(IContact contact)
ParticipantSet(Collection<? extends P > collection)
Collection< IContact > getIFunding()
Collection< IContact > getIReceiveAllEmails()
boolean isIssueParticipant(IContact contact)
Collection< IContact > getICoordinators()
boolean isResponsible(IContact contact)
boolean isVoteParticipant(IContact contact)
boolean isRole(IContact contact, ParticipantRole role)
Collection< IContact > getIShowAllAttachments()
Collection< IContact > getIOfferers()
boolean isBindingVote(IContact contact)
Collection< IDossierParticipant > getAdmins()
Collection< IContact > getIResearch()
IssueParticipantRole getRole()
static HashSet< String > getStringRoles(IDossierParticipant dp)
boolean isShowParticipants()
boolean isShowAllIssues()
boolean isShowAllAttachments()
String getDiscriminator()
ParticipantRole getRole()
boolean isReceiveAllEmails()