BrightSide Workbench Full Report + Source Code
org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E > Class Template Referenceabstract
Inheritance diagram for org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >:
Collaboration diagram for org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >:

Public Member Functions

 VisualElement (String name, F factory)
 
getParent ()
 
void setParent (V parent)
 
boolean check (E entity, IContact contact)
 
String getName ()
 
String getLabel ()
 
int getOrder ()
 
boolean allows (String name, E entity, IContact contact)
 
VisualElement getElement (String name)
 
VisualElement getElement (String name, E entity, IContact contact)
 
getSubElements ()
 
setName (String name)
 
setLabel (String label)
 
setOrder (int order)
 
setRole (String role)
 
setAdmin (Boolean admin)
 
setWorker (Boolean worker)
 
setStudent (Boolean student)
 
setHHRR (Boolean hhrr)
 
setVisitor (Boolean visitor)
 
addSyndication (String syndication)
 
addGrouping (String grouping)
 
addBusinessSyndication (String syndication)
 
addBusinessGrouping (String grouping)
 
boolean isVisitor (E entity, IContact contact)
 
int compareTo (VisualElement o)
 
int hashCode ()
 
boolean equals (Object obj)
 

Protected Member Functions

addSubElement (String name)
 
boolean checkConstraints (E entity, IContact contact)
 
boolean emptyConstraints ()
 
boolean checkEval (E entity, IContact contact)
 
boolean checkContact (IContact contact)
 
boolean isNullOrFalse (Boolean value)
 
abstract boolean emptyEntityConstraints ()
 
abstract boolean checkAllMatch (E entity, IContact contact)
 
abstract boolean checkAnyMatch (E entity, IContact contact)
 
boolean hasScript ()
 
Script getScript ()
 

Detailed Description

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

Definition at line 34 of file VisualElement.java.

Constructor & Destructor Documentation

◆ VisualElement()

org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.VisualElement ( String  name,
factory 
)

Definition at line 48 of file VisualElement.java.

48  {
49  this.name = name;
50  this.factory = factory;
51  }

Member Function Documentation

◆ addBusinessGrouping()

V org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.addBusinessGrouping ( String  grouping)

Definition at line 166 of file VisualElement.java.

166  {
167  if(businessGroupings == null) {
168  businessGroupings = new HashSet<>();
169  }
170  businessGroupings.add(grouping);
171  return (V) this;
172  }

◆ addBusinessSyndication()

V org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.addBusinessSyndication ( String  syndication)

Definition at line 158 of file VisualElement.java.

158  {
159  if(businessSyndications == null) {
160  businessSyndications = new HashSet<>();
161  }
162  businessSyndications.add(syndication);
163  return (V) this;
164  }

◆ addGrouping()

V org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.addGrouping ( String  grouping)

Definition at line 150 of file VisualElement.java.

150  {
151  if(groupings == null) {
152  groupings = new HashSet<>();
153  }
154  groupings.add(grouping);
155  return (V) this;
156  }

◆ addSubElement()

V org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.addSubElement ( String  name)
protected

Definition at line 174 of file VisualElement.java.

174  {
175  if(subElements == null) {
176  subElements = (F) factory.createSubElements();
177  }
178  V v = (V) factory.createElement(name);
179  v.setParent(this);
180  return subElements.add(v) ? v : null;
181  }

◆ addSyndication()

V org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.addSyndication ( String  syndication)

Definition at line 142 of file VisualElement.java.

142  {
143  if(syndications == null) {
144  syndications = new HashSet<>();
145  }
146  syndications.add(syndication);
147  return (V) this;
148  }

◆ allows()

boolean org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.allows ( String  name,
entity,
IContact  contact 
)

Definition at line 80 of file VisualElement.java.

80  {
81  VisualElement dve = getElement(name);
82  return dve == null || dve.check(entity, contact);
83  }
VisualElement getElement(String name)
VisualElement(String name, F factory)
Here is the call graph for this function:

◆ check()

boolean org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.check ( entity,
IContact  contact 
)

Definition at line 61 of file VisualElement.java.

61  {
63  return isNullOrFalse(visitor) ? true : checkContact(contact); // No constraint
64  }
65  return checkConstraints(entity, contact);
66  }
boolean checkContact(IContact contact)
boolean checkConstraints(E entity, IContact contact)
abstract boolean emptyEntityConstraints()
boolean isNullOrFalse(Boolean value)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkAllMatch()

abstract boolean org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.checkAllMatch ( entity,
IContact  contact 
)
abstractprotected
Here is the caller graph for this function:

◆ checkAnyMatch()

abstract boolean org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.checkAnyMatch ( entity,
IContact  contact 
)
abstractprotected
Here is the caller graph for this function:

◆ checkConstraints()

boolean org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.checkConstraints ( entity,
IContact  contact 
)
protected

Definition at line 183 of file VisualElement.java.

183  {
184  if(checkContact(contact)) {
185  if(!Strings.isBlank(role) && !contact.getPermissions().isInRole(role)) {
186  return false;
187  }
188  IContact business = contact.getBusiness();
189  business = (business != null && business.isValid()) ? business : null;
190  return checkAllMatch(entity, contact) &&
191  (checkEval(entity, contact) ||
192  checkSyndications(contact) ||
193  checkGroupings(contact) ||
194  checkBusinessSyndications(business) ||
195  checkBusinessGroupings(business) ||
196  checkRoles(contact) ||
197  checkAnyMatch(entity, contact));
198  }
199  return false;
200  }
abstract boolean checkAllMatch(E entity, IContact contact)
boolean checkEval(E entity, IContact contact)
abstract boolean checkAnyMatch(E entity, IContact contact)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkContact()

boolean org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.checkContact ( IContact  contact)
protected

Definition at line 267 of file VisualElement.java.

267  {
268  return contact != null && contact.isValid();
269  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkEval()

boolean org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.checkEval ( entity,
IContact  contact 
)
protected

Definition at line 208 of file VisualElement.java.

208  {
209  if(hasScript()) {
210  getScript().addVariable("user", contact);
211  return getScript().evalToBoolean(Scripting.realScript(eval));
212  }
213  return false;
214  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ compareTo()

int org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.compareTo ( VisualElement< F extends VisualElements, V extends VisualElement, E >  o)

Definition at line 295 of file VisualElement.java.

295  {
296  if(o == null) return 0;
297  int result = CompareUtil.compare(this.order, o.order);
298  if(result == 0) {
299  result = CompareUtil.compare(this.name, o.name);
300  }
301  return result;
302  }

◆ emptyConstraints()

boolean org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.emptyConstraints ( )
protected

Definition at line 202 of file VisualElement.java.

202  {
203  return eval == null && role == null && syndications == null && groupings == null &&
204  businessSyndications == null && businessGroupings == null &&
205  admin == null && worker == null && student == null && hhrr == null;
206  }
Here is the caller graph for this function:

◆ emptyEntityConstraints()

abstract boolean org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.emptyEntityConstraints ( )
abstractprotected
Here is the caller graph for this function:

◆ equals()

boolean org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.equals ( Object  obj)

Definition at line 313 of file VisualElement.java.

313  {
314  if (this == obj) {
315  return true;
316  }
317  if (obj == null) {
318  return false;
319  }
320  if (getClass() != obj.getClass()) {
321  return false;
322  }
323  final VisualElement<?, ?, ?> other = (VisualElement<?, ?, ?>) obj;
324  if (this.order != other.order) {
325  return false;
326  }
327  if (!Objects.equals(this.name, other.name)) {
328  return false;
329  }
330  return true;
331  }

◆ getElement() [1/2]

VisualElement org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.getElement ( String  name)

Definition at line 85 of file VisualElement.java.

85  {
86  return getSubElements() == null ? null : getSubElements().getElement(name);
87  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getElement() [2/2]

VisualElement org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.getElement ( String  name,
entity,
IContact  contact 
)

Definition at line 89 of file VisualElement.java.

89  {
90  return getSubElements() == null ? null : getSubElements().getElement(name, entity, contact);
91  }
Here is the call graph for this function:

◆ getLabel()

String org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.getLabel ( )

Definition at line 72 of file VisualElement.java.

72  {
73  return I_.get(label);
74  }
Here is the call graph for this function:

◆ getName()

String org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.getName ( )

Definition at line 68 of file VisualElement.java.

68  {
69  return name;
70  }

◆ getOrder()

int org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.getOrder ( )

Definition at line 76 of file VisualElement.java.

76  {
77  return order;
78  }

◆ getParent()

V org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.getParent ( )

Definition at line 53 of file VisualElement.java.

53  {
54  return parent;
55  }

◆ getScript()

Script org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.getScript ( )
protected

Definition at line 285 of file VisualElement.java.

285  {
286  if(script == null) {
287  script = Scripting.instance();
288  }
289  return script;
290  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSubElements()

F org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.getSubElements ( )

Definition at line 93 of file VisualElement.java.

93  {
94  return subElements;
95  }
Here is the caller graph for this function:

◆ hashCode()

int org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.hashCode ( )

Definition at line 305 of file VisualElement.java.

305  {
306  int hash = 7;
307  hash = 97 * hash + Objects.hashCode(this.name);
308  hash = 97 * hash + this.order;
309  return hash;
310  }

◆ hasScript()

boolean org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.hasScript ( )
protected

Definition at line 281 of file VisualElement.java.

281  {
282  return !Strings.isBlank(eval);
283  }
Here is the caller graph for this function:

◆ isNullOrFalse()

boolean org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.isNullOrFalse ( Boolean  value)
protected

Definition at line 271 of file VisualElement.java.

271  {
272  return value == null || value.equals(Boolean.FALSE);
273  }
Here is the caller graph for this function:

◆ isVisitor()

boolean org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.isVisitor ( entity,
IContact  contact 
)

Definition at line 263 of file VisualElement.java.

263  {
264  return !checkContact(contact) || !checkConstraints(entity, contact);
265  }
Here is the call graph for this function:

◆ setAdmin()

V org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.setAdmin ( Boolean  admin)

Definition at line 117 of file VisualElement.java.

117  {
118  this.admin = admin;
119  return (V) this;
120  }

◆ setHHRR()

V org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.setHHRR ( Boolean  hhrr)

Definition at line 132 of file VisualElement.java.

132  {
133  this.hhrr = hhrr;
134  return (V) this;
135  }

◆ setLabel()

V org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.setLabel ( String  label)

Definition at line 102 of file VisualElement.java.

102  {
103  this.label = label;
104  return (V) this;
105  }

◆ setName()

V org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.setName ( String  name)

Definition at line 97 of file VisualElement.java.

97  {
98  this.name = name;
99  return (V) this;
100  }

◆ setOrder()

V org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.setOrder ( int  order)

Definition at line 107 of file VisualElement.java.

107  {
108  this.order = order;
109  return (V) this;
110  }

◆ setParent()

void org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.setParent ( parent)

Definition at line 57 of file VisualElement.java.

57  {
58  this.parent = parent;
59  }

◆ setRole()

V org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.setRole ( String  role)

Definition at line 112 of file VisualElement.java.

112  {
113  this.role = role;
114  return (V) this;
115  }

◆ setStudent()

V org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.setStudent ( Boolean  student)

Definition at line 127 of file VisualElement.java.

127  {
128  this.student = student;
129  return (V) this;
130  }

◆ setVisitor()

V org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.setVisitor ( Boolean  visitor)

Definition at line 137 of file VisualElement.java.

137  {
138  this.visitor = visitor;
139  return (V) this;
140  }

◆ setWorker()

V org.turro.visual.VisualElement< F extends VisualElements, V extends VisualElement, E >.setWorker ( Boolean  worker)

Definition at line 122 of file VisualElement.java.

122  {
123  this.worker = worker;
124  return (V) this;
125  }

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