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

Public Member Functions

 ContactEntities ()
 
 ContactEntities (String entityPath)
 
 ContactEntities (Object entity)
 
Object getEntity ()
 
String getName ()
 
String getLabel ()
 
String getDescription ()
 
Object getLabelCtrl ()
 
String getImage ()
 
String getHierarchicalPath ()
 
IElephantEntity getParent ()
 
List< IElephantEntitygetChildren ()
 
String getExtendedPath ()
 
File getFile ()
 
boolean showPath ()
 
boolean showEntity ()
 
boolean canEdit (IContact contact)
 
boolean canPublish (IContact contact)
 
Collection getEntitites (String search, int maxResults, KeyValueMap kvm)
 
Collection getEntitites (String root, String search, int maxResults, KeyValueMap kvm)
 
IElephantSendable getSendable ()
 
Object configureCtrl (Object ctrl, IContact contact)
 
boolean canShowInContext (IContact contact, Object relatedEntity)
 
String getExtendedWebPath ()
 
String getUserContext ()
 
Collection< String > getAllowedRoots ()
 
Object getObject (Path entityPath)
 
IElephantEntity getMain (Object entity)
 
- Public Member Functions inherited from org.turro.entities.DefaultElephantEntity
 DefaultElephantEntity ()
 
 DefaultElephantEntity (String entityPath)
 
 DefaultElephantEntity (Object entity)
 
IElephantEntity getController (String entityPath)
 
IElephantEntity getController (Object entity)
 
boolean isEmpty ()
 
String getStringId ()
 
String getNameOrLabel ()
 
String getRoot ()
 
String getPath ()
 
String getTreeLabel ()
 
Collection getEntitites (String search, int maxResults)
 
Collection getEntitites (String root, String search, int maxResults)
 
Collection< Object > getRelatedByRole (EntityRole role, IContact contact)
 
boolean hasRelatedRole (EntityRole role, IContact contact)
 
String getLinkRoot ()
 
String getEntityUrl ()
 
String getMemberUrl ()
 
String getAppUrl ()
 
String getEntityUrl (LinkType type, String contextPath)
 
String getReadAllUrl (LinkType type, String contextPath)
 
Object getControl (String name, IContact contact)
 
Object getControl (String name, IConstructor constructor, IContact contact)
 
Object getControl (String name, String entityPath, IContact contact)
 
Object getParticipationControl (IConstructor constructor, ParticipationReason reason)
 
Object getParticipationControl (IConstructor constructor, IContact contact, ParticipationReason reason)
 
String parseSpamCtrl (IConstructor constructor)
 
String parseFollowCtrl (IConstructor constructor)
 
EntitySet getAllChildren ()
 
Script getActorScript ()
 
boolean isActor (String actor)
 
boolean isActor (IContact contact, String actor)
 
ConceptPermission getConceptPermission (String name)
 
Folder getDeliverables ()
 
int hashCode ()
 
boolean equals (Object obj)
 

Protected Member Functions

Dao createDao ()
 
boolean itsMine (String rootPath)
 
boolean itsMine (Object entity)
 
IElephantEntity createInstance (String entityPath)
 
IElephantEntity createInstance (Object entity)
 
Path createPath ()
 
- Protected Member Functions inherited from org.turro.entities.DefaultElephantEntity
boolean isValidLongEntity ()
 
Dao getDao ()
 

Additional Inherited Members

- Static Public Attributes inherited from org.turro.entities.IElephantEntity
static final String EMPTY_ID = "#"
 
static final String PATH_SEPARATOR = ";"
 
- Protected Attributes inherited from org.turro.entities.DefaultElephantEntity
String entityPath
 
Path path
 
Object entity
 

Detailed Description

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

Definition at line 60 of file ContactEntities.java.

Constructor & Destructor Documentation

◆ ContactEntities() [1/3]

org.turro.entities.ContactEntities.ContactEntities ( )

Definition at line 62 of file ContactEntities.java.

62  {
63  }
Here is the caller graph for this function:

◆ ContactEntities() [2/3]

org.turro.entities.ContactEntities.ContactEntities ( String  entityPath)

Definition at line 65 of file ContactEntities.java.

◆ ContactEntities() [3/3]

org.turro.entities.ContactEntities.ContactEntities ( Object  entity)

Definition at line 69 of file ContactEntities.java.

69  {
70  super(entity);
71  }

Member Function Documentation

◆ canEdit()

boolean org.turro.entities.ContactEntities.canEdit ( IContact  contact)

Checks when contact has permissions to edit the entity.

Parameters
contactthe contact checked.
Returns
true when the contact can edit.

Implements org.turro.entities.IElephantEntity.

Definition at line 270 of file ContactEntities.java.

270  {
271  if(getEntity() != null) {
272  if(contact.getSyndications().contains("contacts_admin")) {
273  return true;
274  } else if(entity instanceof Contact) {
275  return contact.getPermissions().isInRole("contact:edit");
276  } else if(entity instanceof Convocation) {
277  return contact.getPermissions().isInRole("convocation:edit");
278  } else if(entity instanceof ContactService) {
279  return ((ContactService) entity).getContact().isInBusiness(contact);
280  }
281  }
282  return false;
283  }
Here is the call graph for this function:

◆ canPublish()

boolean org.turro.entities.ContactEntities.canPublish ( IContact  contact)

Checks when contact has permissions to see the entity.

Parameters
contactthe contact checked.
Returns
true when the contact can see.

Implements org.turro.entities.IElephantEntity.

Definition at line 286 of file ContactEntities.java.

286  {
287  if(getEntity() != null) {
288  if(contact.getSyndications().contains("contacts_admin")) {
289  return true;
290  } else if(entity instanceof Contact) {
291  Contact con = (Contact) getEntity();
292  return !con.getSyndications().isEmpty();
293  } else if(entity instanceof Convocation) {
294  Convocation con = (Convocation) getEntity();
295  return con.isAssistant(contact);
296  }
297  }
298  return false;
299  }
Here is the call graph for this function:

◆ canShowInContext()

boolean org.turro.entities.ContactEntities.canShowInContext ( IContact  contact,
Object  relatedEntity 
)

Checks whether the related entity can be shown to the given contact.

Parameters
contactthe contact to be checked against.
relatedEntitythe related entity to be shown.
Returns
true if can be shown.

Implements org.turro.entities.IElephantEntity.

Definition at line 355 of file ContactEntities.java.

355  {
356  return true;
357  }

◆ configureCtrl()

Object org.turro.entities.ContactEntities.configureCtrl ( Object  ctrl,
IContact  contact 
)

Configures specific entity related controls for the given contact.

Parameters
ctrlthe control to configure.
contactthe contact who receive the control.
Returns
the configured control.

Implements org.turro.entities.IElephantEntity.

Definition at line 350 of file ContactEntities.java.

350  {
351  return ctrl;
352  }

◆ createDao()

Dao org.turro.entities.ContactEntities.createDao ( )
protected

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 370 of file ContactEntities.java.

370  {
371  return new ContactsPU();
372  }

◆ createInstance() [1/2]

IElephantEntity org.turro.entities.ContactEntities.createInstance ( Object  entity)
protected

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 396 of file ContactEntities.java.

396  {
397  return new ContactEntities(entity);
398  }
Here is the call graph for this function:

◆ createInstance() [2/2]

IElephantEntity org.turro.entities.ContactEntities.createInstance ( String  entityPath)
protected

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 391 of file ContactEntities.java.

391  {
392  return new ContactEntities(entityPath);
393  }
Here is the call graph for this function:

◆ createPath()

Path org.turro.entities.ContactEntities.createPath ( )
protected

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 401 of file ContactEntities.java.

401  {
402  return new Path(ContactsPU.getObjectPath(entity));
403  }
Here is the call graph for this function:

◆ getAllowedRoots()

Collection<String> org.turro.entities.ContactEntities.getAllowedRoots ( )

Implements org.turro.entities.IElephantEntity.

Definition at line 386 of file ContactEntities.java.

386  {
387  return Arrays.asList("contact", "convocation", "groupit", "service");
388  }

◆ getChildren()

List<IElephantEntity> org.turro.entities.ContactEntities.getChildren ( )

Gets the children for this entity.

Returns
the children controllers.

Implements org.turro.entities.IElephantEntity.

Definition at line 228 of file ContactEntities.java.

