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

Public Member Functions

 DossierEntities ()
 
 DossierEntities (String entityPath)
 
 DossierEntities (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)
 
Object configureCtrl (Object ctrl, IContact contact)
 
boolean canShowInContext (IContact contact, Object relatedEntity)
 
boolean hasRelatedRole (EntityRole role, IContact contact)
 
String getExtendedWebPath ()
 
String getLinkRoot ()
 
String getUserContext ()
 
Collection< String > getAllowedRoots ()
 
Script getActorScript ()
 
ConceptPermission getConceptPermission (String name)
 
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)
 
IElephantSendable getSendable ()
 
Collection< Object > getRelatedByRole (EntityRole role, IContact contact)
 
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 ()
 
boolean isActor (String actor)
 
boolean isActor (IContact contact, String actor)
 
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 73 of file DossierEntities.java.

Constructor & Destructor Documentation

◆ DossierEntities() [1/3]

org.turro.entitites.DossierEntities.DossierEntities ( )

Definition at line 75 of file DossierEntities.java.

75  {
76  }
Here is the caller graph for this function:

◆ DossierEntities() [2/3]

org.turro.entitites.DossierEntities.DossierEntities ( String  entityPath)

Definition at line 78 of file DossierEntities.java.

◆ DossierEntities() [3/3]

org.turro.entitites.DossierEntities.DossierEntities ( Object  entity)

Definition at line 82 of file DossierEntities.java.

82  {
83  super(entity);
84  }

Member Function Documentation

◆ canEdit()

boolean org.turro.entitites.DossierEntities.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 290 of file DossierEntities.java.

290  {
291  if(getEntity() != null) {
292  if(entity instanceof Dossier) {
293  return contact.getPermissions().isInRole("dossier:edit") ||
294  ((Dossier) entity).getFullParticipants().isParticipant(contact);
295  } else if(entity instanceof Issue) {
296  return contact.getPermissions().isInRole("issue:edit") ||
297  ((Issue) entity).getFullParticipants().isParticipant(contact);
298  } else if(entity instanceof ProjectGrant) {
299  return contact.getPermissions().isInRole("dossier:edit");
300  }
301  }
302  return false;
303  }
Here is the call graph for this function:

◆ canPublish()

boolean org.turro.entitites.DossierEntities.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 306 of file DossierEntities.java.

