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

Public Member Functions

 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 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)
 
- Public Member Functions inherited from org.turro.entities.IElephantEntity
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)
 
Collection< String > getAllowedRoots ()
 
Object configureCtrl (Object ctrl, IContact contact)
 
boolean canShowInContext (IContact contact, Object relatedEntity)
 
String getExtendedWebPath ()
 
String getUserContext ()
 

Protected Member Functions

boolean itsMine (String rootPath)
 
abstract Dao createDao ()
 
abstract boolean itsMine (Object entity)
 
abstract IElephantEntity createInstance (String entityPath)
 
abstract IElephantEntity createInstance (Object entity)
 
abstract Path createPath ()
 
boolean isValidLongEntity ()
 
Dao getDao ()
 

Protected Attributes

String entityPath
 
Path path
 
Object entity
 

Additional Inherited Members

- Static Public Attributes inherited from org.turro.entities.IElephantEntity
static final String EMPTY_ID = "#"
 
static final String PATH_SEPARATOR = ";"
 

Detailed Description

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

Definition at line 55 of file DefaultElephantEntity.java.

Constructor & Destructor Documentation

◆ DefaultElephantEntity() [1/3]

org.turro.entities.DefaultElephantEntity.DefaultElephantEntity ( )

Definition at line 61 of file DefaultElephantEntity.java.

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

◆ DefaultElephantEntity() [2/3]

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

◆ DefaultElephantEntity() [3/3]

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

Definition at line 69 of file DefaultElephantEntity.java.

Member Function Documentation

◆ createDao()

◆ createInstance() [1/2]

◆ createInstance() [2/2]

◆ createPath()

◆ equals()

boolean org.turro.entities.DefaultElephantEntity.equals ( Object  obj)

Definition at line 366 of file DefaultElephantEntity.java.

