BrightSide Workbench Full Report + Source Code
org.turro.indicator.PreprocessClause Class Reference

Public Member Functions

PreprocessClause setRankingRoot (String entityRoot)
 
PreprocessClause setMatchingRoot (String entityRoot)
 
PreprocessClause setRankingField (String pathField)
 
PreprocessClause setMatchingField (String pathField)
 
PreprocessClause setMatchingIsPath ()
 
PreprocessClause setAggregate (String aggregate)
 
PreprocessClause setFilter (String filterEntity)
 
PreprocessClause setVariable (IndicatorVariable variable)
 
PreprocessClause addJoin (String join)
 
PreprocessClause addCondition (String condition)
 
PreprocessClause addNamedValue (String name, Object value)
 
WhereClause getClause ()
 
WhereClause getRankingClause ()
 
WhereClause getMatchingClause ()
 

Static Public Member Functions

static PreprocessClause load (String table)
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 32 of file PreprocessClause.java.

Member Function Documentation

◆ addCondition()

PreprocessClause org.turro.indicator.PreprocessClause.addCondition ( String  condition)

Definition at line 91 of file PreprocessClause.java.

91  {
92  conditions.add(condition);
93  return this;
94  }
Here is the caller graph for this function:

◆ addJoin()

PreprocessClause org.turro.indicator.PreprocessClause.addJoin ( String  join)

Definition at line 86 of file PreprocessClause.java.

86  {
87  joins.add(join);
88  return this;
89  }
Here is the caller graph for this function:

◆ addNamedValue()

PreprocessClause org.turro.indicator.PreprocessClause.addNamedValue ( String  name,
Object  value 
)

Definition at line 96 of file PreprocessClause.java.

96  {
97  namedValues.put(name, value);
98  return this;
99  }
Here is the caller graph for this function:

◆ getClause()

WhereClause org.turro.indicator.PreprocessClause.getClause ( )

Definition at line 101 of file PreprocessClause.java.

101  {
102  if(Strings.isBlank(relatedRoot)) {
103  return getRankingClause();
104  } else {
105  return getMatchingClause();
106  }
107  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMatchingClause()

WhereClause org.turro.indicator.PreprocessClause.getMatchingClause ( )

Definition at line 133 of file PreprocessClause.java.

133  {
134  WhereClause wc = new WhereClause();
135  wc.addClause("select new org.turro.matching.GenericMatching(");
136  String relatedConcat = matchingPath ? relatedField :
137  "concat('/" + relatedRoot + "/'," + relatedField + ")";
138  wc.addClause(pathField + ", " + relatedConcat + ", '" + variable.getName() + "', " + aggregate + ")");
139  wc.addClause("from " + table);
140  for(String join : joins) {
141  wc.addClause(join);
142  }
143  if(!Strings.isBlank(filterEntity)) {
144  wc.addClause("where " + pathField + " like concat(:entity, '%')");
145  wc.addNamedValue("entity", filterEntity);
146  } else {
147  wc.addClause("where " + pathField + " like concat('/', :root, '/%')");
148  wc.addNamedValue("root", entityRoot);
149  }
150  wc.addClause("and " + relatedConcat + " like concat('/', :rroot, '/%')");
151  wc.addNamedValue("rroot", relatedRoot);
152  for(String condition : conditions) {
153  wc.addClause(condition);
154  }
155  namedValues.keySet().forEach(k -> wc.addNamedValue(k, namedValues.get(k)));
156  wc.addClause("group by " + pathField + "," + relatedConcat);
157  wc.addClause("having " + aggregate + " <> 0");
158  return wc;
159  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getRankingClause()

WhereClause org.turro.indicator.PreprocessClause.getRankingClause ( )

Definition at line 109 of file PreprocessClause.java.

109  {
110  WhereClause wc = new WhereClause();
111  wc.addClause("select new org.turro.ranking.GenericRanking(");
112  wc.addClause(pathField + ", '" + variable.getName() + "', " + aggregate + ")");
113  wc.addClause("from " + table);
114  for(String join : joins) {
115  wc.addClause(join);
116  }
117  if(!Strings.isBlank(filterEntity)) {
118  wc.addClause("where " + pathField + " like concat(:entity, '%')");
119  wc.addNamedValue("entity", filterEntity);
120  } else {
121  wc.addClause("where " + pathField + " like concat('/', :root, '/%')");
122  wc.addNamedValue("root", entityRoot);
123  }
124  for(String condition : conditions) {
125  wc.addClause(condition);
126  }
127  namedValues.keySet().forEach(k -> wc.addNamedValue(k, namedValues.get(k)));
128  wc.addClause("group by " + pathField);
129  wc.addClause("having " + aggregate + " <> 0");
130  return wc;
131  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load()

static PreprocessClause org.turro.indicator.PreprocessClause.load ( String  table)
static

Definition at line 42 of file PreprocessClause.java.

42  {
43  return new PreprocessClause(table);
44  }
Here is the caller graph for this function:

◆ setAggregate()

PreprocessClause org.turro.indicator.PreprocessClause.setAggregate ( String  aggregate)

Definition at line 71 of file PreprocessClause.java.

71  {
72  this.aggregate = aggregate;
73  return this;
74  }
Here is the caller graph for this function:

◆ setFilter()

PreprocessClause org.turro.indicator.PreprocessClause.setFilter ( String  filterEntity)

Definition at line 76 of file PreprocessClause.java.

76  {
77  this.filterEntity = filterEntity;
78  return this;
79  }

◆ setMatchingField()

PreprocessClause org.turro.indicator.PreprocessClause.setMatchingField ( String  pathField)

Definition at line 61 of file PreprocessClause.java.

61  {
62  this.relatedField = pathField;
63  return this;
64  }
Here is the caller graph for this function:

◆ setMatchingIsPath()

PreprocessClause org.turro.indicator.PreprocessClause.setMatchingIsPath ( )

Definition at line 66 of file PreprocessClause.java.

66  {
67  this.matchingPath = true;
68  return this;
69  }
Here is the caller graph for this function:

◆ setMatchingRoot()

PreprocessClause org.turro.indicator.PreprocessClause.setMatchingRoot ( String  entityRoot)

Definition at line 51 of file PreprocessClause.java.

51  {
52  this.relatedRoot = entityRoot;
53  return this;
54  }
Here is the caller graph for this function:

◆ setRankingField()

PreprocessClause org.turro.indicator.PreprocessClause.setRankingField ( String  pathField)

Definition at line 56 of file PreprocessClause.java.

56  {
57  this.pathField = pathField;
58  return this;
59  }
Here is the caller graph for this function:

◆ setRankingRoot()

PreprocessClause org.turro.indicator.PreprocessClause.setRankingRoot ( String  entityRoot)

Definition at line 46 of file PreprocessClause.java.

46  {
47  this.entityRoot = entityRoot;
48  return this;
49  }
Here is the caller graph for this function:

◆ setVariable()

PreprocessClause org.turro.indicator.PreprocessClause.setVariable ( IndicatorVariable  variable)

Definition at line 81 of file PreprocessClause.java.

81  {
82  this.variable = variable;
83  return this;
84  }
Here is the caller graph for this function:

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