BrightSide Workbench Full Report + Source Code
org.turro.script.DossierFunctions Class Reference
Inheritance diagram for org.turro.script.DossierFunctions:
Collaboration diagram for org.turro.script.DossierFunctions:

Public Member Functions

void addFunctions (Script script)
 
boolean anyOfCategories (Object entity, String categories)
 
boolean anyOfPhases (Object entity, String indexes)
 
boolean anyOfPhaseTypes (Object entity, String types)
 
boolean anyOfRoles (Object dpl, Object user, String roles)
 
boolean anyOfExtRoles (Object dpl, Object user, String roles)
 
boolean anyOfDiscriminators (Object dpl, Object user, String discriminators)
 
boolean anyOfRoles (Object user, String roles)
 
boolean anyOfCategoryRoles (Object user, String roles)
 
boolean anyOfExtRoles (Object user, String roles)
 
boolean anyParticipation (Object user)
 
boolean anyCategoryParticipation (Object user)
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 42 of file DossierFunctions.java.

Member Function Documentation

◆ addFunctions()

void org.turro.script.DossierFunctions.addFunctions ( Script  script)

Implements org.turro.script.IScriptingFunction.

Definition at line 45 of file DossierFunctions.java.

45  {
46  script.addVariable("dfunc", new DossierFunctions());
47  }

◆ anyCategoryParticipation()

boolean org.turro.script.DossierFunctions.anyCategoryParticipation ( Object  user)

Definition at line 118 of file DossierFunctions.java.

118  {
119  return !getCategoryParticipationsFrom((IContact) user, null, null).isEmpty();
120  }

◆ anyOfCategories()

boolean org.turro.script.DossierFunctions.anyOfCategories ( Object  entity,
String  categories 
)

Definition at line 49 of file DossierFunctions.java.

49  {
50  List<String> catList = Strings.csvToList(categories);
51  if(entity instanceof Issue) {
52  return catList.contains(String.valueOf(((Issue) entity).getDossier().getCategory().getId()));
53  } else if(entity instanceof Dossier) {
54  return catList.contains(String.valueOf(((Dossier) entity).getCategory().getId()));
55  } else if(entity instanceof Category) {
56  return ((Category) entity).getParent() != null && catList.contains(String.valueOf(((Category) entity).getParent().getId()));
57  }
58  return false;
59  }

◆ anyOfCategoryRoles()

boolean org.turro.script.DossierFunctions.anyOfCategoryRoles ( Object  user,
String  roles 
)

Definition at line 104 of file DossierFunctions.java.

104  {
105  return !getCategoryParticipationsFrom((IContact) user, roles, null).isEmpty();
106  }

◆ anyOfDiscriminators()

boolean org.turro.script.DossierFunctions.anyOfDiscriminators ( Object  dpl,
Object  user,
String  discriminators 
)

Definition at line 94 of file DossierFunctions.java.

94  {
95  List<String> discriminatorList = Strings.csvToList(discriminators);
96  return discriminatorList.stream().anyMatch(d -> ((ParticipantSet) dpl).isParticipantByDiscriminator((IContact) user, d));
97  }

◆ anyOfExtRoles() [1/2]

boolean org.turro.script.DossierFunctions.anyOfExtRoles ( Object  dpl,
Object  user,
String  roles 
)

Definition at line 86 of file DossierFunctions.java.

86  {
87  List<String> roleList = Strings.csvToList(roles);
88  return roleList.stream().anyMatch(r -> {
89  Method method = Reflections.of(ParticipantSet.class).findMethod(Reflections.toBeanWay("is", r), IContact.class);
90  return (Boolean) Beans.of(dpl).silentInvoke(method, (IContact) user);
91  });
92  }

◆ anyOfExtRoles() [2/2]

boolean org.turro.script.DossierFunctions.anyOfExtRoles ( Object  user,
String  roles 
)

Definition at line 108 of file DossierFunctions.java.

108  {
109  return !getParticipationsFrom((IContact) user, null, roles).isEmpty() ||
110  !getCategoryParticipationsFrom((IContact) user, null, roles).isEmpty();
111  }

◆ anyOfPhases()

boolean org.turro.script.DossierFunctions.anyOfPhases ( Object  entity,
String  indexes 
)

Definition at line 61 of file DossierFunctions.java.

61  {
62  List<String> phaseList = Strings.csvToList(indexes);
63  if(entity instanceof Issue) {
64  return phaseList.contains(Integer.toString(((Issue) entity).getDossier().getProject().getPhase()));
65  } else if(entity instanceof Dossier) {
66  return phaseList.contains(Integer.toString(((Dossier) entity).getProject().getPhase()));
67  }
68  return false;
69  }

◆ anyOfPhaseTypes()

boolean org.turro.script.DossierFunctions.anyOfPhaseTypes ( Object  entity,
String  types 
)

Definition at line 71 of file DossierFunctions.java.

71  {
72  List<String> typeList = Strings.csvToList(types);
73  if(entity instanceof Issue) {
74  return ((Issue) entity).getDossier().getProject().getPhaseDefinition().anyStringMatch(typeList);
75  } else if(entity instanceof Dossier) {
76  return ((Dossier) entity).getProject().getPhaseDefinition().anyStringMatch(typeList);
77  }
78  return false;
79  }

◆ anyOfRoles() [1/2]

boolean org.turro.script.DossierFunctions.anyOfRoles ( Object  dpl,
Object  user,
String  roles 
)

Definition at line 81 of file DossierFunctions.java.

81  {
82  List<String> roleList = Strings.csvToList(roles);
83  return roleList.stream().anyMatch(r -> ((ParticipantSet) dpl).isRole((IContact) user, ParticipantRole.valueOf(r)));
84  }

◆ anyOfRoles() [2/2]

boolean org.turro.script.DossierFunctions.anyOfRoles ( Object  user,
String  roles 
)

Definition at line 99 of file DossierFunctions.java.

99  {
100  return !getParticipationsFrom((IContact) user, roles, null).isEmpty() ||
101  !getCategoryParticipationsFrom((IContact) user, roles, null).isEmpty();
102  }

◆ anyParticipation()

boolean org.turro.script.DossierFunctions.anyParticipation ( Object  user)

Definition at line 113 of file DossierFunctions.java.

113  {
114  return !getParticipationsFrom((IContact) user, null, null).isEmpty() ||
115  !getCategoryParticipationsFrom((IContact) user, null, null).isEmpty();
116  }

The documentation for this class was generated from the following file: