BrightSide Workbench Full Report + Source Code
org.turro.ranking.ProcessRanking< T > Class Template Referenceabstract
Inheritance diagram for org.turro.ranking.ProcessRanking< T >:
Collaboration diagram for org.turro.ranking.ProcessRanking< T >:

Public Member Functions

void startProcess ()
 
void startProcessFor (Object entity)
 
void process (Stream< T > stream, List< IndicatorVariable > variables)
 
void processFor (T entity, List< IndicatorVariable > variables)
 
Object createInstance ()
 
void poolInstance (Object value)
 
void finishPreprocessor ()
 
String tableName ()
 
- Public Member Functions inherited from org.turro.action.IProcess< T >
boolean itsMine (Object entity)
 

Protected Member Functions

void start ()
 
void end ()
 
void truncate ()
 
IRanking process (T entity, IndicatorVariable variable)
 
void prepareProcess (List< IndicatorVariable > variables)
 
void postProcess (List< IndicatorVariable > variables)
 
void prepareEntity (T entity)
 
double calculate (RankingSet set)
 
IRanking createRankingInstance (String entityPath, IndicatorVariable variable)
 
abstract Stream< T > getEntityStream ()
 
abstract IRanking createRankingInstance ()
 
abstract Class instanceClass ()
 
abstract String indicatorsRoot ()
 
abstract String entitiesRoot ()
 
abstract Dao createDao ()
 
Dao getDao ()
 

Detailed Description

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

Definition at line 41 of file ProcessRanking.java.

Member Function Documentation

◆ calculate()

double org.turro.ranking.ProcessRanking< T >.calculate ( RankingSet  set)
protected

Definition at line 136 of file ProcessRanking.java.

136  {
137  return set.applyFrom(Formulas.load().getFormula(instanceClass()));
138  }
Here is the call graph for this function:

◆ createDao()

abstract Dao org.turro.ranking.ProcessRanking< T >.createDao ( )
abstractprotected
Here is the caller graph for this function:

◆ createInstance()

Object org.turro.ranking.ProcessRanking< T >.createInstance ( )

Implements org.turro.indicator.IPreprocessor.

Definition at line 208 of file ProcessRanking.java.

208  {
209  return createRankingInstance();
210  }
abstract IRanking createRankingInstance()
Here is the call graph for this function:

◆ createRankingInstance() [1/2]

abstract IRanking org.turro.ranking.ProcessRanking< T >.createRankingInstance ( )
abstractprotected
Here is the caller graph for this function:

◆ createRankingInstance() [2/2]

IRanking org.turro.ranking.ProcessRanking< T >.createRankingInstance ( String  entityPath,
IndicatorVariable  variable 
)
protected

Definition at line 140 of file ProcessRanking.java.

140  {
141  IRanking ranking = createRankingInstance();
142  ranking.setEntityPath(entityPath);
143  ranking.setConcept(variable.getName());
144  ranking.setRanking(0);
145  return ranking;
146  }
Here is the call graph for this function:

◆ end()

void org.turro.ranking.ProcessRanking< T >.end ( )
protected

Definition at line 103 of file ProcessRanking.java.

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

◆ entitiesRoot()

abstract String org.turro.ranking.ProcessRanking< T >.entitiesRoot ( )
abstractprotected
Here is the caller graph for this function:

◆ finishPreprocessor()

void org.turro.ranking.ProcessRanking< T >.finishPreprocessor ( )

Implements org.turro.indicator.IPreprocessor.

Definition at line 218 of file ProcessRanking.java.

218  {
219  getDao().finishPool();
220  }
void finishPool()
Definition: Dao.java:592
Here is the call graph for this function:

◆ getDao()

Dao org.turro.ranking.ProcessRanking< T >.getDao ( )
protected

Definition at line 231 of file ProcessRanking.java.

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

◆ getEntityStream()

abstract Stream<T> org.turro.ranking.ProcessRanking< T >.getEntityStream ( )
abstractprotected
Here is the caller graph for this function:

◆ indicatorsRoot()

abstract String org.turro.ranking.ProcessRanking< T >.indicatorsRoot ( )
abstractprotected
Here is the caller graph for this function:

◆ instanceClass()

abstract Class org.turro.ranking.ProcessRanking< T >.instanceClass ( )
abstractprotected
Here is the caller graph for this function:

◆ poolInstance()

void org.turro.ranking.ProcessRanking< T >.poolInstance ( Object  value)

Implements org.turro.indicator.IPreprocessor.

Definition at line 213 of file ProcessRanking.java.

213  {
214  getDao().poolObject(value, 1000);
215  }
void poolObject(Object obj, int poolSize)
Definition: Dao.java:581
Here is the call graph for this function:

◆ postProcess()

void org.turro.ranking.ProcessRanking< T >.postProcess ( List< IndicatorVariable variables)
protected

Definition at line 127 of file ProcessRanking.java.

127  {
128  variables.forEach(v -> {
129  IElephantIndicator ei = Indicators.getIndicator(v);
130  ei.postprocess(v, this, entitiesRoot(), null);
131  });
132  }
abstract String entitiesRoot()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ prepareEntity()

void org.turro.ranking.ProcessRanking< T >.prepareEntity ( entity)
protected

Definition at line 134 of file ProcessRanking.java.

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

◆ prepareProcess()

