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

Public Member Functions

 PublicationEntities ()
 
 PublicationEntities (String entityPath)
 
 PublicationEntities (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 ()
 
- 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 ()
 
Object getObject (Path entityPath)
 
IElephantEntity getMain (Object entity)
 
int hashCode ()
 
boolean equals (Object obj)
 

Protected Member Functions

Dao createDao ()
 
boolean itsMine (Object entity)
 
IElephantEntity createInstance (String entityPath)
 
IElephantEntity createInstance (Object entity)
 
Path createPath ()
 
- Protected Member Functions inherited from org.turro.entities.DefaultElephantEntity
boolean itsMine (String rootPath)
 
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 57 of file PublicationEntities.java.

Constructor & Destructor Documentation

◆ PublicationEntities() [1/3]

org.turro.entities.PublicationEntities.PublicationEntities ( )

Definition at line 59 of file PublicationEntities.java.

59  {
60  }
Here is the caller graph for this function:

◆ PublicationEntities() [2/3]

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

Definition at line 62 of file PublicationEntities.java.

◆ PublicationEntities() [3/3]

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

Definition at line 66 of file PublicationEntities.java.

66  {
67  super(entity);
68  }

Member Function Documentation

◆ canEdit()

boolean org.turro.entities.PublicationEntities.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 246 of file PublicationEntities.java.

246  {
247  if(getEntity() != null) {
248  if(entity instanceof Publication) {
249  return contact.getPermissions().isInRole("publication:edit") && (contact.getPermissions().isInRole("publication:all") ||
250  ((Publication) entity).getIdContact().equals(contact.getId()));
251  } else if(entity instanceof Newsletter) {
252  return contact.getPermissions().isInRole("publication:edit");
253  }
254  }
255  return false;
256  }
Here is the call graph for this function:

◆ canPublish()

boolean org.turro.entities.PublicationEntities.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 259 of file PublicationEntities.java.

259  {
260  if(getEntity() != null) {
261  if(entity instanceof Publication) {
262  return true;
263  } else if(entity instanceof Newsletter) {
264  return true;
265  }
266  }
267  return false;
268  }
Here is the call graph for this function:

◆ canShowInContext()

boolean org.turro.entities.PublicationEntities.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 345 of file PublicationEntities.java.

345  {
346  return true;
347  }

◆ configureCtrl()

Object org.turro.entities.PublicationEntities.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 315 of file PublicationEntities.java.

315  {
316  if(ctrl instanceof StarItCtrl) {
317  StarItCtrl ictrl = (StarItCtrl) ctrl;
318  ictrl.setEntityPath(getPath());
319  return ictrl;
320  } else if(ctrl instanceof CommentItCtrl) {
321  CommentItCtrl ictrl = (CommentItCtrl) ctrl;
322  ictrl.setEntityPath(getPath());
323  return ictrl;
324  } else if(ctrl instanceof AttachCtrl) {
325  AttachCtrl ictrl = (AttachCtrl) ctrl;
326  ictrl.setEntityPath(getPath());
327  ictrl.setPublicOnly(true);
328  return ictrl;
329  } else if(ctrl instanceof FileAttach) {
330  FileAttach ictrl = (FileAttach) ctrl;
331  return ictrl;
332  } else if(ctrl instanceof PollsCtrl) {
333  PollsCtrl ictrl = (PollsCtrl) ctrl;
334  ictrl.setEntityPath(getPath());
335  return ictrl;
336  } else if(ctrl instanceof IEntityCtrl) {
337  IEntityCtrl ictrl = (IEntityCtrl) ctrl;
338  ictrl.setEntityPath(getPath());
339  return ictrl;
340  }
341  return ctrl;
342  }
Here is the call graph for this function:

◆ createDao()

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

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 377 of file PublicationEntities.java.

377  {
378  return new PublicationPU();
379  }

◆ createInstance() [1/2]

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

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 398 of file PublicationEntities.java.

Here is the call graph for this function:

◆ createInstance() [2/2]

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

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 393 of file PublicationEntities.java.

393  {
394  return new PublicationEntities(entityPath);
395  }
Here is the call graph for this function:

◆ createPath()

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

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 403 of file PublicationEntities.java.

403  {
404  return new Path(PublicationPU.getObjectPath(entity));
405  }
Here is the call graph for this function:

◆ getAllowedRoots()

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

Implements org.turro.entities.IElephantEntity.

Definition at line 388 of file PublicationEntities.java.

388  {
389  return Arrays.asList("publication", "pub-category", "newsletter", "mail-category");
390  }

◆ getChildren()

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

Gets the children for this entity.

Returns
the children controllers.

Implements org.turro.entities.IElephantEntity.

Definition at line 207 of file PublicationEntities.java.

207  {
208  if(getEntity() != null) {
209  if(entity instanceof PublicationCategory) {
210  return new EntityListAdapter(((PublicationCategory) entity).getPublications());
211  }
212  }
213  return Collections.EMPTY_LIST;
214  }
Here is the call graph for this function:

◆ getDescription()

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

Gets the entity description.

Returns
the description string.

Implements org.turro.entities.IElephantEntity.

Definition at line 134 of file PublicationEntities.java.

134  {
135  if(getEntity() != null) {
136  if(entity instanceof PublicationCategory) {
137  return ((PublicationCategory) entity).getDescription();
138  } else if(entity instanceof NotificationCategory) {
139  return ((NotificationCategory) entity).getDescription();
140  }
141  }
142  return null;
143  }
Here is the call graph for this function:

◆ getEntitites() [1/2]

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

Implements org.turro.entities.IElephantEntity.

Definition at line 280 of file PublicationEntities.java.

280  {
281  ArrayList<Object> list = new ArrayList<>();
282  if(null != root) switch (root) {
283  case "publication":
284  list.addAll(searchPublications(search, maxResults, kvm));
285  break;
286  case "pub-category":
287  list.addAll(searchCategories(search, maxResults, kvm));
288  break;
289  case "newsletter":
290  list.addAll(searchNewsletters(search, maxResults, kvm));
291  break;
292  default:
293  break;
294  }
295  return list;
296  }

◆ getEntitites() [2/2]

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

Implements org.turro.entities.IElephantEntity.

Definition at line 271 of file PublicationEntities.java.

271  {
272  ArrayList<Object> list = new ArrayList<>();
273  list.addAll(searchPublications(search, maxResults, kvm));
274  list.addAll(searchCategories(search, maxResults, kvm));
275  list.addAll(searchNewsletters(search, maxResults, kvm));
276  return list;
277  }

◆ getEntity()

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

Returns the entity for this controller.

Returns
the entity's object.

Implements org.turro.entities.IElephantEntity.

Definition at line 71 of file PublicationEntities.java.

71  {
72  if(entity == null) {
73  if(getPath() != null) {
74  if(isValidLongEntity()) {
75  if(null != path.getRoot()) switch (path.getRoot()) {
76  case "publication":
77  entity = getDao().find(Publication.class, path.getNodeAs(1, Long.class));
78  break;
79  case "pub-category":
80  entity = getDao().find(PublicationCategory.class, path.getNodeAs(1, Long.class));
81  break;
82  case "newsletter":
83  entity = getDao().find(Newsletter.class, path.getNodeAs(1, Long.class));
84  break;
85  case "mail-category":
86  entity = Notifications.getCategory(path.getPath());
87  break;
88  default:
89  break;
90  }
91  }
92  }
93  }
94  return entity;
95  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getExtendedPath()

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

Gets the extended path for this entity.

Returns
the extended path string.

Implements org.turro.entities.IElephantEntity.

Definition at line 217 of file PublicationEntities.java.

217  {
218  return "";
219  }

◆ getExtendedWebPath()

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

Returns a unique path for the entity.

Returns
the path string.

Implements org.turro.entities.IElephantEntity.

Definition at line 350 of file PublicationEntities.java.

350  {
351  if(getEntity() != null) {
352  if(entity instanceof Publication) {
353  Publication publication = (Publication) entity;
354  return "/" + publication.getId() +
355  "/" + Strings.unpunctuate(publication.getTitle()).toLowerCase();
356  } else if(entity instanceof Newsletter) {
357  Newsletter newsletter = (Newsletter) entity;
358  return "/" + newsletter.getId() +
359  "/" + Strings.unpunctuate(newsletter.getTitle()).toLowerCase();
360  }
361  }
362  return null;
363  }
Here is the call graph for this function:

◆ getFile()

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

Gets the file represented by the entity.

Returns
the entity file.

Implements org.turro.entities.IElephantEntity.

Definition at line 222 of file PublicationEntities.java.

222  {
223  return null;
224  }

◆ getHierarchicalPath()

String org.turro.entities.PublicationEntities.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 182 of file PublicationEntities.java.

182  {
183  if(getEntity() != null) {
184  if(entity instanceof Publication) {
185  return PublicationPU.getObjectPath(
186  ((Publication) entity).getPublicationCategory()) +
188  } else if(entity instanceof Newsletter) {
189  return "/mail-category/" + ((Newsletter) entity).getIdCategory() +
191  }
192  }
193  return getPath();
194  }
Here is the call graph for this function:

◆ getImage()

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

Gets the entity image based on its root.

Returns
the string image location.

Implements org.turro.entities.IElephantEntity.

Definition at line 162 of file PublicationEntities.java.

162  {
163  if(getPath() != null) {
164  String root = path.getRoot();
165  if(null != root) switch (root) {
166  case "publication":
167  return "/_zul/images/publication.png";
168  case "pub-category":
169  return "/_zul/images/group.png";
170  case "newsletter":
171  return "/_zul/images/newsletter.png";
172  case "mail-category":
173  return "/_zul/images/group.png";
174  default:
175  break;
176  }
177  }
178  return null;
179  }
Here is the call graph for this function:

◆ getLabel()

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

Gets the entity label, based on its root.

Returns
the entity string label.

Implements org.turro.entities.IElephantEntity.

Definition at line 114 of file PublicationEntities.java.

114  {
115  if(getPath() != null) {
116  String root = path.getRoot();
117  if(null != root) switch (root) {
118  case "publication":
119  return I_.get("Publication");
120  case "pub-category":
121  return I_.get("Category");
122  case "newsletter":
123  return I_.get("Newsletter");
124  case "mail-category":
125  return I_.get("Category");
126  default:
127  break;
128  }
129  }
130  return null;
131  }
Here is the call graph for this function:

◆ getLabelCtrl()

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

Gets the label control, usually a clickable LabelControl class.

Returns
a clickable label control.

Implements org.turro.entities.IElephantEntity.

Definition at line 146 of file PublicationEntities.java.

146  {
147  if(getEntity() != null) {
148  if(entity instanceof Publication) {
149  return new LabelControl(entity);
150  } else if(entity instanceof PublicationCategory) {
151  return new LabelControl(entity);
152  } else if(entity instanceof Newsletter) {
153  return new LabelControl(entity);
154  } else if(entity instanceof NotificationCategory) {
155  return new LabelControl(entity);
156  }
157  }
158  return null;
159  }
Here is the call graph for this function:

◆ getName()

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

Gets the entity name.

Returns
the string name.

Implements org.turro.entities.IElephantEntity.

Definition at line 98 of file PublicationEntities.java.

98  {
99  if(getEntity() != null) {
100  if(entity instanceof Publication) {
101  return ((Publication) entity).getTitle();
102  } else if(entity instanceof PublicationCategory) {
103  return ((PublicationCategory) entity).getName();
104  } else if(entity instanceof Newsletter) {
105  return ((Newsletter) entity).getTitle();
106  } else if(entity instanceof NotificationCategory) {
107  return ((NotificationCategory) entity).getCategory();
108  }
109  }
110  return null;
111  }
Here is the call graph for this function:

◆ getParent()

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

Gets the parent for this entity.

Returns
the parent controller.

Implements org.turro.entities.IElephantEntity.

Definition at line 197 of file PublicationEntities.java.

197  {
198  if(getEntity() != null) {
199  if(entity instanceof Publication) {
200  return Entities.getController(((Publication) entity).getPublicationCategory());
201  }
202  }
203  return null;
204  }
Here is the call graph for this function:

◆ getSendable()

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

Gets sendable control for entity.

Returns
the sendable control.

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 299 of file PublicationEntities.java.

299  {
300  if(getPath() != null) {
301  String root = path.getRoot();
302  if(null != root) switch (root) {
303  case "publication":
304  return new PublicationSendable(getPath());
305  case "newsletter":
306  return new NewsletterSendable(getPath());
307  default:
308  break;
309  }
310  }
311  return null;
312  }
Here is the call graph for this function:

◆ getUserContext()

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

Returns the user context for this type of entity

Returns
the path string;

Implements org.turro.entities.IElephantEntity.

Definition at line 366 of file PublicationEntities.java.

366  {
367  getPath();
368  if(path.getRoot().equals("publication")) {
369  return ElephantContext.getEntityWebContext("/publication");
370  } else if(path.getRoot().equals("newsletter")) {
371  return "/user/newsletter";
372  }
373  return null;
374  }
Here is the call graph for this function:

◆ itsMine()

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

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 382 of file PublicationEntities.java.

382  {
383  return (entity instanceof Publication) || (entity instanceof PublicationCategory) ||
384  (entity instanceof Newsletter) || (entity instanceof NotificationCategory);
385  }

◆ showEntity()

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

Shows the view for the entity.

Returns
true when a view is shown.

Implements org.turro.entities.IElephantEntity.

Definition at line 232 of file PublicationEntities.java.

232  {
233  if(getEntity() != null) {
234  if(entity instanceof Publication) {
235  PublicationMenu.showPublication(((Publication) entity).getId());
236  return true;
237  } else if(entity instanceof Newsletter) {
238  PublicationMenu.showNewsletter(((Newsletter) entity).getId());
239  return true;
240  }
241  }
242  return false;
243  }
Here is the call graph for this function:

◆ showPath()

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

Shows the view for this path.

Returns
true when a view is shown.

Implements org.turro.entities.IElephantEntity.

Definition at line 227 of file PublicationEntities.java.

227  {
228  return false;
229  }

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