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

Public Member Functions

 ElephantEntities ()
 
 ElephantEntities (String entityPath)
 
 ElephantEntities (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)
 
String getExtendedWebPath ()
 
String getUserContext ()
 
Collection< String > getAllowedRoots ()
 
Object getObject (Path entityPath)
 
String getEntityUrl (LinkType type, String contextPath)
 
- 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)
 
boolean hasRelatedRole (EntityRole role, IContact contact)
 
String getLinkRoot ()
 
String getEntityUrl ()
 
String getMemberUrl ()
 
String getAppUrl ()
 
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 ()
 
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 51 of file ElephantEntities.java.

Constructor & Destructor Documentation

◆ ElephantEntities() [1/3]

org.turro.entities.ElephantEntities.ElephantEntities ( )

Definition at line 53 of file ElephantEntities.java.

53  {
54  }
Here is the caller graph for this function:

◆ ElephantEntities() [2/3]

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

Definition at line 56 of file ElephantEntities.java.

◆ ElephantEntities() [3/3]

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

Definition at line 60 of file ElephantEntities.java.

60  {
61  super(entity);
62  }

Member Function Documentation

◆ canEdit()

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

237  {
238  return false;
239  }

◆ canPublish()

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

242  {
243  if(getEntity() != null) {
244  if(entity instanceof Poll) {
245  return ((Poll) entity).isParticipant(contact);
246  }
247  }
248  return false;
249  }
Here is the call graph for this function:

◆ canShowInContext()

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

277  {
278  return true;
279  }

◆ configureCtrl()

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

272  {
273  return ctrl;
274  }

◆ createDao()

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

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 306 of file ElephantEntities.java.

306  {
307  return new ElephantPU();
308  }

◆ createInstance() [1/2]

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

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 327 of file ElephantEntities.java.

327  {
328  return new ElephantEntities(entity);
329  }
Here is the call graph for this function:

◆ createInstance() [2/2]

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

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 322 of file ElephantEntities.java.

322  {
323  return new ElephantEntities(entityPath);
324  }
Here is the call graph for this function:

◆ createPath()

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

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 332 of file ElephantEntities.java.

332  {
333  return new Path(ElephantPU.getObjectPath(entity));
334  }
Here is the call graph for this function:

◆ getAllowedRoots()

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

Implements org.turro.entities.IElephantEntity.

Definition at line 317 of file ElephantEntities.java.

317  {
318  return Arrays.asList("sendable", "poll", "topic", "post");
319  }

◆ getChildren()

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

Gets the children for this entity.

Returns
the children controllers.

Implements org.turro.entities.IElephantEntity.

Definition at line 205 of file ElephantEntities.java.

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

◆ getDescription()

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

Gets the entity description.

Returns
the description string.

Implements org.turro.entities.IElephantEntity.

Definition at line 139 of file ElephantEntities.java.

139  {
140  return null;
141  }

◆ getEntitites() [1/2]

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

Implements org.turro.entities.IElephantEntity.

Definition at line 259 of file ElephantEntities.java.

259  {
260  ArrayList<Object> list = new ArrayList<>();
261  if(null != root) switch (root) {
262  case "poll":
263  list.addAll(searchPolls(search, maxResults, kvm));
264  break;
265  default:
266  break;
267  }
268  return list;
269  }

◆ getEntitites() [2/2]

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

Implements org.turro.entities.IElephantEntity.

Definition at line 252 of file ElephantEntities.java.

252  {
253  ArrayList<Object> list = new ArrayList<>();
254  list.addAll(searchPolls(search, maxResults, kvm));
255  return list;
256  }

◆ getEntity()

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

Returns the entity for this controller.

Returns
the entity's object.

Implements org.turro.entities.IElephantEntity.

Definition at line 65 of file ElephantEntities.java.