228  {
229  if(getEntity() != null) {
230  if(entity instanceof Contact) {
231  return new EntityListAdapter(((Contact) entity).getWorkers());
232  }
233  }
234  return Collections.EMPTY_LIST;
235  }
Here is the call graph for this function:

◆ getDescription()

String org.turro.entities.ContactEntities.getDescription ( )

Gets the entity description.

Returns
the description string.

Implements org.turro.entities.IElephantEntity.

Definition at line 154 of file ContactEntities.java.

154  {
155  if(getEntity() != null) {
156  if(entity instanceof Contact) {
157  return ((Contact) entity).getGrouping();
158  } else if(entity instanceof ContactService) {
159  return ((ContactService) entity).getText();
160  }
161  }
162  return null;
163  }
Here is the call graph for this function:

◆ getEntitites() [1/2]

Collection org.turro.entities.ContactEntities.getEntitites ( String  root,
String  search,
int  maxResults,
KeyValueMap  kvm 
)

Implements org.turro.entities.IElephantEntity.

Definition at line 312 of file ContactEntities.java.

312  {
313  ArrayList<Object> list = new ArrayList<>();
314  if(null != root) switch (root) {
315  case "contact":
316  list.addAll(searchContacts(search, maxResults, kvm));
317  break;
318  case "convocation":
319  list.addAll(searchConvocations(search, maxResults, kvm));
320  break;
321  case "groupit":
322  list.addAll(searchGroups(search, maxResults, kvm));
323  break;
324  case "service":
325  list.addAll(searchServices(search, maxResults, kvm));
326  break;
327  default:
328  break;
329  }
330  return list;
331  }

◆ getEntitites() [2/2]

Collection org.turro.entities.ContactEntities.getEntitites ( String  search,
int  maxResults,
KeyValueMap  kvm 
)

Implements org.turro.entities.IElephantEntity.

Definition at line 302 of file ContactEntities.java.

302  {
303  ArrayList<Object> list = new ArrayList<>();
304  list.addAll(searchContacts(search, maxResults, kvm));
305  list.addAll(searchConvocations(search, maxResults, kvm));
306  list.addAll(searchGroups(search, maxResults, kvm));
307  list.addAll(searchServices(search, maxResults, kvm));
308  return list;
309  }
Here is the caller graph for this function:

◆ getEntity()

Object org.turro.entities.ContactEntities.getEntity ( )

Returns the entity for this controller.

Returns
the entity's object.

Implements org.turro.entities.IElephantEntity.

Definition at line 74 of file ContactEntities.java.