void org.turro.ranking.ProcessRanking< T >.prepareProcess ( List< IndicatorVariable variables)
protected

Definition at line 118 of file ProcessRanking.java.

118  {
119  variables.forEach(v -> {
120  if(v.isPreprocess()) {
121  IElephantIndicator ei = Indicators.getIndicator(v);
122  ei.preprocess(v, this, entitiesRoot(), null);
123  }
124  });
125  }
Here is the caller graph for this function:

◆ process() [1/2]

void org.turro.ranking.ProcessRanking< T >.process ( Stream< T >  stream,
List< IndicatorVariable variables 
)

Definition at line 82 of file ProcessRanking.java.

82  {
83  try {
84  stream.forEach(t -> {
85  processFor(t, variables);
86  });
87  } catch(Exception ex) {
88  Logger.getLogger(ProcessRanking.class.getName())
89  .log(Level.SEVERE, ElephantContext.logMsg("Processing"), ex);
90  }
91  }
void processFor(T entity, List< IndicatorVariable > variables)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ process() [2/2]

IRanking org.turro.ranking.ProcessRanking< T >.process ( entity,
IndicatorVariable  variable 
)
protected

Definition at line 109 of file ProcessRanking.java.

109  {
110  IRanking ranking = createRankingInstance(getDao().getPath(entity), variable);
111  ranking.setRanking(Indicators.getValue(entity, variable));
112  if(!Zero.near(ranking.getRanking(), 2)) {
113  ranking = getDao().saveObject(ranking);
114  }
115  return ranking;
116  }
Here is the call graph for this function:

◆ processFor()

void org.turro.ranking.ProcessRanking< T >.processFor ( entity,
List< IndicatorVariable variables 
)

Definition at line 93 of file ProcessRanking.java.

93  {
94  prepareEntity(entity);
95  variables.forEach(v -> {
96  if(!v.isPreprocess()) {
97  process(entity, v);
98  }
99  });
100  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ start()

void org.turro.ranking.ProcessRanking< T >.start ( )
protected

Definition at line 102 of file ProcessRanking.java.

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

◆ startProcess()

void org.turro.ranking.ProcessRanking< T >.startProcess ( )

Implements org.turro.action.IProcess< T >.

Definition at line 44 of file ProcessRanking.java.

44  {
45  Logger.getLogger(ProcessRanking.class.getName())
46  .log(Level.INFO, ElephantContext.logMsg("Start " + instanceClass().getSimpleName() + "..."));
47  start();
48  truncate();
49  Logger.getLogger(ProcessRanking.class.getName())
50  .log(Level.INFO, ElephantContext.logMsg("Truncated"));
51  List<IndicatorVariable> vars = Indicators.getRankingVariables(indicatorsRoot());
52  prepareProcess(vars);
53  Logger.getLogger(ProcessRanking.class.getName())
54  .log(Level.INFO, ElephantContext.logMsg("Preprocessed"));
55  if(Indicators.hasDirectProcess(vars)) {
56  try(Stream<T> entities = getEntityStream()) {
57  process(entities, vars);
58  }
59  }
60  Logger.getLogger(ProcessRanking.class.getName())
61  .log(Level.INFO, ElephantContext.logMsg("Processed"));
62  postProcess(vars);
63  Logger.getLogger(ProcessRanking.class.getName())
64  .log(Level.INFO, ElephantContext.logMsg("Postprocessed"));
65  calculateRanking();
66  end();
67  Logger.getLogger(ProcessRanking.class.getName())
68  .log(Level.INFO, ElephantContext.logMsg("End " + instanceClass().getSimpleName()));
69  }
abstract Stream< T > getEntityStream()
void process(Stream< T > stream, List< IndicatorVariable > variables)
void prepareProcess(List< IndicatorVariable > variables)
void postProcess(List< IndicatorVariable > variables)
abstract String indicatorsRoot()
Here is the call graph for this function:

◆ startProcessFor()

void org.turro.ranking.ProcessRanking< T >.startProcessFor ( Object  entity)

Implements org.turro.action.IProcess< T >.

Definition at line 72 of file ProcessRanking.java.

72  {
73  String entityPath = getDao().getPath(entity);
74  WhereClause wc = new WhereClause();
75  wc.addClause("delete from " + instanceClass().getSimpleName());
76  wc.addClause("where entityPath = :entityPath");
77  wc.addNamedValue("entityPath", entityPath);
78  getDao().executeUpdate(wc);
79  processFor((T) entity, Indicators.getRankingVariables(indicatorsRoot()));
80  }
abstract String getPath(Object object)
int executeUpdate(String query)
Definition: Dao.java:463
Here is the call graph for this function:

◆ tableName()

String org.turro.ranking.ProcessRanking< T >.tableName ( )

Implements org.turro.indicator.IPreprocessor.

Definition at line 223 of file ProcessRanking.java.

223  {
224  return instanceClass().getSimpleName();
225  }
Here is the call graph for this function:

◆ truncate()

void org.turro.ranking.ProcessRanking< T >.truncate ( )
protected

Definition at line 105 of file ProcessRanking.java.

105  {
106  getDao().executeNativeUpdate("truncate table " + instanceClass().getSimpleName());
107  }
int executeNativeUpdate(SqlClause sc, Object... pars)
Definition: Dao.java:536
Here is the call graph for this function:
Here is the caller graph for this function:

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