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

Public Member Functions

 SaleActionResults ()
 
java.util.List getSaleActionList ()
 
WhereClause createCriteria ()
 
IContact getByParticipant ()
 
void setByParticipant (IContact byParticipant)
 
boolean isCkDone ()
 
void setCkDone (boolean ckDone)
 
boolean isCkOthers ()
 
void setCkOthers (boolean ckOthers)
 
String getSaleActionValue ()
 
void setSaleActionValue (String saleActionValue)
 
SaleProspect getSaleProspect ()
 
void setSaleProspect (SaleProspect saleProspect)
 

Detailed Description

Author
llturro

Definition at line 17 of file SaleActionResults.java.

Constructor & Destructor Documentation

◆ SaleActionResults()

org.turro.crm.search.SaleActionResults.SaleActionResults ( )

Definition at line 26 of file SaleActionResults.java.

26  {
27  }

Member Function Documentation

◆ createCriteria()

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

Definition at line 34 of file SaleActionResults.java.

34  {
35  WhereClause wc = new WhereClause();
36 
37  wc.addClause("select distinct saleAction");
38  wc.addClause("from SaleAction as saleAction");
39  wc.addClause("where 1=1");
40 
41  if(Strings.isEmpty(saleActionValue) || (ckOthers && !app.isInRole("sale-prospect:all"))) {
42  //TODO: check if necessary wc.addClause("and 0=1");
43  wc.addClause("order by saleAction.actionDate");
44  return wc;
45  }
46 
47  if(byParticipant == null) {
48  byParticipant = Authentication.getIContact();
49  }
50 
51  wc = SQLHelper.getWhereClause(wc, new String[] {
52  "saleAction.comment"
53  }, (saleActionValue == null ? "" : saleActionValue.replaceAll("\\*", "%")));
54 
55  if(!(ckOthers && app.isInRole("sale-prospect:all"))) {
56  wc.addClause("and ( exists (");
57 
58  wc.addClause(
59  "select co from CustomerOwner as co where co.vendor.idContact = :idOwner " +
60  "and co.customer = saleAction.vendorProspect.saleProspect.customer"
61  );
62  wc.addNamedValue("idOwner", byParticipant.getId());
63 
64  wc.addClause(") or exists (");
65 
66  wc.addClause(
67  "select vp from VendorProspect as vp where vp.vendor.idContact = :idVendor " +
68  "and vp.saleProspect = saleAction.vendorProspect.saleProspect"
69  );
70  wc.addNamedValue("idVendor", byParticipant.getId());
71 
72  wc.addClause("))");
73  }
74 
75  if(!ckDone) {
76  wc.addClause("and saleAction.done = FALSE");
77  }
78 
79  if(saleProspect != null) {
80  wc.addClause("and saleAction.vendorProspect.saleProspect = :saleProspect");
81  wc.addNamedValue("saleProspect", saleProspect);
82  }
83 
84  wc.addClause("order by saleAction.actionDate");
85 
86  return wc;
87  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getByParticipant()

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

Definition at line 89 of file SaleActionResults.java.

89  {
90  return byParticipant;
91  }

◆ getSaleActionList()

java.util.List org.turro.crm.search.SaleActionResults.getSaleActionList ( )

Definition at line 29 of file SaleActionResults.java.

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

◆ getSaleActionValue()

String org.turro.crm.search.SaleActionResults.getSaleActionValue ( )

Definition at line 113 of file SaleActionResults.java.

113  {
114  return saleActionValue;
115  }

◆ getSaleProspect()

SaleProspect org.turro.crm.search.SaleActionResults.getSaleProspect ( )

Definition at line 121 of file SaleActionResults.java.

121  {
122  return saleProspect;
123  }

◆ isCkDone()

boolean org.turro.crm.search.SaleActionResults.isCkDone ( )

Definition at line 97 of file SaleActionResults.java.

97  {
98  return ckDone;
99  }

◆ isCkOthers()

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

Definition at line 105 of file SaleActionResults.java.

105  {
106  return ckOthers;
107  }

◆ setByParticipant()

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

Definition at line 93 of file SaleActionResults.java.

93  {
94  this.byParticipant = byParticipant;
95  }

◆ setCkDone()

void org.turro.crm.search.SaleActionResults.setCkDone ( boolean  ckDone)

Definition at line 101 of file SaleActionResults.java.

101  {
102  this.ckDone = ckDone;
103  }

◆ setCkOthers()

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

Definition at line 109 of file SaleActionResults.java.

109  {
110  this.ckOthers = ckOthers;
111  }

◆ setSaleActionValue()

void org.turro.crm.search.SaleActionResults.setSaleActionValue ( String  saleActionValue)

Definition at line 117 of file SaleActionResults.java.

117  {
118  this.saleActionValue = saleActionValue;
119  }

◆ setSaleProspect()

void org.turro.crm.search.SaleActionResults.setSaleProspect ( SaleProspect  saleProspect)

Definition at line 125 of file SaleActionResults.java.

125  {
126  this.saleProspect = saleProspect;
127  }

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