BrightSide Workbench Full Report + Source Code
org.turro.indicator.AbstractIndicator Class Referenceabstract
Inheritance diagram for org.turro.indicator.AbstractIndicator:
Collaboration diagram for org.turro.indicator.AbstractIndicator:

Public Member Functions

void initIndicator ()
 
void prepareIndicator ()
 
void generateSiblings ()
 
String getRoot ()
 
List< IndicatorVariablegetVariables ()
 
List< IndicatorVariablegetAllVariables ()
 
IndicatorVariable getVariable (String name)
 
List< IndicatorVariablegetAllRankingVariables (String root)
 
List< IndicatorVariablegetAllMatchingVariables (String root)
 
double getValue (IndicatorVariable variable, Object entity)
 
double getValue (IndicatorVariable variable, Object entity, String relatedPath)
 
IndicatorResult readIndicator (String storeClass, String indicator)
 
void preprocess (IndicatorVariable variable, IPreprocessor preprocessor, String entityRoot, String relatedRoot)
 
void postprocess (IndicatorVariable variable, IPreprocessor postprocessor, String entityRoot, String relatedRoot)
 
Stream< String > getEntityPaths (String root)
 
Stream< GenericSiblingsgetSiblingPaths (String entityPath)
 
Dao getDao ()
 
boolean itsMine (String root)
 
boolean itsMine (IndicatorVariable variable)
 

Protected Member Functions

void addVariable (String name, VariableType type)
 
void addVariable (String name, VariableType type, boolean reversed)
 
void addVariable (String name, VariableType type, String avoid)
 
void addVariable (String name, boolean preprocess, VariableType type)
 
void addVariable (String name, boolean preprocess, VariableType type, boolean reversed)
 
void addVariable (String name, boolean preprocess, VariableType type, String avoid)
 
void addExternalVariable (String root, String name)
 
String getPath (Object entity)
 
abstract void initVariables ()
 
abstract void initExternalVariables ()
 
abstract void processRankingVariable (Dao dao, IPreprocessor preprocessor, IndicatorVariable variable, String entityRoot)
 
abstract void processMatchingVariable (Dao dao, IPreprocessor preprocessor, IndicatorVariable variable, String entityRoot, String relatedRoot)
 
void postprocessRankingVariable (Dao dao, IPreprocessor postprocessor, IndicatorVariable variable, String entityRoot)
 
void postprocessMatchingVariable (Dao dao, IPreprocessor postprocessor, IndicatorVariable variable, String entityRoot, String relatedRoot)
 
abstract Dao createDao ()
 

Protected Attributes

List< IndicatorVariablevariables = new ArrayList<>()
 
String root
 

Detailed Description

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

Definition at line 37 of file AbstractIndicator.java.

Member Function Documentation

◆ addExternalVariable()

void org.turro.indicator.AbstractIndicator.addExternalVariable ( String  root,
String  name 
)
protected

Definition at line 86 of file AbstractIndicator.java.