306  {
307  if(getEntity() != null) {
308  if(entity instanceof Dossier) {
309  return ((Dossier) entity).getFullParticipants().isParticipant(contact);
310  } else if(entity instanceof Issue) {
311  return ((Issue) entity).getFullParticipants().canShowIssue(contact);
312  } else if(entity instanceof Category) {
313  return ((Category) entity).getFullParticipants().isParticipant(contact);
314  }
315  }
316  return false;
317  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ canShowInContext()

boolean org.turro.entitites.DossierEntities.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 423 of file DossierEntities.java.

423  {
424  if(relatedEntity instanceof VoteIt) {
425  VoteIt irelated = (VoteIt) relatedEntity;
426  if(getEntity() instanceof Issue) {
427  Issue e = (Issue) getEntity();
428  return e.getDossier().getType().isVotes();
429  } else if(getEntity() instanceof Dossier) {
430  Dossier e = (Dossier) getEntity();
431  return e.getType().isVotes();
432  }
433  } else if(relatedEntity instanceof Attachment) {
434  Attachment irelated = (Attachment) relatedEntity;
435  IElephantEntity iee = Entities.getController(irelated);
436  if(getEntity() instanceof Issue) {
437  Issue e = (Issue) getEntity();
438  return iee.canPublish(contact) || e.getFullParticipants().canShowAllAttachments(contact);
439  } else if(getEntity() instanceof Dossier) {
440  Dossier e = (Dossier) getEntity();
441  boolean canPublish = iee.canPublish(contact);
442  if(contact.isValid()) {
443  return canPublish && e.getFullParticipants().canShowAllAttachments(contact) &&
444  irelated.canShowTo(contact, e.getFullParticipants().getParticipationStrings(contact));
445  }
446  } else if(getEntity() instanceof Category) {
447  Category e = (Category) getEntity();
448  boolean canPublish = iee.canPublish(contact);
449  if(contact.isValid()) {
450  return canPublish && e.getFullParticipants().canShowAllAttachments(contact) &&
451  irelated.canShowTo(contact, e.getFullParticipants().getParticipationStrings(contact));
452  }
453  }
454  }
455  return true;
456  }
boolean canPublish(IContact contact)
Here is the call graph for this function:

◆ configureCtrl()

Object org.turro.entitites.DossierEntities.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 348 of file DossierEntities.java.

348  {
349  if(ctrl instanceof VoteItCtrl) {
350  VoteItCtrl ictrl = (VoteItCtrl) ctrl;
351  if(getEntity() instanceof Issue) {
352  Issue e = (Issue) getEntity();
353  if(e.getDossier().getType().isVotes()) {
354  ictrl.setEntityPath(getPath());
355  ictrl.setForbiden(e.getStatus().isFinished());
356  if(e.getDossier().getType().isSecret()) {
357  ictrl.setForbid(true);
358  ictrl.setAllowed((ContactList) e.getDossier().getFullParticipants().getVoteIParticipants());
359  }
360  return ictrl;
361  }
362  } else if(getEntity() instanceof Dossier) {
363  Dossier e = (Dossier) getEntity();
364  if(e.getType().isVotes()) {
365  ictrl.setEntityPath(getPath());
366  ictrl.setForbiden(!e.getStatus().isOpen());
367  if(e.getType().isSecret()) {
368  ictrl.setForbid(true);
369  ictrl.setAllowed((ContactList) e.getFullParticipants().getVoteIParticipants());
370  }
371  return ictrl;
372  }
373  }
374  } else if(ctrl instanceof StarItCtrl) {
375  StarItCtrl ictrl = (StarItCtrl) ctrl;
376  ictrl.setEntityPath(getPath());
377  return ictrl;
378  } else if(ctrl instanceof CommentItCtrl) {
379  CommentItCtrl ictrl = (CommentItCtrl) ctrl;
380  ictrl.setEntityPath(getPath());
381  return ictrl;
382  } else if(ctrl instanceof AttachCtrl) {
383  AttachCtrl ictrl = (AttachCtrl) ctrl;
384  ictrl.setEntityPath(getPath());
385  if(getEntity() instanceof Issue) {
386  Issue e = (Issue) getEntity();
387  ictrl.setPublicOnly(true);
388  if(e.getFullParticipants().canShowAllAttachments(contact)) {
389  ictrl.setPublicOnly(false);
390  }
391  return ictrl;
392  } else if(getEntity() instanceof Dossier) {
393  Dossier e = (Dossier) getEntity();
394  ictrl.setPublicOnly(true);
395  ictrl.addRestrictedFolders(e.getFullParticipants().getParticipationStrings(contact));
396  return ictrl;
397  } else if(getEntity() instanceof Category) {
398  Category c = (Category) getEntity();
399  ictrl.setPublicOnly(true);
400  ictrl.addRestrictedFolders(c.getFullParticipants().getParticipationStrings(contact));
401  return ictrl;
402  }
403  } else if(ctrl instanceof FileAttach) {
404  FileAttach ictrl = (FileAttach) ctrl;
405  return ictrl;
406  } else if(ctrl instanceof DescribeItCtrl) {
407  DescribeItCtrl ictrl = (DescribeItCtrl) ctrl;
408  ictrl.setEntityPath(getPath());
409  return ictrl;
410  } else if(ctrl instanceof PollsCtrl) {
411  PollsCtrl ictrl = (PollsCtrl) ctrl;
412  ictrl.setEntityPath(getPath());
413  return ictrl;
414  } else if(ctrl instanceof IEntityCtrl) {
415  IEntityCtrl ictrl = (IEntityCtrl) ctrl;
416  ictrl.setEntityPath(getPath());
417  return ictrl;
418  }
419  return ctrl;
420  }
Here is the call graph for this function:

◆ createDao()

Dao org.turro.entitites.DossierEntities.createDao ( )
protected

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 525 of file DossierEntities.java.

525  {
526  return new DossierPU();
527  }

◆ createInstance() [1/2]

IElephantEntity org.turro.entitites.DossierEntities.createInstance ( Object  entity)
protected

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 552 of file DossierEntities.java.

552  {
553  return new DossierEntities(entity);
554  }
Here is the call graph for this function:

◆ createInstance() [2/2]

IElephantEntity org.turro.entitites.DossierEntities.createInstance ( String  entityPath)
protected

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 547 of file DossierEntities.java.

547  {
548  return new DossierEntities(entityPath);
549  }
Here is the call graph for this function:

◆ createPath()

Path org.turro.entitites.DossierEntities.createPath ( )
protected

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 557 of file DossierEntities.java.

557  {
558  return new Path(DossierPU.getObjectPath(entity));
559  }
Here is the call graph for this function:

◆ getActorScript()

Script org.turro.entitites.DossierEntities.getActorScript ( )

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 562 of file DossierEntities.java.

562  {
563  Script script = super.getActorScript();
564  if(getEntity() != null) {
565  if(entity instanceof Category) {
566  script.addVariable("category", entity);
567  script.addVariable("dpl", ((Category) entity).getFullParticipants());
568  } else if(entity instanceof Dossier) {
569  script.addVariable("dossier", entity);
570  script.addVariable("dpl", ((Dossier) entity).getFullParticipants());
571  } else if(entity instanceof Issue) {
572  script.addVariable("issue", entity);
573  script.addVariable("dpl", ((Issue) entity).getFullParticipants());
574  }
575  }
576  return script;
577  }
Here is the call graph for this function:

◆ getAllowedRoots()

Collection<String> org.turro.entitites.DossierEntities.getAllowedRoots ( )

Implements org.turro.entities.IElephantEntity.

Definition at line 542 of file DossierEntities.java.

542  {
543  return Arrays.asList("dossier", "issue", "dossier-category", "project-grant");
544  }

◆ getChildren()

List<IElephantEntity> org.turro.entitites.DossierEntities.getChildren ( )

Gets the children for this entity.

Returns
the children controllers.

Implements org.turro.entities.IElephantEntity.

Definition at line 234 of file DossierEntities.java.

234  {
235  if(getEntity() != null) {
236  if(entity instanceof Category) {
237  EntityListAdapter ela = new EntityListAdapter(((Category) entity).getChildren());
238  ela.addAll(((Category) entity).getDossiers());
239  return ela;
240  } else if(entity instanceof Dossier) {
241  return new EntityListAdapter(((Dossier) entity).getAllIssues());
242  }
243  }
244  return Collections.EMPTY_LIST;
245  }
List< IElephantEntity > getChildren()
Here is the call graph for this function:

◆ getConceptPermission()

ConceptPermission org.turro.entitites.DossierEntities.getConceptPermission ( String  name)

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 580 of file DossierEntities.java.

580  {
581  if(getEntity() != null) {
582  if(entity instanceof Dossier) {
583  Dossier dossier = (Dossier) entity;
584  if(dossier.getProject() != null) {
585  return dossier.getProject().getPhaseDefinition().getPermission(name, this);
586  }
587  }
588  }
589  return super.getConceptPermission(name);
590  }
Here is the call graph for this function:

◆ getDescription()

String org.turro.entitites.DossierEntities.getDescription ( )

Gets the entity description.

Returns
the description string.

Implements org.turro.entities.IElephantEntity.

Definition at line 159 of file DossierEntities.java.

159  {
160  if(getEntity() != null) {
161  if(entity instanceof Dossier) {
162  return ((Dossier) entity).getLabeledPublishableDescription();
163  } else if(entity instanceof Issue) {
164  return ((Issue) entity).getDossier().getFullDescription(false);
165  } else if(entity instanceof ProjectGrant) {
166  return ((ProjectGrant) entity).getDescription();
167  }
168  }
169  return null;
170  }
Here is the call graph for this function:

◆ getEntitites() [1/2]

Collection org.turro.entitites.DossierEntities.getEntitites ( String  root,
String  search,
int  maxResults,
KeyValueMap  kvm 
)

Implements org.turro.entities.IElephantEntity.

Definition at line 329 of file DossierEntities.java.

329  {
330  ArrayList<Object> list = new ArrayList<>();
331  if(null != root) switch (root) {
332  case "dossier":
333  list.addAll(searchDossiers(search, maxResults, kvm));
334  break;
335  case "issue":
336  list.addAll(searchIssues(search, maxResults, kvm));
337  break;
338  case "dossier-category":
339  list.addAll(searchCategories(search, maxResults, kvm));
340  break;
341  default:
342  break;
343  }
344  return list;
345  }

◆ getEntitites() [2/2]

Collection org.turro.entitites.DossierEntities.getEntitites ( String  search,
int  maxResults,
KeyValueMap  kvm 
)

Implements org.turro.entities.IElephantEntity.

Definition at line 320 of file DossierEntities.java.

320  {
321  ArrayList<Object> list = new ArrayList<>();
322  list.addAll(searchCategories(search, maxResults, kvm));
323  list.addAll(searchDossiers(search, maxResults, kvm));
324  list.addAll(searchIssues(search, maxResults, kvm));
325  return list;
326  }

◆ getEntity()

Object org.turro.entitites.DossierEntities.getEntity ( )

Returns the entity for this controller.

Returns
the entity's object.

Implements org.turro.entities.IElephantEntity.

Definition at line 87 of file DossierEntities.java.

87  {
88  if(entity == null) {
89  if(getPath() != null) {
90  if(isValidLongEntity()) {
91  if(null != path.getRoot()) switch (path.getRoot()) {
92  case "dossier":
93  entity = getDao().find(Dossier.class, path.getNodeAs(1, Long.class));
94  break;
95  case "issue":
96  entity = getDao().find(Issue.class, path.getNodeAs(1, Long.class));
97  break;
98  case "dossier-category":
99  entity = getDao().find(Category.class, path.getNodeAs(1, Long.class));
100  break;
101  case "project-grant":
102  entity = getDao().find(ProjectGrant.class, path.getNodeAs(1, Long.class));
103  break;
104  default:
105  break;
106  }
107  }
108  }
109  }
110  return entity;
111  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getExtendedPath()

String org.turro.entitites.DossierEntities.getExtendedPath ( )

Gets the extended path for this entity.

Returns
the extended path string.

Implements org.turro.entities.IElephantEntity.

Definition at line 248 of file DossierEntities.java.

248  {
249  return DossierPU.getObjectExtendedPath(getEntity());
250  }
Here is the call graph for this function:

◆ getExtendedWebPath()

String org.turro.entitites.DossierEntities.getExtendedWebPath ( )

Returns a unique path for the entity.

Returns
the path string.

Implements org.turro.entities.IElephantEntity.

Definition at line 481 of file DossierEntities.java.

481  {
482  if(getEntity() != null) {
483  if(entity instanceof Dossier) {
484  Dossier dossier = (Dossier) entity;
485  return Strings.unpunctuateKeepPath(dossier.getCategory().getPath()).toLowerCase() +
486  "/" + dossier.getId() +
487  "/" + Strings.unpunctuate(dossier.getDescription()).toLowerCase();
488  } else if(entity instanceof Issue) {
489  Issue issue = (Issue) entity;
490  return "/" + issue.getId() +
491  "/" + Strings.unpunctuate(issue.getDescription()).toLowerCase();
492  }
493  }
494  return null;
495  }
Here is the call graph for this function:

◆ getFile()

File org.turro.entitites.DossierEntities.getFile ( )

Gets the file represented by the entity.

Returns
the entity file.

Implements org.turro.entities.IElephantEntity.

Definition at line 253 of file DossierEntities.java.

253  {
254  return null;
255  }

◆ getHierarchicalPath()

String org.turro.entitites.DossierEntities.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 205 of file DossierEntities.java.

205  {
206  if(getEntity() != null) {
207  if(entity instanceof Issue) {
208  Dossier dossier = ((Issue) entity).getDossier();
209  return DossierPU.getObjectPath(dossier.getCategory()) +
210  PATH_SEPARATOR + DossierPU.getObjectPath(dossier) +
212  } else if(entity instanceof Dossier) {
213  Dossier dossier = ((Dossier) entity);
214  return DossierPU.getObjectPath(dossier.getCategory()) +
216  }
217  }
218  return getPath();
219  }
Here is the call graph for this function:

◆ getImage()

String org.turro.entitites.DossierEntities.getImage ( )

Gets the entity image based on its root.

Returns
the string image location.

Implements org.turro.entities.IElephantEntity.

Definition at line 181 of file DossierEntities.java.

181  {
182  if(getPath() != null) {
183  String root = path.getRoot();
184  if(null != root) switch (root) {
185  case "dossier":
186  return "/_zul/images/dossier.png";
187  case "issue":
188  return "/_zul/images/issue.png";
189  case "dossier-category":
190  return "/_zul/images/group.png";
191  case "project-grant":
192  return "/_zul/images/handshelp.png";
193  case "myissues":
194  return "/_zul/images/issue.png";
195  case "mydossiers":
196  return "/_zul/images/dossier.png";
197  default:
198  break;
199  }
200  }
201  return null;
202  }
Here is the call graph for this function:

◆ getLabel()

String org.turro.entitites.DossierEntities.getLabel ( )

Gets the entity label, based on its root.

Returns
the entity string label.

Implements org.turro.entities.IElephantEntity.

Definition at line 135 of file DossierEntities.java.

135  {
136  if(getPath() != null) {
137  String root = path.getRoot();
138  if(null != root) switch (root) {
139  case "dossier":
140  return I_.get("Dossier");
141  case "issue":
142  return I_.get("Issue");
143  case "dossier-category":
144  return I_.get("Category");
145  case "project-grant":
146  return I_.get("Project grant");
147  case "myissues":
148  return I_.get("My issues");
149  case "mydossiers":
150  return I_.get("My dossiers");
151  default:
152  break;
153  }
154  }
155  return null;
156  }
Here is the call graph for this function:

◆ getLabelCtrl()

Object org.turro.entitites.DossierEntities.getLabelCtrl ( )

Gets the label control, usually a clickable LabelControl class.

Returns
a clickable label control.

Implements org.turro.entities.IElephantEntity.

Definition at line 173 of file DossierEntities.java.

173  {
174  if(getEntity() != null) {
175  return new LabelControl(getEntity());
176  }
177  return null;
178  }
Here is the call graph for this function:

◆ getLinkRoot()

String org.turro.entitites.DossierEntities.getLinkRoot ( )

Returns the link root, defaults to path root.

Returns
the path string.

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 498 of file DossierEntities.java.

498  {
499  getPath();
500  String root = path.getRoot();
501  if("dossier".equals(root)) {
502  if(getEntity() instanceof Dossier) {
503  Dossier dossier = (Dossier) entity;
504  if(DossierType.TYPE_PROJECT.equals(dossier.getType())) {
505  return "project";
506  } else {
507  return "dossier";
508  }
509  }
510  }
511  return super.getLinkRoot();
512  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMain()

IElephantEntity org.turro.entitites.DossierEntities.getMain ( Object  entity)

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 607 of file DossierEntities.java.

607  {
608  if(entity instanceof IssueComment) {
609  return getController(((IssueComment) entity).getIssue());
610  } else if(entity instanceof Project) {
611  return getController(((Project) entity).getDossier());
612  } else if(entity instanceof Participant) {
613  return getController(((Participant) entity).getDossier());
614  } else if(entity instanceof IssueParticipant) {
615  return getController(((IssueParticipant) entity).getIssue());
616  } else if(entity instanceof Issue) {
617  return getController(((Issue) entity).getDossier());
618  }
619  return null;
620  }
IElephantEntity getController(String entityPath)
Here is the call graph for this function:

◆ getName()

String org.turro.entitites.DossierEntities.getName ( )

Gets the entity name.

Returns
the string name.

Implements org.turro.entities.IElephantEntity.

Definition at line 114 of file DossierEntities.java.

114  {
115  if(getEntity() != null) {
116  if(entity instanceof Dossier) {
117  return ((Dossier) entity).getId() + Chars.forward().spaced().toString() + ((Dossier) entity).getDescription() +
118  " [" + I_.byKey(((Dossier) entity).getStatus().toString()) + "]";
119  } else if(entity instanceof Issue) {
120  DossierVersion dv = ((Issue) entity).getVersion();
121  return ((Issue) entity).getId() + Chars.forward().spaced().toString() + ((Issue) entity).getDescription() +
122  (dv == null ? "" : (" " + dv.getVersionString())) +
123  " [" + I_.byKey(((Issue) entity).getType().toString()) +
124  ", " + I_.byKey(((Issue) entity).getStatus().toString()) + "]";
125  } else if(entity instanceof Category) {
126  return ((Category) entity).getFullDescription();
127  } else if(entity instanceof ProjectGrant) {
128  return ((ProjectGrant) entity).getName();
129  }
130  }
131  return null;
132  }
Here is the call graph for this function:

◆ getObject()

Object org.turro.entitites.DossierEntities.getObject ( Path  entityPath)

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 593 of file DossierEntities.java.

593  {
594  if("issue-comment".equals(entityPath.getRoot())) {
595  return getDao().find(IssueComment.class, entityPath.getNodeAs(1, Long.class));
596  } else if("issue-participant".equals(entityPath.getRoot())) {
597  return getDao().find(IssueParticipant.class, entityPath.getNodeAs(1, Long.class));
598  } else if("dossier-participant".equals(entityPath.getRoot())) {
599  return getDao().find(Participant.class, entityPath.getNodeAs(1, Long.class));
600  } else if("project".equals(entityPath.getRoot())) {
601  return getDao().find(Project.class, entityPath.getNodeAs(1, Long.class));
602  }
603  return null;
604  }
Here is the call graph for this function:

◆ getParent()

IElephantEntity org.turro.entitites.DossierEntities.getParent ( )

Gets the parent for this entity.

Returns
the parent controller.

Implements org.turro.entities.IElephantEntity.

Definition at line 222 of file DossierEntities.java.

222  {
223  if(getEntity() != null) {
224  if(entity instanceof Issue) {
225  return Entities.getController(((Issue) entity).getDossier());
226  } else if(entity instanceof Dossier) {
227  return Entities.getController(((Dossier) entity).getCategory());
228  }
229  }
230  return null;
231  }
Here is the call graph for this function:

◆ getUserContext()

String org.turro.entitites.DossierEntities.getUserContext ( )

Returns the user context for this type of entity

Returns
the path string;

Implements org.turro.entities.IElephantEntity.

Definition at line 515 of file DossierEntities.java.

515  {
516  getPath();
517  if(path.getRoot().equals("project-grant")) {
518  return "/user/projectgrants";
519  } else {
520  return "/user/my" + getLinkRoot() + "s";
521  }
522  }
Here is the call graph for this function:

◆ hasRelatedRole()

boolean org.turro.entitites.DossierEntities.hasRelatedRole ( EntityRole  role,
IContact  contact 
)

Checks whether contact has the specified role.

Parameters
rolethe role to conform.
contactthe contact to check.
Returns
true if contact has role.

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 459 of file DossierEntities.java.

459  {
460  switch(role) {
461  case CHALLENGER:
462  if(getEntity() instanceof Dossier) {
463  Dossier dossier = (Dossier) getEntity();
464  return dossier.isBranchAdmin(contact) ||
465  dossier.getFullParticipants().isDriver(contact) ||
466  dossier.getFullParticipants().isBeneficiary(contact) ||
467  dossier.getFullParticipants().isOfferer(contact);
468  }
469  break;
470  case DOCUMENTATION:
471  if(getEntity() instanceof Dossier) {
472  Dossier dossier = (Dossier) getEntity();
473  return dossier.getFullParticipants().isSupport(contact);
474  }
475  break;
476  }
477  return super.hasRelatedRole(role, contact);
478  }
Here is the call graph for this function:

◆ itsMine() [1/2]

boolean org.turro.entitites.DossierEntities.itsMine ( Object  entity)
protected

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 536 of file DossierEntities.java.

536  {
537  return (entity instanceof Dossier) || (entity instanceof Issue) ||
538  (entity instanceof Category) || (entity instanceof ProjectGrant);
539  }

◆ itsMine() [2/2]

boolean org.turro.entitites.DossierEntities.itsMine ( String  rootPath)
protected

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 530 of file DossierEntities.java.

530  {
531  return super.itsMine(rootPath) ||
532  "myissues".equals(rootPath) || "mydossiers".equals(rootPath);
533  }

◆ showEntity()

boolean org.turro.entitites.DossierEntities.showEntity ( )

Shows the view for the entity.

Returns
true when a view is shown.

Implements org.turro.entities.IElephantEntity.

Definition at line 273 of file DossierEntities.java.

273  {
274  if(getEntity() != null) {
275  if(entity instanceof Dossier) {
276  DossierMenu.showDossier(((Dossier) entity).getId());
277  return true;
278  } else if(entity instanceof Issue) {
279  DossierMenu.showIssue(((Issue) entity).getId());
280  return true;
281  } else if(entity instanceof ProjectGrant) {
282  DossierMenu.showProjectGrant(((ProjectGrant) entity).getId());
283  return true;
284  }
285  }
286  return false;
287  }
Here is the call graph for this function:

◆ showPath()

boolean org.turro.entitites.DossierEntities.showPath ( )

Shows the view for this path.

Returns
true when a view is shown.

Implements org.turro.entities.IElephantEntity.

Definition at line 258 of file DossierEntities.java.

258  {
259  if(getPath() != null) {
260  String root = path.getRoot();
261  if("myissues".equals(root)) {
262  DossierMenu.showMyIssues();
263  return true;
264  } else if("mydossiers".equals(root)) {
265  DossierMenu.showMyDossiers();
266  return true;
267  }
268  }
269  return false;
270  }
Here is the call graph for this function:

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