366  {
367  if (this == obj) {
368  return true;
369  }
370  if (obj == null) {
371  return false;
372  }
373  if (getClass() != obj.getClass()) {
374  return false;
375  }
376  final DefaultElephantEntity other = (DefaultElephantEntity) obj;
377  if (!Objects.equals(this.getPath(), other.getPath())) {
378  return false;
379  }
380  return true;
381  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getActorScript()

Script org.turro.entities.DefaultElephantEntity.getActorScript ( )

Implements org.turro.entities.IElephantEntity.

Reimplemented in org.turro.entitites.DossierEntities.

Definition at line 314 of file DefaultElephantEntity.java.

314  {
315  return Scripting.instance();
316  }
Here is the call graph for this function:

◆ getAllChildren()

EntitySet org.turro.entities.DefaultElephantEntity.getAllChildren ( )

Implements org.turro.entities.IElephantEntity.

Definition at line 301 of file DefaultElephantEntity.java.

301  {
302  EntitySet set = new EntitySet();
303  set.add(this);
304  set.addAll(getChildren());
305  for(IElephantEntity iee : getChildren()) {
306  set.addAll(iee.getAllChildren());
307  }
308  return set;
309  }
List< IElephantEntity > getChildren()
Here is the call graph for this function:

◆ getAppUrl()

String org.turro.entities.DefaultElephantEntity.getAppUrl ( )

Returns the app link for this entity.

Returns
the path string.

Implements org.turro.entities.IElephantEntity.

Definition at line 172 of file DefaultElephantEntity.java.

172  {
173  IUser user = Application.getUser();
174  if(user instanceof IContact) {
175  IContact contact = (IContact) user;
176  if(contact.isWebapp()) {
177  getPath();
178  return "/app/frame?" + Interceptors.parameters(getLinkRoot(), path.getNode(1)).encoded();
179  } else {
180  return getEntityUrl(LinkType.WEB_INTERNAL, null);
181  }
182  }
183  return null;
184  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getConceptPermission()

ConceptPermission org.turro.entities.DefaultElephantEntity.getConceptPermission ( String  name)

Implements org.turro.entities.IElephantEntity.

Reimplemented in org.turro.entitites.DossierEntities.

Definition at line 329 of file DefaultElephantEntity.java.

329  {
330  return null;
331  }

◆ getControl() [1/3]

Object org.turro.entities.DefaultElephantEntity.getControl ( String  name,
IConstructor  constructor,
IContact  contact 
)

Returns a configured control based on this entity

Parameters
namecontrol name
contactcontact viewing this control
Returns
a web control

Implements org.turro.entities.IElephantEntity.

Definition at line 257 of file DefaultElephantEntity.java.

257  {
258  Object control = Controls.getControl(name, constructor);
259  return configureCtrl(control, contact);
260  }
Object configureCtrl(Object ctrl, IContact contact)
Here is the call graph for this function:

◆ getControl() [2/3]

Object org.turro.entities.DefaultElephantEntity.getControl ( String  name,
IContact  contact 
)

Implements org.turro.entities.IElephantEntity.

Definition at line 251 of file DefaultElephantEntity.java.

251  {
252  Object control = Controls.getControl(name);
253  return configureCtrl(control, contact);
254  }
Here is the call graph for this function:

◆ getControl() [3/3]

Object org.turro.entities.DefaultElephantEntity.getControl ( String  name,
String  entityPath,
IContact  contact 
)

Implements org.turro.entities.IElephantEntity.

Definition at line 263 of file DefaultElephantEntity.java.

263  {
264  Object control = Controls.getControl(name, entityPath);
265  return configureCtrl(control, contact);
266  }
Here is the call graph for this function:

◆ getController() [1/2]

IElephantEntity org.turro.entities.DefaultElephantEntity.getController ( Object  entity)

Gets a controller for entity.

Parameters
entitythe entity object.
Returns
the elephant entity controller.

Implements org.turro.entities.IElephantEntity.

Definition at line 83 of file DefaultElephantEntity.java.

83  {
84  if(itsMine(entity)) {
85  return createInstance(entity);
86  }
87  return null;
88  }
abstract IElephantEntity createInstance(String entityPath)
Here is the call graph for this function:

◆ getController() [2/2]

IElephantEntity org.turro.entities.DefaultElephantEntity.getController ( String  entityPath)

Gets a controller for entityPath.

Parameters
entityPathrepresenting the path for entity or entity's root.
Returns
the elephant entity controller.

Implements org.turro.entities.IElephantEntity.

Definition at line 74 of file DefaultElephantEntity.java.

74  {
75  String root = new Path(entityPath).getRoot();
76  if(itsMine(root)) {
77  return createInstance(entityPath);
78  }
79  return null;
80  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDao()

Dao org.turro.entities.DefaultElephantEntity.getDao ( )
protected

Definition at line 241 of file DefaultElephantEntity.java.

241  {
242  if(_dao == null) {
243  _dao = createDao();
244  }
245  return _dao;
246  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDeliverables()

Folder org.turro.entities.DefaultElephantEntity.getDeliverables ( )

Implements org.turro.entities.IElephantEntity.

Definition at line 336 of file DefaultElephantEntity.java.

336  {
337  return StandardFolder.internal()
338  .real()
339  .entityPath(getPath())
340  .folder("deliverables")
341  .asFolder();
342  }
Here is the call graph for this function:

◆ getEntitites() [1/2]

Collection org.turro.entities.DefaultElephantEntity.getEntitites ( String  root,
String  search,
int  maxResults 
)

Implements org.turro.entities.IElephantEntity.

Definition at line 136 of file DefaultElephantEntity.java.

136  {
137  return getEntitites(root, search, maxResults, new KeyValueMap(new HashMap()));
138  }
Collection getEntitites(String search, int maxResults)
Here is the call graph for this function:

◆ getEntitites() [2/2]

Collection org.turro.entities.DefaultElephantEntity.getEntitites ( String  search,
int  maxResults 
)

Implements org.turro.entities.IElephantEntity.

Definition at line 131 of file DefaultElephantEntity.java.

131  {
132  return getEntitites(search, maxResults, new KeyValueMap(new HashMap()));
133  }
Here is the caller graph for this function:

◆ getEntityUrl() [1/2]

String org.turro.entities.DefaultElephantEntity.getEntityUrl ( )

Returns the web url for this entity.

Returns
the path string.

Implements org.turro.entities.IElephantEntity.

Definition at line 162 of file DefaultElephantEntity.java.

162  {
163  return getEntityUrl(LinkType.WEB, null);
164  }
Here is the caller graph for this function:

◆ getEntityUrl() [2/2]

String org.turro.entities.DefaultElephantEntity.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.

Implements org.turro.entities.IElephantEntity.

Reimplemented in org.turro.entities.StudentsEntities, and org.turro.entities.ElephantEntities.

Definition at line 187 of file DefaultElephantEntity.java.

187  {
188  if(LinkType.INTERNAL.equals(type)) {
189  return getAppUrl();
190  } else {
191  String ewu = EntityWebUrls.getUrlFromEntity(getEntity());
192  if(ewu != null) {
193  return getReadAllUrl(type, contextPath) + ewu;
194  } else {
195  return getReadAllUrl(type, contextPath) + "?" + MarkerHelper.setObfuscatedPars("item=" + getStringId());
196  }
197  }
198  }
String getReadAllUrl(LinkType type, String contextPath)
Here is the call graph for this function:

◆ getLinkRoot()

String org.turro.entities.DefaultElephantEntity.getLinkRoot ( )

Returns the link root, defaults to path root.

Returns
the path string.

Implements org.turro.entities.IElephantEntity.

Reimplemented in org.turro.entitites.DossierEntities.

Definition at line 156 of file DefaultElephantEntity.java.

156  {
157  getPath();
158  return path != null ? path.getRoot() : null;
159  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMain()

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

Implements org.turro.entities.IElephantEntity.

Reimplemented in org.turro.entitites.DossierEntities, and org.turro.entities.ContactEntities.

Definition at line 352 of file DefaultElephantEntity.java.

352  {
353  return null;
354  }

◆ getMemberUrl()

String org.turro.entities.DefaultElephantEntity.getMemberUrl ( )

Returns the member link for this entity.

Returns
the path string.

Implements org.turro.entities.IElephantEntity.

Definition at line 167 of file DefaultElephantEntity.java.

167  {
168  return getEntityUrl(LinkType.WEB_INTERNAL, null);
169  }
Here is the call graph for this function:

◆ getNameOrLabel()

String org.turro.entities.DefaultElephantEntity.getNameOrLabel ( )

Gets the entity name or label, if name is null.

Returns
the entity string name or label.

Implements org.turro.entities.IElephantEntity.

Definition at line 102 of file DefaultElephantEntity.java.

102  {
103  return Strings.isBlank(getName(), getLabel());
104  }
Here is the call graph for this function:

◆ getObject()

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

◆ getParticipationControl() [1/2]

Object org.turro.entities.DefaultElephantEntity.getParticipationControl ( IConstructor  constructor,
IContact  contact,
ParticipationReason  reason 
)

Implements org.turro.entities.IElephantEntity.

Definition at line 276 of file DefaultElephantEntity.java.

276  {
277  IParticipationCtrl ctrl = Plugins.loadImplementation(IParticipationCtrl.class, "participation-ctrl");
278  ctrl = (IParticipationCtrl) configureCtrl(ctrl, contact);
279  ((IEntityCtrl) ctrl).setConstructor(constructor);
280  ((IEntityCtrl) ctrl).setEntityPath(getPath());
281  ctrl.setReason(reason);
282  ((IEntityCtrl) ctrl).setTemplate(reason.toString().replaceAll("_", "-").toLowerCase());
283  return ctrl;
284  }
Here is the call graph for this function:

◆ getParticipationControl() [2/2]

Object org.turro.entities.DefaultElephantEntity.getParticipationControl ( IConstructor  constructor,
ParticipationReason  reason 
)

Implements org.turro.entities.IElephantEntity.

Definition at line 271 of file DefaultElephantEntity.java.

271  {
272  return getParticipationControl(constructor, Authentication.getIContact(), reason);
273  }
Object getParticipationControl(IConstructor constructor, ParticipationReason reason)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPath()

String org.turro.entities.DefaultElephantEntity.getPath ( )

Gets the entity's path.

Returns
the entityPath string.

Implements org.turro.entities.IElephantEntity.

Definition at line 113 of file DefaultElephantEntity.java.

113  {
114  if(path == null) {
115  path = createPath();
116  }
117  return path != null ? path.getPath() : null;
118  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getReadAllUrl()

String org.turro.entities.DefaultElephantEntity.getReadAllUrl ( LinkType  type,
String  contextPath 
)

Returns the read all web link for this type of entity.

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

Implements org.turro.entities.IElephantEntity.

Definition at line 201 of file DefaultElephantEntity.java.

201  {
202  if(LinkType.WEB.equals(type)) {
203  if(Strings.isBlank(contextPath)) {
204  contextPath = ElephantContext.getEntityWebContext("/" + getLinkRoot());
205  }
206  if(Strings.isBlank(contextPath)) {
207  contextPath = getUserContext();
208  }
209  } else if(LinkType.WEB_INTERNAL.equals(type)) {
210  if(Strings.isBlank(contextPath)) {
211  contextPath = getUserContext();
212  }
213  if(Strings.isBlank(contextPath)) {
214  contextPath = ElephantContext.getEntityWebContext("/" + getLinkRoot());
215  }
216  }
217  return Strings.isBlank(contextPath, "/");
218  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getRelatedByRole()

Collection<Object> org.turro.entities.DefaultElephantEntity.getRelatedByRole ( EntityRole  role,
IContact  contact 
)

Gets entities where contact has the specified role.

Parameters
rolethe role to conform.
contactthe contact to check.
Returns
a collection of entities.

Implements org.turro.entities.IElephantEntity.

Reimplemented in org.turro.entities.FinancialsEntities.

Definition at line 146 of file DefaultElephantEntity.java.

146  {
147  return Collections.EMPTY_LIST;
148  }

◆ getRoot()

String org.turro.entities.DefaultElephantEntity.getRoot ( )

Gets the entity's root.

Returns
the entityPath root string.

Implements org.turro.entities.IElephantEntity.

Definition at line 107 of file DefaultElephantEntity.java.

107  {
108  getPath();
109  return path != null ? path.getRoot(): null;
110  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSendable()

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

Gets sendable control for entity.

Returns
the sendable control.

Implements org.turro.entities.IElephantEntity.

Reimplemented in org.turro.entities.PublicationEntities, and org.turro.entities.ContactEntities.

Definition at line 141 of file DefaultElephantEntity.java.

141  {
142  return null;
143  }

◆ getStringId()

String org.turro.entities.DefaultElephantEntity.getStringId ( )

Returns de id part of the entity's path.

Returns
the id as a string.

Implements org.turro.entities.IElephantEntity.

Definition at line 96 of file DefaultElephantEntity.java.

96  {
97  getPath();
98  return path != null && (path.getSize() > 1) ? path.getNode(1) : EMPTY_ID;
99  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTreeLabel()

String org.turro.entities.DefaultElephantEntity.getTreeLabel ( )

Returns de string label for the entity or entity's path. Usually a generic when the path is a root, or the entity's name.

Returns
the string label.

Implements org.turro.entities.IElephantEntity.

Definition at line 121 of file DefaultElephantEntity.java.

121  {
122  if(path != null && path.isRoot()) {
123  return getLabel();
124  } else if(path.getSize() == 2) {
125  return getName();
126  }
127  return null;
128  }
Here is the call graph for this function:

◆ hashCode()

int org.turro.entities.DefaultElephantEntity.hashCode ( )

Definition at line 359 of file DefaultElephantEntity.java.

359  {
360  int hash = 7;
361  hash = 97 * hash + Objects.hashCode(this.path);
362  return hash;
363  }

◆ hasRelatedRole()

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

Implements org.turro.entities.IElephantEntity.

Reimplemented in org.turro.entitites.DossierEntities, and org.turro.entities.FinancialsEntities.

Definition at line 151 of file DefaultElephantEntity.java.

151  {
152  return false;
153  }

◆ isActor() [1/2]

boolean org.turro.entities.DefaultElephantEntity.isActor ( IContact  contact,
String  actor 
)

Implements org.turro.entities.IElephantEntity.

Definition at line 324 of file DefaultElephantEntity.java.

324  {
325  return Actors.isActorFor(contact, this, actor);
326  }
Here is the call graph for this function:

◆ isActor() [2/2]

boolean org.turro.entities.DefaultElephantEntity.isActor ( String  actor)

Implements org.turro.entities.IElephantEntity.

Definition at line 319 of file DefaultElephantEntity.java.

319  {
320  return Actors.isActorFor(this, actor);
321  }
Here is the call graph for this function:

◆ isEmpty()

boolean org.turro.entities.DefaultElephantEntity.isEmpty ( )

Is the empty controller.

Returns
true when is the empty controller.

Implements org.turro.entities.IElephantEntity.

Definition at line 91 of file DefaultElephantEntity.java.

91  {
92  return getEntity() == null;
93  }
Here is the call graph for this function:

◆ isValidLongEntity()

boolean org.turro.entities.DefaultElephantEntity.isValidLongEntity ( )
protected

Definition at line 232 of file DefaultElephantEntity.java.

232  {
233  getPath();
234  return path.getSize() == 2 && path.getNode(1).matches("[0-9]+");
235  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ itsMine() [1/2]

◆ itsMine() [2/2]

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

Reimplemented in org.turro.entitites.DossierEntities, org.turro.entities.CrmEntities, org.turro.entities.AttachEntities, org.turro.entities.ContactEntities, and org.turro.entities.FinancialsEntities.

Definition at line 220 of file DefaultElephantEntity.java.

220  {
221  return getAllowedRoots().contains(rootPath);
222  }
Collection< String > getAllowedRoots()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parseFollowCtrl()

String org.turro.entities.DefaultElephantEntity.parseFollowCtrl ( IConstructor  constructor)

Implements org.turro.entities.IElephantEntity.

Definition at line 293 of file DefaultElephantEntity.java.

293  {
294  AbstractDirectContentCtrl ctrl = (AbstractDirectContentCtrl) getParticipationControl(constructor, ParticipationReason.REASON_FOLLOW);
295  return ctrl != null ? ctrl.parse(constructor) : "";
296  }
Here is the call graph for this function:

◆ parseSpamCtrl()

String org.turro.entities.DefaultElephantEntity.parseSpamCtrl ( IConstructor  constructor)

Implements org.turro.entities.IElephantEntity.

Definition at line 287 of file DefaultElephantEntity.java.

287  {
288  AbstractDirectContentCtrl ctrl = (AbstractDirectContentCtrl) getParticipationControl(constructor, ParticipationReason.REASON_SPAM);
289  return ctrl != null ? ctrl.parse(constructor) : "";
290  }
Here is the call graph for this function:

Member Data Documentation

◆ entity

Object org.turro.entities.DefaultElephantEntity.entity
protected

Definition at line 59 of file DefaultElephantEntity.java.

◆ entityPath

String org.turro.entities.DefaultElephantEntity.entityPath
protected

Definition at line 57 of file DefaultElephantEntity.java.

◆ path

Path org.turro.entities.DefaultElephantEntity.path
protected

Definition at line 58 of file DefaultElephantEntity.java.


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