19 package org.turro.visual;
21 import java.util.EnumSet;
22 import java.util.HashSet;
23 import org.turro.dossier.dossier.ParticipantSet;
24 import org.turro.dossier.entity.Category;
25 import org.turro.dossier.entity.ParticipantRole;
26 import org.turro.plugin.contacts.IContact;
27 import org.turro.script.DossierFunctions;
35 private EnumSet<ParticipantRole> roles;
36 private HashSet<String> discriminators;
37 private Boolean showAllAttachments, showParticipants, showAllIssues, receiveAllEmails, bindingVote,
38 driver, coordinator, beneficiary, offerer, research, funding, support;
39 private Boolean directOwner, participates, branchAdmin;
46 this.showAllAttachments = showAllAttachments;
51 this.showParticipants = showParticipants;
56 this.showAllIssues = showAllIssues;
61 this.receiveAllEmails = receiveAllEmails;
66 this.bindingVote = bindingVote;
76 this.coordinator = coordinator;
81 this.beneficiary = beneficiary;
86 this.offerer = offerer;
91 this.research = research;
96 this.funding = funding;
101 this.support = support;
106 this.directOwner = directOwner;
111 this.participates = participates;
116 this.branchAdmin = branchAdmin;
122 roles = EnumSet.of(role);
130 if(discriminators ==
null) {
131 discriminators =
new HashSet<>();
133 discriminators.add(discriminator);
139 return roles ==
null && discriminators ==
null && participates ==
null &&
140 directOwner ==
null && branchAdmin ==
null && showAllAttachments ==
null &&
141 showParticipants ==
null && showAllIssues ==
null && receiveAllEmails ==
null &&
142 bindingVote ==
null && driver ==
null && coordinator ==
null &&
143 beneficiary ==
null && offerer ==
null && research ==
null &&
144 funding ==
null && support ==
null;
151 getScript().addVariable(
"category", entity);
153 return super.checkEval(entity, contact);
167 return checkRoles(dpl, contact) ||
168 checkDiscriminators(dpl, contact) ||
169 checkAttributes(dpl, contact) ||
170 checkDirectOwner(entity, contact) ||
171 checkBranchAdmin(entity, contact) ||
172 checkParticipates(dpl, contact);
178 if(dpl.
isRole(contact, role)) {
186 private boolean checkDiscriminators(ParticipantSet dpl, IContact contact) {
187 if(discriminators !=
null) {
188 for(String discriminator : discriminators) {
189 if(dpl.isParticipantByDiscriminator(contact, discriminator)) {
197 private boolean checkAttributes(ParticipantSet dpl, IContact contact) {
198 return (showAllAttachments ==
null ?
false : showAllAttachments.equals(dpl.isShowAllAttachments(contact))) ||
199 (showParticipants ==
null ? false : showParticipants.equals(dpl.isShowParticipants(contact))) ||
200 (showAllIssues ==
null ?
false : showAllIssues.equals(dpl.isShowAllIssues(contact))) ||
201 (receiveAllEmails ==
null ?
false : receiveAllEmails.equals(dpl.isReceiveAllEmails(contact))) ||
202 (bindingVote ==
null ?
false : bindingVote.equals(dpl.isBindingVote(contact))) ||
203 (driver ==
null ?
false : driver.equals(dpl.isDriver(contact))) ||
204 (coordinator ==
null ?
false : coordinator.equals(dpl.isCoordinator(contact))) ||
205 (beneficiary ==
null ?
false : beneficiary.equals(dpl.isBeneficiary(contact))) ||
206 (offerer ==
null ?
false : offerer.equals(dpl.isOfferer(contact))) ||
207 (research ==
null ?
false : research.equals(dpl.isResearch(contact))) ||
208 (funding ==
null ?
false : funding.equals(dpl.isFunding(contact))) ||
209 (support ==
null ?
false : support.equals(dpl.isSupport(contact))) ||
210 (branchAdmin ==
null ?
false : branchAdmin.equals(dpl.isAdmin(contact)));
213 private boolean checkParticipates(ParticipantSet dpl, IContact contact) {
214 return isNullOrFalse(participates) ? false : dpl.isParticipant(contact);
217 private boolean checkDirectOwner(Category category, IContact contact) {
218 return isNullOrFalse(directOwner) ? false : category.isDirectOwner(contact);
221 private boolean checkBranchAdmin(Category category, IContact contact) {
222 return isNullOrFalse(branchAdmin) ? false : category.isBranchAdmin(contact);
boolean isRole(IContact contact, ParticipantRole role)
boolean isBranchAdmin(IContact contact)
boolean isDirectOwner(IContact contact)
ParticipantSet< IDossierParticipant > getFullParticipants()
boolean isDirectOwner(Category category, IContact contact)
CategoryVisualElement setDirectOwner(Boolean directOwner)
CategoryVisualElement setBranchAdmin(Boolean branchAdmin)
CategoryVisualElement setBindingVote(Boolean bindingVote)
CategoryVisualElement setFunding(Boolean funding)
CategoryVisualElement setShowParticipants(Boolean showParticipants)
CategoryVisualElement setReceiveAllEmails(Boolean receiveAllEmails)
boolean participatesAs(Category Category, String discriminator, IContact contact)
boolean participates(Category category, IContact contact)
CategoryVisualElement setShowAllIssues(Boolean showAllIssues)
boolean checkAllMatch(Category entity, IContact contact)
CategoryVisualElement setParticipates(Boolean participates)
boolean isInComission(Category category, IContact contact)
boolean emptyEntityConstraints()
CategoryVisualElement setOfferer(Boolean offerer)
CategoryVisualElement(String name, CategoryVisualElements factory)
CategoryVisualElement addDiscriminator(String discriminator)
boolean checkEval(Category entity, IContact contact)
boolean isPatron(IContact contact)
CategoryVisualElement setDriver(Boolean driver)
boolean checkAnyMatch(Category entity, IContact contact)
boolean isPartner(IContact contact)
CategoryVisualElement setBeneficiary(Boolean beneficiary)
CategoryVisualElement setSupport(Boolean support)
boolean isAdministrator(Category category, IContact contact)
CategoryVisualElement setResearch(Boolean research)
CategoryVisualElement addRole(ParticipantRole role)
CategoryVisualElement setShowAllAttachments(Boolean showAllAttachments)
CategoryVisualElement setCoordinator(Boolean coordinator)
boolean checkContact(IContact contact)
boolean isNullOrFalse(Boolean value)