65  {
66  if(entity == null) {
67  if(getPath() != null) {
68  if(path.getSize() == 2) {
69  if(null != path.getRoot()) switch (path.getRoot()) {
70  case "sendable":
71  if(isValidLongEntity()) {
72  entity = getDao().find(Sendable.class, path.getFrom(1));
73  }
74  break;
75  case "poll":
76  if(isValidLongEntity()) {
77  entity = getDao().find(Poll.class, path.getNodeAs(1, Long.class));
78  }
79  break;
80  case "topic":
81  if(isValidLongEntity()) {
82  entity = getDao().find(Topic.class, path.getNodeAs(1, Long.class));
83  }
84  break;
85  case "post":
86  if(isValidLongEntity()) {
87  entity = getDao().find(Post.class, path.getNodeAs(1, Long.class));
88  }
89  break;
90  default:
91  break;
92  }
93  }
94  }
95  }
96  return entity;
97  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getEntityUrl()

String org.turro.entities.ElephantEntities.getEntityUrl ( LinkType  type,
String  contextPath 
)

Returns the web link for this entity.

Parameters
typeweb, member or app.
contextPathif specified, will be used instead of defaults.
Returns
the path string.

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 354 of file ElephantEntities.java.

354  {
355  if("post".equals(getRoot())) {
356  return getParent().getEntityUrl(type, contextPath);
357  }
358  return super.getEntityUrl(type, contextPath);
359  }
Here is the call graph for this function:

◆ getExtendedPath()

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

Gets the extended path for this entity.

Returns
the extended path string.

Implements org.turro.entities.IElephantEntity.

Definition at line 217 of file ElephantEntities.java.

217  {
218  return null;
219  }

◆ getExtendedWebPath()

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

Returns a unique path for the entity.

Returns
the path string.

Implements org.turro.entities.IElephantEntity.

Definition at line 282 of file ElephantEntities.java.

282  {
283  if(getEntity() != null) {
284  if(entity instanceof Poll) {
285  Poll poll = (Poll) entity;
286  return "/" + poll.getId() +
287  "/" + Strings.unpunctuate(poll.getTitle()).toLowerCase();
288  }
289  }
290  return null;
291  }
Here is the call graph for this function:

◆ getFile()

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

Gets the file represented by the entity.

Returns
the entity file.

Implements org.turro.entities.IElephantEntity.

Definition at line 222 of file ElephantEntities.java.

222  {
223  return null;
224  }

◆ getHierarchicalPath()

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

169  {
170  if(getEntity() != null) {
171  if(entity instanceof Poll) {
172  IElephantEntity iee = ((Poll) entity).getEntity();
173  String hp = iee.getHierarchicalPath();
174  return (Strings.isBlank(hp) ? "" : hp + PATH_SEPARATOR) + getPath();
175  } else if(entity instanceof Topic) {
176  IElephantEntity iee = ((Topic) entity).getEntity();
177  String hp = iee.getHierarchicalPath();
178  return (Strings.isBlank(hp) ? "" : hp + PATH_SEPARATOR) + getPath();
179  } else if(entity instanceof Post) {
180  IElephantEntity iee = ((Post) entity).getTopic().getEntity();
181  String hp = iee.getHierarchicalPath();
182  return (Strings.isBlank(hp) ? "" : hp + PATH_SEPARATOR) + getPath();
183  }
184  }
185  return getPath();
186  }
Here is the call graph for this function:

◆ getImage()

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

Gets the entity image based on its root.

Returns
the string image location.

Implements org.turro.entities.IElephantEntity.

Definition at line 149 of file ElephantEntities.java.

149  {
150  if(getPath() != null) {
151  String root = path.getRoot();
152  if(null != root) switch (root) {
153  case "sendable":
154  return "/_zul/images/mail_queue.png";
155  case "poll":
156  return "/_zul/images/poll.png";
157  case "topic":
158  return "/_zul/images/topic.png";
159  case "post":
160  return "/_zul/images/topic.png";
161  default:
162  break;
163  }
164  }
165  return null;
166  }
Here is the call graph for this function:

◆ getLabel()

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

Gets the entity label, based on its root.

Returns
the entity string label.

Implements org.turro.entities.IElephantEntity.

Definition at line 119 of file ElephantEntities.java.

119  {
120  if(getPath() != null) {
121  String root = path.getRoot();
122  if(null != root) switch (root) {
123  case "sendable":
124  return I_.get("Sendable");
125  case "poll":
126  return I_.get("Poll");
127  case "topic":
128  return I_.get("Topic");
129  case "post":
130  return I_.get("Post");
131  default:
132  break;
133  }
134  }
135  return null;
136  }
Here is the call graph for this function:

◆ getLabelCtrl()

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

Gets the label control, usually a clickable LabelControl class.

Returns
a clickable label control.

Implements org.turro.entities.IElephantEntity.

Definition at line 144 of file ElephantEntities.java.

144  {
145  return null;
146  }

◆ getName()

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

Gets the entity name.

Returns
the string name.

Implements org.turro.entities.IElephantEntity.

Definition at line 100 of file ElephantEntities.java.

100  {
101  if(getEntity() != null) {
102  if(entity instanceof Sendable) {
103  return DateFormats.format(
104  ((Sendable) entity).getSchedule(),
105  DateFormat.SHORT, DateFormat.SHORT,
106  I_.api().used());
107  } else if(entity instanceof Poll) {
108  return ((Poll) entity).getTitle();
109  } else if(entity instanceof Topic) {
110  return ((Topic) entity).getText();
111  } else if(entity instanceof Post) {
112  return ((Post) entity).getText();
113  }
114  }
115  return null;
116  }
Here is the call graph for this function:

◆ getObject()

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

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 337 of file ElephantEntities.java.

337  {
338  if("entity-participation".equals(entityPath.getRoot())) {
339  return getDao().find(EntityParticipation.class, EntityParticipationPK.from(entityPath.getComplex(1)));
340  }
341  return null;
342  }
Here is the call graph for this function:

◆ getParent()

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

Gets the parent for this entity.

Returns
the parent controller.

Implements org.turro.entities.IElephantEntity.

Definition at line 189 of file ElephantEntities.java.

189  {
190  if(getEntity() != null) {
191  if(entity instanceof Sendable) {
192  return (IElephantEntity) ((Sendable) entity).getEntity();
193  } else if(entity instanceof Poll) {
194  return ((Poll) entity).getEntity();
195  } else if(entity instanceof Topic) {
196  return ((Topic) entity).getEntity();
197  } else if(entity instanceof Post) {
198  return Entities.getController(((Post) entity).getParentTopic());
199  }
200  }
201  return null;
202  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getUserContext()

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

Returns the user context for this type of entity

Returns
the path string;

Implements org.turro.entities.IElephantEntity.

Definition at line 294 of file ElephantEntities.java.

294  {
295  getPath();
296  if(path.getRoot().equals("poll")) {
297  return "/user/mypolls";
298  }
299  if(path.getRoot().equals("topic")) {
300  return "/user/forums";
301  }
302  return null;
303  }
Here is the call graph for this function:

◆ itsMine()

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

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 311 of file ElephantEntities.java.

311  {
312  return (entity instanceof Sendable) || (entity instanceof Poll) ||
313  (entity instanceof Topic) || (entity instanceof Post);
314  }

◆ showEntity()

boolean org.turro.entities.ElephantEntities.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 ElephantEntities.java.

232  {
233  return false;
234  }

◆ showPath()

boolean org.turro.entities.ElephantEntities.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 ElephantEntities.java.

227  {
228  return false;
229  }

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