BrightSide Workbench Full Report + Source Code
org.turro.crm.search.SaleProspectResults Class Reference

Public Member Functions

 SaleProspectResults ()
 
java.util.List< SaleProspectgetSaleProspectList ()
 
WhereClause createCriteria ()
 
IContact getByParticipant ()
 
void setByParticipant (IContact byParticipant)
 
boolean isCkOthers ()
 
void setCkOthers (boolean ckOthers)
 
String getSaleProspectValue ()
 
void setSaleProspectValue (String saleProspectValue)
 

Detailed Description

Author
llturro

Definition at line 17 of file SaleProspectResults.java.

Constructor & Destructor Documentation

◆ SaleProspectResults()

org.turro.crm.search.SaleProspectResults.SaleProspectResults ( )

Definition at line 25 of file SaleProspectResults.java.

25  {
26  }

Member Function Documentation

◆ createCriteria()

WhereClause org.turro.crm.search.SaleProspectResults.createCriteria ( )

Definition at line 33 of file SaleProspectResults.java.

33  {
34  WhereClause wc = new WhereClause();
35 
36  wc.addClause("select distinct saleProspect from SaleProspect as saleProspect");
37  wc.addClause("where 1=1");
38 
39  if(Strings.isEmpty(saleProspectValue) || (ckOthers && !app.isInRole("sale-prospect:all"))) {
40  wc.addClause("order by saleProspect.prospectDate");
41  return wc;
42  }
43 
44  if(byParticipant == null) {
45  byParticipant = Authentication.getIContact();
46  }
47 
48  wc = SQLHelper.getWhereClause(wc, new String[] {
49  "saleProspect.description"
50  }, (saleProspectValue == null ? "" : saleProspectValue.replaceAll("\\*", "%")));
51 
52  if(!(ckOthers && app.isInRole("sale-prospect:all"))) {
53  wc.addClause("and ( exists (");
54 
55  wc.addClause(
56  "select co from CustomerOwner as co where co.vendor.idContact = :idOwner " +
57  "and co.customer = saleProspect.customer"
58  );
59  wc.addNamedValue("idOwner", byParticipant.getId());
60 
61  wc.addClause(") or exists (");
62 
63  wc.addClause(
64  "select vp from VendorProspect as vp where vp.vendor.idContact = :idVendor " +
65  "and vp.saleProspect = saleProspect"
66  );
67  wc.addNamedValue("idVendor", byParticipant.getId());
68 
69  wc.addClause("))");
70  }
71 
72  wc.addClause("order by saleProspect.prospectDate");
73 
74  return wc;
75  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getByParticipant()

IContact org.turro.crm.search.SaleProspectResults.getByParticipant ( )

Definition at line 77 of file SaleProspectResults.java.

77  {
78  return byParticipant;
79  }

◆ getSaleProspectList()

java.util.List<SaleProspect> org.turro.crm.search.SaleProspectResults.getSaleProspectList ( )

Definition at line 28 of file SaleProspectResults.java.

28  {
29  Dao dao = new CrmPU();
30  return dao.getResultList(createCriteria());
31  }
Here is the call graph for this function:

◆ getSaleProspectValue()

String org.turro.crm.search.SaleProspectResults.getSaleProspectValue ( )

Definition at line 93 of file SaleProspectResults.java.

93  {
94  return saleProspectValue;
95  }

◆ isCkOthers()

boolean org.turro.crm.search.SaleProspectResults.isCkOthers ( )

Definition at line 85 of file SaleProspectResults.java.

85  {
86  return ckOthers;
87  }

◆ setByParticipant()

void org.turro.crm.search.SaleProspectResults.setByParticipant ( IContact  byParticipant)

Definition at line 81 of file SaleProspectResults.java.

81  {
82  this.byParticipant = byParticipant;
83  }

◆ setCkOthers()

void org.turro.crm.search.SaleProspectResults.setCkOthers ( boolean  ckOthers)

Definition at line 89 of file SaleProspectResults.java.

89  {
90  this.ckOthers = ckOthers;
91  }

◆ setSaleProspectValue()

void org.turro.crm.search.SaleProspectResults.setSaleProspectValue ( String  saleProspectValue)

Definition at line 97 of file SaleProspectResults.java.

97  {
98  this.saleProspectValue = saleProspectValue;
99  }

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