86  {
87  IndicatorVariable variable = Indicators.getVariable(root, name);
88  if(variable != null) variables.add(variable);
89  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addVariable() [1/6]

void org.turro.indicator.AbstractIndicator.addVariable ( String  name,
boolean  preprocess,
VariableType  type 
)
protected

Definition at line 74 of file AbstractIndicator.java.

74  {
75  variables.add(new IndicatorVariable(root, name, preprocess, type));
76  }
void preprocess(IndicatorVariable variable, IPreprocessor preprocessor, String entityRoot, String relatedRoot)
Here is the call graph for this function:

◆ addVariable() [2/6]

void org.turro.indicator.AbstractIndicator.addVariable ( String  name,
boolean  preprocess,
VariableType  type,
boolean  reversed 
)
protected

Definition at line 78 of file AbstractIndicator.java.

78  {
79  variables.add(new IndicatorVariable(root, name, preprocess, type, reversed));
80  }
Here is the call graph for this function:

◆ addVariable() [3/6]

void org.turro.indicator.AbstractIndicator.addVariable ( String  name,
boolean  preprocess,
VariableType  type,
String  avoid 
)
protected

Definition at line 82 of file AbstractIndicator.java.

82  {
83  variables.add(new IndicatorVariable(root, name, preprocess, type, avoid));
84  }
Here is the call graph for this function:

◆ addVariable() [4/6]

void org.turro.indicator.AbstractIndicator.addVariable ( String  name,
VariableType  type 
)
protected

Definition at line 62 of file AbstractIndicator.java.

62  {
63  variables.add(new IndicatorVariable(root, name, false, type));
64  }
Here is the caller graph for this function:

◆ addVariable() [5/6]

void org.turro.indicator.AbstractIndicator.addVariable ( String  name,
VariableType  type,
boolean  reversed 
)
protected

Definition at line 66 of file AbstractIndicator.java.

66  {
67  variables.add(new IndicatorVariable(root, name, false, type, reversed));
68  }

◆ addVariable() [6/6]

void org.turro.indicator.AbstractIndicator.addVariable ( String  name,
VariableType  type,
String  avoid 
)
protected

Definition at line 70 of file AbstractIndicator.java.

70  {
71  variables.add(new IndicatorVariable(root, name, false, type, avoid));
72  }

◆ createDao()

◆ generateSiblings()

void org.turro.indicator.AbstractIndicator.generateSiblings ( )

Implements org.turro.indicator.IElephantIndicator.

Reimplemented in org.turro.indicator.DossierIndicator, and org.turro.indicator.ContactIndicator.

Definition at line 53 of file AbstractIndicator.java.

53  {
54  // Do nothing
55  }

◆ getAllMatchingVariables()

List<IndicatorVariable> org.turro.indicator.AbstractIndicator.getAllMatchingVariables ( String  root)

Implements org.turro.indicator.IElephantIndicator.

Definition at line 112 of file AbstractIndicator.java.

112  {
113  return variables.stream().filter(v -> v.permits(root) && v.getType().isMatching()).collect(Collectors.toList());
114  }

◆ getAllRankingVariables()

List<IndicatorVariable> org.turro.indicator.AbstractIndicator.getAllRankingVariables ( String  root)

Implements org.turro.indicator.IElephantIndicator.

Definition at line 107 of file AbstractIndicator.java.

107  {
108  return variables.stream().filter(v -> v.permits(root) && v.getType().isRanking()).collect(Collectors.toList());
109  }

◆ getAllVariables()

List<IndicatorVariable> org.turro.indicator.AbstractIndicator.getAllVariables ( )

Implements org.turro.indicator.IElephantIndicator.

Definition at line 97 of file AbstractIndicator.java.

97  {
98  return variables;
99  }

◆ getDao()

Dao org.turro.indicator.AbstractIndicator.getDao ( )

Definition at line 228 of file AbstractIndicator.java.

228  {
229  if(_dao == null) {
230  _dao = createDao();
231  }
232  return _dao;
233  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getEntityPaths()

Stream<String> org.turro.indicator.AbstractIndicator.getEntityPaths ( String  root)

Implements org.turro.indicator.IElephantIndicator.

Reimplemented in org.turro.indicator.GenericIndicator.

Definition at line 215 of file AbstractIndicator.java.

215  {
216  throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
217  }

◆ getPath()

String org.turro.indicator.AbstractIndicator.getPath ( Object  entity)
protected

Definition at line 173 of file AbstractIndicator.java.

173  {
174  return (entity instanceof String) ? (String) entity : Entities.getController(entity).getPath();
175  }
Here is the call graph for this function:

◆ getRoot()

String org.turro.indicator.AbstractIndicator.getRoot ( )

Implements org.turro.indicator.IElephantIndicator.

Definition at line 58 of file AbstractIndicator.java.

58  {
59  return root;
60  }

◆ getSiblingPaths()

Stream<GenericSiblings> org.turro.indicator.AbstractIndicator.getSiblingPaths ( String  entityPath)

Implements org.turro.indicator.IElephantIndicator.

Reimplemented in org.turro.indicator.GenericIndicator.

Definition at line 220 of file AbstractIndicator.java.

220  {
221  throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
222  }

◆ getValue() [1/2]

double org.turro.indicator.AbstractIndicator.getValue ( IndicatorVariable  variable,
Object  entity 
)

◆ getValue() [2/2]

double org.turro.indicator.AbstractIndicator.getValue ( IndicatorVariable  variable,
Object  entity,
String  relatedPath 
)

Implements org.turro.indicator.IElephantIndicator.

Reimplemented in org.turro.indicator.StudentIndicator, and org.turro.indicator.ContactIndicator.

Definition at line 122 of file AbstractIndicator.java.

122  {
123  return 0.0;
124  }

◆ getVariable()

IndicatorVariable org.turro.indicator.AbstractIndicator.getVariable ( String  name)

Implements org.turro.indicator.IElephantIndicator.

Definition at line 102 of file AbstractIndicator.java.

102  {
103  return getVariables().stream().filter(v -> name.equals(v.getName())).findAny().get();
104  }
List< IndicatorVariable > getVariables()
Here is the call graph for this function:

◆ getVariables()

List<IndicatorVariable> org.turro.indicator.AbstractIndicator.getVariables ( )

Implements org.turro.indicator.IElephantIndicator.

Definition at line 92 of file AbstractIndicator.java.

92  {
93  return variables.stream().filter(v -> root.equals(v.getRoot())).collect(Collectors.toList());
94  }
Here is the caller graph for this function:

◆ initExternalVariables()

◆ initIndicator()

void org.turro.indicator.AbstractIndicator.initIndicator ( )

Implements org.turro.indicator.IElephantIndicator.

Definition at line 43 of file AbstractIndicator.java.

43  {
44  initVariables();
45  }
Here is the call graph for this function:

◆ initVariables()

◆ itsMine() [1/2]

boolean org.turro.indicator.AbstractIndicator.itsMine ( IndicatorVariable  variable)

Implements org.turro.indicator.IElephantIndicator.

Definition at line 245 of file AbstractIndicator.java.

245  {
246  return getVariables().contains(variable);
247  }
Here is the call graph for this function:

◆ itsMine() [2/2]

boolean org.turro.indicator.AbstractIndicator.itsMine ( String  root)

Implements org.turro.indicator.IElephantIndicator.

Definition at line 240 of file AbstractIndicator.java.

240  {
241  return this.root.equals(root);
242  }
Here is the caller graph for this function:

◆ postprocess()

void org.turro.indicator.AbstractIndicator.postprocess ( IndicatorVariable  variable,
IPreprocessor  postprocessor,
String  entityRoot,
String  relatedRoot 
)

Implements org.turro.indicator.IElephantIndicator.

Definition at line 165 of file AbstractIndicator.java.

165  {
166  if(postprocessor instanceof ProcessRanking) {
167  postprocessRankingVariable(createDao(), postprocessor, variable, entityRoot);
168  } else if(postprocessor instanceof ProcessMatching) {
169  postprocessMatchingVariable(createDao(), postprocessor, variable, entityRoot, relatedRoot);
170  }
171  }
void postprocessRankingVariable(Dao dao, IPreprocessor postprocessor, IndicatorVariable variable, String entityRoot)
void postprocessMatchingVariable(Dao dao, IPreprocessor postprocessor, IndicatorVariable variable, String entityRoot, String relatedRoot)
Here is the call graph for this function:

◆ postprocessMatchingVariable()

void org.turro.indicator.AbstractIndicator.postprocessMatchingVariable ( Dao  dao,
IPreprocessor  postprocessor,
IndicatorVariable  variable,
String  entityRoot,
String  relatedRoot 
)
protected

Definition at line 209 of file AbstractIndicator.java.

210  {}
Here is the caller graph for this function:

◆ postprocessRankingVariable()

void org.turro.indicator.AbstractIndicator.postprocessRankingVariable ( Dao  dao,
IPreprocessor  postprocessor,
IndicatorVariable  variable,
String  entityRoot 
)
protected

Reimplemented in org.turro.indicator.ContactIndicator.

Definition at line 207 of file AbstractIndicator.java.

208  {}
Here is the caller graph for this function:

◆ prepareIndicator()

void org.turro.indicator.AbstractIndicator.prepareIndicator ( )

Implements org.turro.indicator.IElephantIndicator.

Definition at line 48 of file AbstractIndicator.java.

48  {
50  }
Here is the call graph for this function:

◆ preprocess()

void org.turro.indicator.AbstractIndicator.preprocess ( IndicatorVariable  variable,
IPreprocessor  preprocessor,
String  entityRoot,
String  relatedRoot 
)

Implements org.turro.indicator.IElephantIndicator.

Definition at line 150 of file AbstractIndicator.java.

150  {
151  if(variable.isPreprocess()) {
152  if(root.equals(variable.getRoot())) {
153  if(preprocessor instanceof ProcessRanking) {
154  processRankingVariable(createDao(), preprocessor, variable, entityRoot);
155  } else if(preprocessor instanceof ProcessMatching) {
156  processMatchingVariable(createDao(), preprocessor, variable, entityRoot, relatedRoot);
157  }
158  } else {
159  Indicators.getIndicator(variable).preprocess(variable, preprocessor, entityRoot, relatedRoot);
160  }
161  }
162  }
abstract void processMatchingVariable(Dao dao, IPreprocessor preprocessor, IndicatorVariable variable, String entityRoot, String relatedRoot)
abstract void processRankingVariable(Dao dao, IPreprocessor preprocessor, IndicatorVariable variable, String entityRoot)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ processMatchingVariable()

abstract void org.turro.indicator.AbstractIndicator.processMatchingVariable ( Dao  dao,
IPreprocessor  preprocessor,
IndicatorVariable  variable,
String  entityRoot,
String  relatedRoot 
)
abstractprotected

◆ processRankingVariable()

abstract void org.turro.indicator.AbstractIndicator.processRankingVariable ( Dao  dao,
IPreprocessor  preprocessor,
IndicatorVariable  variable,
String  entityRoot 
)
abstractprotected

◆ readIndicator()

IndicatorResult org.turro.indicator.AbstractIndicator.readIndicator ( String  storeClass,
String  indicator 
)

Implements org.turro.indicator.IElephantIndicator.

Definition at line 127 of file AbstractIndicator.java.

127  {
128  String v[] = indicator.split("\\s*\\.\\s*");
129  int index = 0;
130  WhereClause wc = new WhereClause();
131  if(v.length == 2) {
132  wc.addClause("select new org.turro.indicator.IndicatorResult(sum(ranking), count(ranking))");
133  } else {
134  wc.addClause("select new org.turro.indicator.IndicatorResult(sum(matching), count(matching))");
135  }
136  wc.addClause("from " + storeClass);
137  wc.addClause("where entityPath like :entityPath");
138  wc.addNamedValue("entityPath", convertPathToLike(v[index++], root));
139  if(v.length == 3) {
140  wc.addClause("and relatedPath like :relatedPath");
141  wc.addNamedValue("relatedPath", convertPathToLike(v[index++], relatedRoot));
142  }
143  wc.addClause("and concept like :indicator");
144  wc.addNamedValue("indicator", convertIndicatorToLike(v[index]));
145 
146  return (IndicatorResult) getDao().getSingleResultOrNull(wc);
147  }
Object getSingleResultOrNull(SqlClause sc)
Definition: Dao.java:419
Here is the call graph for this function:

Member Data Documentation

◆ root

String org.turro.indicator.AbstractIndicator.root
protected

Definition at line 40 of file AbstractIndicator.java.

◆ variables

List<IndicatorVariable> org.turro.indicator.AbstractIndicator.variables = new ArrayList<>()
protected

Definition at line 39 of file AbstractIndicator.java.


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