74  {
75  if(entity == null) {
76  if(getPath() != null) {
77  if(path.getSize() == 2) {
78  if(null != path.getRoot()) switch (path.getRoot()) {
79  case "contact":
80  entity = getDao().find(Contact.class, path.getNode(1));
81  break;
82  case "convocation":
83  entity = getDao().find(Convocation.class, path.getNode(1));
84  break;
85  case "groupit":
86  entity = getDao().find(GroupIt.class, path.getNode(1));
87  break;
88  case "service":
89  entity = getDao().find(ContactService.class, path.getNode(1));
90  break;
91  default:
92  break;
93  }
94  }
95  }
96  }
97  return entity;
98  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getExtendedPath()

String org.turro.entities.ContactEntities.getExtendedPath ( )

Gets the extended path for this entity.

Returns
the extended path string.

Implements org.turro.entities.IElephantEntity.

Definition at line 238 of file ContactEntities.java.

238  {
239  return "";
240  }

◆ getExtendedWebPath()

String org.turro.entities.ContactEntities.getExtendedWebPath ( )

Returns a unique path for the entity.

Returns
the path string.

Implements org.turro.entities.IElephantEntity.

Definition at line 360 of file ContactEntities.java.

360  {
361  return null;
362  }

◆ getFile()

File org.turro.entities.ContactEntities.getFile ( )

Gets the file represented by the entity.

Returns
the entity file.

Implements org.turro.entities.IElephantEntity.

Definition at line 243 of file ContactEntities.java.

243  {
244  return null;
245  }

◆ getHierarchicalPath()

String org.turro.entities.ContactEntities.getHierarchicalPath ( )

Gets the hierarchical path for this entity. Mostly used for sorting purposes.

Returns
the hierarchical path string.

Implements org.turro.entities.IElephantEntity.

Definition at line 196 of file ContactEntities.java.

196  {
197  if(getEntity() != null) {
198  if(entity instanceof VoteIt) {
199  IElephantEntity iee = ((VoteIt) entity).getOwnerEntity();
200  String hp = iee.getHierarchicalPath();
201  return (Strings.isBlank(hp) ? "" : hp + PATH_SEPARATOR) + getPath();
202  } else if(entity instanceof StarIt) {
203  IElephantEntity iee = ((StarIt) entity).getOwnerEntity();
204  String hp = iee.getHierarchicalPath();
205  return (Strings.isBlank(hp) ? "" : hp + PATH_SEPARATOR) + getPath();
206  } else if(entity instanceof CommentIt) {
207  IElephantEntity iee = ((CommentIt) entity).getOwnerEntity();
208  String hp = iee.getHierarchicalPath();
209  return (Strings.isBlank(hp) ? "" : hp + PATH_SEPARATOR) + getPath();
210  }
211  }
212  return getPath();
213  }
Here is the call graph for this function:

◆ getImage()

String org.turro.entities.ContactEntities.getImage ( )

Gets the entity image based on its root.

Returns
the string image location.

Implements org.turro.entities.IElephantEntity.

Definition at line 176 of file ContactEntities.java.

176  {
177  if(getPath() != null) {
178  String root = path.getRoot();
179  if(null != root) switch (root) {
180  case "contact":
181  return "/_zul/images/contact.png";
182  case "convocation":
183  return "/_zul/images/contacts.png";
184  case "groupit":
185  return "/_zul/images/group.png";
186  case "service":
187  return "/_zul/images/service.png";
188  default:
189  break;
190  }
191  }
192  return null;
193  }
Here is the call graph for this function:

◆ getLabel()

String org.turro.entities.ContactEntities.getLabel ( )

Gets the entity label, based on its root.

Returns
the entity string label.

Implements org.turro.entities.IElephantEntity.

Definition at line 117 of file ContactEntities.java.

117  {
118  if(getPath() != null) {
119  String root = path.getRoot();
120  if(null != root) switch (root) {
121  case "contact":
122  return I_.get("Contact");
123  case "groupit":
124  return I_.get("Group");
125  case "convocation":
126  return I_.get("Convocation");
127  case "service":
128  return I_.get("Service");
129  case "log":
130  if(path.getSize() > 1) switch(path.getNode(1)) {
131  case "in":
132  return I_.get("Login");
133  case "out":
134  return I_.get("Logout");
135  case "failed":
136  return I_.get("Login failed");
137  case "profile":
138  return I_.get("Profile");
139  case "webadmin":
140  return I_.get("Web site administration");
141  case "impersonate":
142  return I_.get("Impersonate");
143  case "backtoself":
144  return I_.get("Back to self");
145  }
146  default:
147  break;
148  }
149  }
150  return null;
151  }
Here is the call graph for this function:

◆ getLabelCtrl()

Object org.turro.entities.ContactEntities.getLabelCtrl ( )

Gets the label control, usually a clickable LabelControl class.

Returns
a clickable label control.

Implements org.turro.entities.IElephantEntity.

Definition at line 166 of file ContactEntities.java.

166  {
167  if(getEntity() != null) {
168  if(entity instanceof Contact) {
169  return new ContactInfo((Contact) entity);
170  }
171  }
172  return null;
173  }
Here is the call graph for this function:

◆ getMain()

IElephantEntity org.turro.entities.ContactEntities.getMain ( Object  entity)

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 418 of file ContactEntities.java.

418  {
419  if(entity instanceof CommentIt) {
420  return ((CommentIt) entity).getOwnerEntity();
421  } else if(entity instanceof StarIt) {
422  return ((StarIt) entity).getOwnerEntity();
423  } else if(entity instanceof VoteIt) {
424  return ((VoteIt) entity).getOwnerEntity();
425  }
426  return null;
427  }

◆ getName()

String org.turro.entities.ContactEntities.getName ( )

Gets the entity name.

Returns
the string name.

Implements org.turro.entities.IElephantEntity.

Definition at line 101 of file ContactEntities.java.

101  {
102  if(getEntity() != null) {
103  if(entity instanceof Contact) {
104  return ((Contact) entity).getFullName();
105  } else if(entity instanceof Convocation) {
106  return ((Convocation) entity).getName();
107  } else if(entity instanceof GroupIt) {
108  return ((GroupIt) entity).getName();
109  } else if(entity instanceof ContactService) {
110  return ((ContactService) entity).getTitle();
111  }
112  }
113  return null;
114  }
Here is the call graph for this function:

◆ getObject()

Object org.turro.entities.ContactEntities.getObject ( Path  entityPath)

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 406 of file ContactEntities.java.

406  {
407  if("comment-it".equals(entityPath.getRoot())) {
408  return getDao().find(CommentIt.class, entityPath.getNode(1));
409  } else if("star-it".equals(entityPath.getRoot())) {
410  return getDao().find(StarIt.class, entityPath.getNode(1));
411  } else if("vote-it".equals(entityPath.getRoot())) {
412  return getDao().find(VoteIt.class, entityPath.getNode(1));
413  }
414  return null;
415  }
Here is the call graph for this function:

◆ getParent()

IElephantEntity org.turro.entities.ContactEntities.getParent ( )

Gets the parent for this entity.

Returns
the parent controller.

Implements org.turro.entities.IElephantEntity.

Definition at line 216 of file ContactEntities.java.

216  {
217  if(getEntity() != null) {
218  if(entity instanceof Contact) {
219  return Entities.getController(((Contact) entity).getBusiness());
220  } else if(entity instanceof ContactService) {
221  return Entities.getController(((ContactService) entity).getContact());
222  }
223  }
224  return null;
225  }
Here is the call graph for this function:

◆ getSendable()

IElephantSendable org.turro.entities.ContactEntities.getSendable ( )

Gets sendable control for entity.

Returns
the sendable control.

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 334 of file ContactEntities.java.

334  {
335  if(getPath() != null) {
336  String root = path.getRoot();
337  if(null != root) switch (root) {
338  case "convocation":
339  return new ConvocationSendable(getPath());
340  case "service":
341  return new ServiceSendable(getPath());
342  default:
343  break;
344  }
345  }
346  return null;
347  }
Here is the call graph for this function:

◆ getUserContext()

String org.turro.entities.ContactEntities.getUserContext ( )

Returns the user context for this type of entity

Returns
the path string;

Implements org.turro.entities.IElephantEntity.

Definition at line 365 of file ContactEntities.java.

365  {
366  return "/user/" + getLinkRoot() + "s";
367  }
Here is the call graph for this function:

◆ itsMine() [1/2]

boolean org.turro.entities.ContactEntities.itsMine ( Object  entity)
protected

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 380 of file ContactEntities.java.

380  {
381  return (entity instanceof Contact) || (entity instanceof Convocation) ||
382  (entity instanceof GroupIt) || (entity instanceof ContactService);
383  }

◆ itsMine() [2/2]

boolean org.turro.entities.ContactEntities.itsMine ( String  rootPath)
protected

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 375 of file ContactEntities.java.

375  {
376  return super.itsMine(rootPath) || "log".equals(rootPath);
377  }

◆ showEntity()

boolean org.turro.entities.ContactEntities.showEntity ( )

Shows the view for the entity.

Returns
true when a view is shown.

Implements org.turro.entities.IElephantEntity.

Definition at line 253 of file ContactEntities.java.

253  {
254  if(getEntity() != null) {
255  if(entity instanceof Contact) {
256  ContactMenu.showContact(((Contact) entity).getId());
257  return true;
258  } else if(entity instanceof Convocation) {
259  ContactMenu.showConvocation(((Convocation) entity).getId());
260  return true;
261  } else if(entity instanceof ContactService) {
262  ContactMenu.showService(((ContactService) entity).getId());
263  return true;
264  }
265  }
266  return false;
267  }
Here is the call graph for this function:

◆ showPath()

boolean org.turro.entities.ContactEntities.showPath ( )

Shows the view for this path.

Returns
true when a view is shown.

Implements org.turro.entities.IElephantEntity.

Definition at line 248 of file ContactEntities.java.

248  {
249  return false;
250  }

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