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

Public Member Functions

 CrmEntities ()
 
 CrmEntities (String entityPath)
 
 CrmEntities (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 ()
 
- 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 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 (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 49 of file CrmEntities.java.

Constructor & Destructor Documentation

◆ CrmEntities() [1/3]

org.turro.entities.CrmEntities.CrmEntities ( )

Definition at line 51 of file CrmEntities.java.

51  {
52  }
Here is the caller graph for this function:

◆ CrmEntities() [2/3]

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

Definition at line 54 of file CrmEntities.java.

◆ CrmEntities() [3/3]

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

Definition at line 58 of file CrmEntities.java.

58  {
59  super(entity);
60  }

Member Function Documentation

◆ canEdit()

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

228  {
229  if(getEntity() != null) {
230  if(entity instanceof Vendor) {
231  return contact.getPermissions().isInRole("vendor:edit");
232  } else if(entity instanceof Customer) {
233  return contact.getPermissions().isInRole("customer:edit");
234  } else if(entity instanceof Campaign) {
235  return contact.getPermissions().isInRole("campaign:edit");
236  } else if(entity instanceof SaleProspect) {
237  return contact.getPermissions().isInRole("sale-prospect:edit");
238  } else if(entity instanceof SaleAction) {
239  return contact.getPermissions().isInRole("sale-action:edit");
240  }
241  }
242  return false;
243  }
Here is the call graph for this function:

◆ canPublish()

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

246  {
247  if(getEntity() != null) {
248  if(entity instanceof Vendor) {
249  return contact.getPermissions().isInRole("vendor:list");
250  } else if(entity instanceof Customer) {
251  return contact.getPermissions().isInRole("customer:list");
252  } else if(entity instanceof Campaign) {
253  return contact.getPermissions().isInRole("campaign:list");
254  } else if(entity instanceof SaleProspect) {
255  return contact.getPermissions().isInRole("sale-prospect:list");
256  } else if(entity instanceof SaleAction) {
257  return contact.getPermissions().isInRole("sale-action:list");
258  }
259  }
260  return false;
261  }
Here is the call graph for this function:

◆ canShowInContext()

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

293  {
294  return true;
295  }

◆ configureCtrl()

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

288  {
289  return ctrl;
290  }

◆ createDao()

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

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 308 of file CrmEntities.java.

308  {
309  return new CrmPU();
310  }

◆ createInstance() [1/2]

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

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 336 of file CrmEntities.java.

336  {
337  return new CrmEntities(entity);
338  }
Here is the call graph for this function:

◆ createInstance() [2/2]

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

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 331 of file CrmEntities.java.

331  {
332  return new CrmEntities(entityPath);
333  }
Here is the call graph for this function:

◆ createPath()

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

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 341 of file CrmEntities.java.

341  {
342  return new Path(CrmPU.getObjectPath(entity));
343  }
Here is the call graph for this function:

◆ getAllowedRoots()

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

Implements org.turro.entities.IElephantEntity.

Definition at line 325 of file CrmEntities.java.

325  {
326  return Arrays.asList("vendor", "customer", "campaign", "sale-prospect",
327  "vendor-prospect", "sale-action");
328  }
Here is the caller graph for this function:

◆ getChildren()

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

Gets the children for this entity.

Returns
the children controllers.

Implements org.turro.entities.IElephantEntity.

Definition at line 183 of file CrmEntities.java.

183  {
184  return Collections.EMPTY_LIST;
185  }

◆ getDescription()

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

Gets the entity description.

Returns
the description string.

Implements org.turro.entities.IElephantEntity.

Definition at line 138 of file CrmEntities.java.

138  {
139  return null;
140  }

◆ getEntitites() [1/2]

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

Implements org.turro.entities.IElephantEntity.

Definition at line 272 of file CrmEntities.java.

272  {
273  ArrayList<Object> list = new ArrayList<>();
274  if(null != root) switch (root) {
275  case "vendor":
276  list.addAll(searchVendors(search, maxResults, kvm));
277  break;
278  case "customer":
279  list.addAll(searchCustomers(search, maxResults, kvm));
280  break;
281  default:
282  break;
283  }
284  return list;
285  }

◆ getEntitites() [2/2]

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

Implements org.turro.entities.IElephantEntity.

Definition at line 264 of file CrmEntities.java.

264  {
265  ArrayList<Object> list = new ArrayList<>();
266  list.addAll(searchVendors(search, maxResults, kvm));
267  list.addAll(searchCustomers(search, maxResults, kvm));
268  return list;
269  }

◆ getEntity()

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

Returns the entity for this controller.

Returns
the entity's object.

Implements org.turro.entities.IElephantEntity.

Definition at line 63 of file CrmEntities.java.

63  {
64  if(entity == null) {
65  if(getPath() != null) {
66  if(isValidLongEntity()) {
67  if(null != path.getRoot()) switch (path.getRoot()) {
68  case "vendor":
69  entity = getDao().find(Vendor.class, path.getNodeAs(1, Long.class));
70  break;
71  case "customer":
72  entity = getDao().find(Customer.class, path.getNodeAs(1, Long.class));
73  break;
74  case "campaign":
75  entity = getDao().find(Campaign.class, path.getNodeAs(1, Long.class));
76  break;
77  case "sale-prospect":
78  entity = getDao().find(SaleProspect.class, path.getNodeAs(1, Long.class));
79  break;
80  case "vendor-prospect":
81  entity = getDao().find(VendorProspect.class, path.getNodeAs(1, Long.class));
82  break;
83  case "sale-action":
84  entity = getDao().find(SaleAction.class, path.getNodeAs(1, Long.class));
85  break;
86  default:
87  break;
88  }
89  }
90  }
91  }
92  return entity;
93  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getExtendedPath()

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

Gets the extended path for this entity.

Returns
the extended path string.

Implements org.turro.entities.IElephantEntity.

Definition at line 188 of file CrmEntities.java.

188  {
189  return "";
190  }

◆ getExtendedWebPath()

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

Returns a unique path for the entity.

Returns
the path string.

Implements org.turro.entities.IElephantEntity.

Definition at line 298 of file CrmEntities.java.

298  {
299  return null;
300  }

◆ getFile()

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

Gets the file represented by the entity.

Returns
the entity file.

Implements org.turro.entities.IElephantEntity.

Definition at line 193 of file CrmEntities.java.

193  {
194  return null;
195  }

◆ getHierarchicalPath()

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

173  {
174  return getPath();
175  }
Here is the call graph for this function:

◆ getImage()

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

Gets the entity image based on its root.

Returns
the string image location.

Implements org.turro.entities.IElephantEntity.

Definition at line 151 of file CrmEntities.java.

151  {
152  if(getPath() != null) {
153  String root = path.getRoot();
154  if(null != root) switch (root) {
155  case "vendor":
156  return "/_zul/images/vendor.png";
157  case "customer":
158  return "/_zul/images/customer.png";
159  case "campaign":
160  return "/_zul/images/campaign.png";
161  case "sale-prospect":
162  return "/_zul/images/sale.png";
163  case "sale-action":
164  return "/_zul/images/appointment.png";
165  default:
166  break;
167  }
168  }
169  return null;
170  }
Here is the call graph for this function:

◆ getLabel()

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

114  {
115  if(getPath() != null) {
116  String root = path.getRoot();
117  if(null != root) switch (root) {
118  case "vendor":
119  return I_.get("Vendor");
120  case "customer":
121  return I_.get("Customer");
122  case "campaign":
123  return I_.get("Campaign");
124  case "sale-prospect":
125  return I_.get("Sale prospect");
126  case "vendor-prospect":
127  return I_.get("Vendor prospect");
128  case "sale-action":
129  return I_.get("Sale action");
130  default:
131  break;
132  }
133  }
134  return null;
135  }
Here is the call graph for this function:

◆ getLabelCtrl()

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

Gets the label control, usually a clickable LabelControl class.

Returns
a clickable label control.

Implements org.turro.entities.IElephantEntity.

Definition at line 143 of file CrmEntities.java.

143  {
144  if(getEntity() != null) {
145  return new LabelControl(entity);
146  }
147  return null;
148  }
Here is the call graph for this function:

◆ getName()

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

Gets the entity name.

Returns
the string name.

Implements org.turro.entities.IElephantEntity.

Definition at line 96 of file CrmEntities.java.

96  {
97  if(getEntity() != null) {
98  if(entity instanceof Vendor) {
99  return ((Vendor) entity).getName();
100  } else if(entity instanceof Customer) {
101  return ((Customer) entity).getName();
102  } else if(entity instanceof Campaign) {
103  return ((Campaign) entity).getDescription();
104  } else if(entity instanceof SaleProspect) {
105  return ((SaleProspect) entity).getFullDescription();
106  } else if(entity instanceof SaleAction) {
107  return ((SaleAction) entity).getComment();
108  }
109  }
110  return null;
111  }
Here is the call graph for this function:

◆ getParent()

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

Gets the parent for this entity.

Returns
the parent controller.

Implements org.turro.entities.IElephantEntity.

Definition at line 178 of file CrmEntities.java.

178  {
179  return null;
180  }

◆ getUserContext()

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

Returns the user context for this type of entity

Returns
the path string;

Implements org.turro.entities.IElephantEntity.

Definition at line 303 of file CrmEntities.java.

303  {
304  return null;
305  }

◆ itsMine() [1/2]

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

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 318 of file CrmEntities.java.

318  {
319  return (entity instanceof Vendor) || (entity instanceof Customer) ||
320  (entity instanceof Campaign) || (entity instanceof SaleProspect) ||
321  (entity instanceof VendorProspect) || (entity instanceof SaleAction);
322  }

◆ itsMine() [2/2]

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

Reimplemented from org.turro.entities.DefaultElephantEntity.

Definition at line 313 of file CrmEntities.java.

313  {
314  return getAllowedRoots().contains(rootPath);
315  }
Collection< String > getAllowedRoots()
Here is the call graph for this function:

◆ showEntity()

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

Shows the view for the entity.

Returns
true when a view is shown.

Implements org.turro.entities.IElephantEntity.

Definition at line 203 of file CrmEntities.java.

203  {
204  if(getEntity() != null) {
205  if(entity instanceof Vendor) {
206  CrmMenu.showVendor(((Vendor) entity).getId());
207  return true;
208  } else if(entity instanceof Customer) {
209  CrmMenu.showCustomer(((Customer) entity).getId());
210  return true;
211  } else if(entity instanceof Campaign) {
212  CrmMenu.showCampaign(((Campaign) entity).getId());
213  return true;
214  } else if(entity instanceof SaleProspect) {
215  CrmMenu.showSaleProspect(((SaleProspect) entity).getId());
216  return true;
217  } else if(entity instanceof SaleAction) {
218  SaleAction sa = (SaleAction) entity;
219  VendorProspect vp = sa.getVendorProspect();
220  CrmMenu.showSaleActions(vp.getVendor(), vp.getSaleProspect());
221  return true;
222  }
223  }
224  return false;
225  }
Here is the call graph for this function:

◆ showPath()

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

Shows the view for this path.

Returns
true when a view is shown.

Implements org.turro.entities.IElephantEntity.

Definition at line 198 of file CrmEntities.java.

198  {
199  return false;
200  }

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