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

Public Member Functions

 CustomerResults ()
 
java.util.List getCustomerList ()
 
WhereClause createCriteria ()
 
IContact getByParticipant ()
 
void setByParticipant (IContact byParticipant)
 
boolean isCkOthers ()
 
void setCkOthers (boolean ckOthers)
 
String getCustomerValue ()
 
void setCustomerValue (String customerValue)
 

Detailed Description

Author
llturro

Definition at line 16 of file CustomerResults.java.

Constructor & Destructor Documentation

◆ CustomerResults()

org.turro.crm.search.CustomerResults.CustomerResults ( )

Definition at line 24 of file CustomerResults.java.

24  {
25  }

Member Function Documentation

◆ createCriteria()

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

Definition at line 32 of file CustomerResults.java.

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

◆ getByParticipant()

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

Definition at line 75 of file CustomerResults.java.

75  {
76  return byParticipant;
77  }

◆ getCustomerList()

java.util.List org.turro.crm.search.CustomerResults.getCustomerList ( )

Definition at line 27 of file CustomerResults.java.

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

◆ getCustomerValue()

String org.turro.crm.search.CustomerResults.getCustomerValue ( )

Definition at line 91 of file CustomerResults.java.

91  {
92  return customerValue;
93  }

◆ isCkOthers()

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

Definition at line 83 of file CustomerResults.java.

83  {
84  return ckOthers;
85  }

◆ setByParticipant()

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

Definition at line 79 of file CustomerResults.java.

79  {
80  this.byParticipant = byParticipant;
81  }

◆ setCkOthers()

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

Definition at line 87 of file CustomerResults.java.

87  {
88  this.ckOthers = ckOthers;
89  }

◆ setCustomerValue()

void org.turro.crm.search.CustomerResults.setCustomerValue ( String  customerValue)

Definition at line 95 of file CustomerResults.java.

95  {
96  this.customerValue = customerValue;
97  }

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