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

Public Member Functions

 ForumIndicator ()
 
- Public Member Functions inherited from org.turro.indicator.AbstractIndicator
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 initVariables ()
 
void initExternalVariables ()
 
Dao createDao ()
 
void processRankingVariable (Dao dao, IPreprocessor preprocessor, IndicatorVariable variable, String entityRoot)
 
void processMatchingVariable (Dao dao, IPreprocessor preprocessor, IndicatorVariable variable, String entityRoot, String relatedRoot)
 
- Protected Member Functions inherited from org.turro.indicator.AbstractIndicator
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)
 
void postprocessRankingVariable (Dao dao, IPreprocessor postprocessor, IndicatorVariable variable, String entityRoot)
 
void postprocessMatchingVariable (Dao dao, IPreprocessor postprocessor, IndicatorVariable variable, String entityRoot, String relatedRoot)
 

Additional Inherited Members

- Protected Attributes inherited from org.turro.indicator.AbstractIndicator
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 36 of file ForumIndicator.java.

Constructor & Destructor Documentation

◆ ForumIndicator()

org.turro.indicator.ForumIndicator.ForumIndicator ( )

Definition at line 38 of file ForumIndicator.java.

38  {
39  root = "forum";
40  }

Member Function Documentation

◆ createDao()

Dao org.turro.indicator.ForumIndicator.createDao ( )
protected

Reimplemented from org.turro.indicator.AbstractIndicator.

Definition at line 53 of file ForumIndicator.java.

53  {
54  return new ElephantPU();
55  }

◆ initExternalVariables()

void org.turro.indicator.ForumIndicator.initExternalVariables ( )
protected

Reimplemented from org.turro.indicator.AbstractIndicator.

Definition at line 49 of file ForumIndicator.java.

49  {
50  }

◆ initVariables()

void org.turro.indicator.ForumIndicator.initVariables ( )
protected

Reimplemented from org.turro.indicator.AbstractIndicator.

Definition at line 43 of file ForumIndicator.java.

43  {
44  addVariable("topics", true, VariableType.BOTH_VARIABLE);
45  addVariable("posts", true, VariableType.BOTH_VARIABLE);
46  }
void addVariable(String name, VariableType type)
Here is the call graph for this function:

◆ processMatchingVariable()

void org.turro.indicator.ForumIndicator.processMatchingVariable ( Dao  dao,
IPreprocessor  preprocessor,
IndicatorVariable  variable,
String  entityRoot,
String  relatedRoot 
)
protected

Reimplemented from org.turro.indicator.AbstractIndicator.

Definition at line 110 of file ForumIndicator.java.

110  {
111  WhereClause wc = null;
112  if("contact".equals(relatedRoot)) {
113  switch(variable.getName()) {
114  case "topics":
115  wc = PreprocessClause.load("Topic")
116  .setRankingRoot(entityRoot)
117  .setMatchingRoot(relatedRoot)
118  .setRankingField("entityPath")
119  .setMatchingField("authorId")
120  .setVariable(variable)
121  .setAggregate("count(id)")
122  .getClause();
123  break;
124  case "posts":
125  wc = PreprocessClause.load("Post")
126  .setRankingRoot(entityRoot)
127  .setMatchingRoot(relatedRoot)
128  .setRankingField("topic.entityPath")
129  .setMatchingField("authorId")
130  .setVariable(variable)
131  .setAggregate("count(id)")
132  .getClause();
133  break;
134  }
135  }
136  if(wc != null) {
137  try(Stream<GenericMatching> stream = dao.stream(GenericMatching.class, wc, 1000)) {
138  stream.forEach(m -> {
139  preprocessor.poolInstance(m.copyTo((IMatching) preprocessor.createInstance()));
140  });
141  preprocessor.finishPreprocessor();
142  }
143  }
144  }
Here is the call graph for this function:

◆ processRankingVariable()

void org.turro.indicator.ForumIndicator.processRankingVariable ( Dao  dao,
IPreprocessor  preprocessor,
IndicatorVariable  variable,
String  entityRoot 
)
protected

Reimplemented from org.turro.indicator.AbstractIndicator.

Definition at line 58 of file ForumIndicator.java.

58  {
59  WhereClause wc = null;
60  if("contact".equals(entityRoot)) {
61  switch(variable.getName()) {
62  case "topics":
63  wc = PreprocessClause.load("Topic")
64  .setRankingRoot(entityRoot)
65  .setRankingField("concat('/contact/', authorId)")
66  .setVariable(variable)
67  .setAggregate("count(id)")
68  .getClause();
69  break;
70  case "posts":
71  wc = PreprocessClause.load("Post")
72  .setRankingRoot(entityRoot)
73  .setRankingField("concat('/contact/', authorId)")
74  .setVariable(variable)
75  .setAggregate("count(id)")
76  .getClause();
77  break;
78  }
79  } else {
80  switch(variable.getName()) {
81  case "topics":
82  wc = PreprocessClause.load("Topic")
83  .setRankingRoot(entityRoot)
84  .setRankingField("entityPath")
85  .setVariable(variable)
86  .setAggregate("count(id)")
87  .getClause();
88  break;
89  case "posts":
90  wc = PreprocessClause.load("Post")
91  .setRankingRoot(entityRoot)
92  .setRankingField("topic.entityPath")
93  .setVariable(variable)
94  .setAggregate("count(id)")
95  .getClause();
96  break;
97  }
98  }
99  if(wc != null) {
100  try(Stream<GenericRanking> stream = dao.stream(GenericRanking.class, wc, 1000)) {
101  stream.forEach(r -> {
102  preprocessor.poolInstance(r.copyTo((IRanking) preprocessor.createInstance()));
103  });
104  preprocessor.finishPreprocessor();
105  }
106  }
107  }
Here is the call graph for this function:

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