BrightSide Workbench Full Report + Source Code
FormulaResults.java
Go to the documentation of this file.
1 package org.turro.crm.search;
2 
3 import org.turro.crm.db.CrmPU;
4 import org.turro.crm.entity.Formula;
5 import org.turro.crm.entity.FormulaType;
6 import org.turro.elephant.db.WhereClause;
7 import org.turro.jpa.Dao;
8 
13 public class FormulaResults {
14 
15  private FormulaType type;
16 
17  public FormulaResults() {
18  this(null);
19  }
20 
21  public FormulaResults(FormulaType type) {
22  this.type = type;
23  }
24 
25  public java.util.List<Formula> getFormulaList() {
26  Dao dao = new CrmPU();
27  return dao.getResultList(createCriteria());
28  }
29 
31  WhereClause wc = new WhereClause();
32 
33  wc.addClause("select distinct formula from Formula as formula");
34  wc.addClause("where 1=1");
35 
36  if(type != null) {
37  wc.addClause("and formula.type = :type");
38  wc.addNamedValue("type", type);
39  }
40 
41  wc.addClause("order by formula.name");
42 
43  return wc;
44  }
45 
46 }
java.util.List< Formula > getFormulaList()
void addNamedValue(String name, Object value)