BrightSide Workbench Full Report + Source Code
org.turro.matching.ProcessMatching< T > Class Template Referenceabstract
Inheritance diagram for org.turro.matching.ProcessMatching< T >:
Collaboration diagram for org.turro.matching.ProcessMatching< 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 ()
 
List< String > getSelectedPaths ()
 
IMatching process (T entity, String relatedPath, IndicatorVariable variable)
 
void prepareProcess (List< IndicatorVariable > variables)
 
void postProcess (List< IndicatorVariable > variables)
 
void prepareEntity (T entity)
 
double calculate (MatchingSet set)
 
IMatching createMatchingInstance (String entityPath, String relatedPath, IndicatorVariable variable)
 
abstract Stream< T > getEntityStream ()
 
abstract IMatching createMatchingInstance ()
 
abstract Class instanceClass ()
 
abstract String indicatorsRoot ()
 
abstract String entitiesRoot ()
 
abstract String relatedRoot ()
 
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 ProcessMatching.java.

Member Function Documentation

◆ calculate()

double org.turro.matching.ProcessMatching< T >.calculate ( MatchingSet  set)
protected

Definition at line 146 of file ProcessMatching.java.

146  {
147  return set.applyFrom(Formulas.load().getFormula(instanceClass()));
148  }
Here is the call graph for this function:

◆ createDao()

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

◆ createInstance()

Object org.turro.matching.ProcessMatching< T >.createInstance ( )

Implements org.turro.indicator.IPreprocessor.

Definition at line 226 of file ProcessMatching.java.

226  {
227  return createMatchingInstance();
228  }
abstract IMatching createMatchingInstance()
Here is the call graph for this function:

◆ createMatchingInstance() [1/2]

abstract IMatching org.turro.matching.ProcessMatching< T >.createMatchingInstance ( )
abstractprotected
Here is the caller graph for this function:

◆ createMatchingInstance() [2/2]

IMatching org.turro.matching.ProcessMatching< T >.createMatchingInstance ( String  entityPath,
String  relatedPath,
IndicatorVariable  variable 
)
protected

Definition at line 150 of file ProcessMatching.java.

150  {
151  IMatching matching = createMatchingInstance();
152  matching.setEntityPath(entityPath);
153  matching.setRelatedPath(relatedPath);
154  matching.setConcept(variable.getName());
155  matching.setMatching(0);
156  return matching;
157  }
Here is the call graph for this function:

◆ end()

void org.turro.matching.ProcessMatching< T >.end ( )
protected

Definition at line 102 of file ProcessMatching.java.

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

◆ entitiesRoot()

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

◆ finishPreprocessor()

void org.turro.matching.ProcessMatching< T >.finishPreprocessor ( )

Implements org.turro.indicator.IPreprocessor.

Definition at line 236 of file ProcessMatching.java.

236  {
237  getDao().finishPool();
238  }
void finishPool()
Definition: Dao.java:592
Here is the call graph for this function:

◆ getDao()

Dao org.turro.matching.ProcessMatching< T >.getDao ( )
protected

Definition at line 249 of file ProcessMatching.java.

249  {
250  if(_dao == null) {
251  _dao = createDao();
252  }
253  return _dao;
254  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getEntityStream()

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

◆ getSelectedPaths()

List<String> org.turro.matching.ProcessMatching< T >.getSelectedPaths ( )
protected

Definition at line 115 of file ProcessMatching.java.

115  {
116  return null;
117  }
Here is the caller graph for this function:

◆ indicatorsRoot()

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

◆ instanceClass()

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

◆ poolInstance()

void org.turro.matching.ProcessMatching< T >.poolInstance ( Object  value)

Implements org.turro.indicator.IPreprocessor.

Definition at line 231 of file ProcessMatching.java.

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

◆ postProcess()

void org.turro.matching.ProcessMatching< T >.postProcess ( List< IndicatorVariable variables)
protected

Definition at line 137 of file ProcessMatching.java.

137  {
138  variables.forEach(v -> {
139  IElephantIndicator ei = Indicators.getIndicator(v);
140  ei.postprocess(v, this, entitiesRoot(), relatedRoot());
141  });
142  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ prepareEntity()

void org.turro.matching.ProcessMatching< T >.prepareEntity ( entity)
protected

Definition at line 144 of file ProcessMatching.java.

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

◆ prepareProcess()

void org.turro.matching.ProcessMatching< T >.prepareProcess ( List< IndicatorVariable variables)
protected

Definition at line 128 of file ProcessMatching.java.

128  {
129  variables.forEach(v -> {
130  if(v.isPreprocess()) {
131  IElephantIndicator ei = Indicators.getIndicator(v);
132  ei.preprocess(v, this, entitiesRoot(), relatedRoot());
133  }
134  });
135  }
Here is the caller graph for this function:

◆ process() [1/2]

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

Definition at line 82 of file ProcessMatching.java.

82  {
83  stream.forEach(t -> {
84  processFor(t, variables);
85  });
86  }
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]

IMatching org.turro.matching.ProcessMatching< T >.process ( entity,
String  relatedPath,
IndicatorVariable  variable 
)
protected

Definition at line 119 of file ProcessMatching.java.

119  {
120  IMatching matching = createMatchingInstance(getDao().getPath(entity), relatedPath, variable);
121  matching.setMatching(Indicators.getValue(entity, relatedPath, variable));
122  if(!Zero.near(matching.getMatching(), 2)) {
123  matching = getDao().saveObject(matching);
124  }
125  return matching;
126  }
Here is the call graph for this function:

◆ processFor()

void org.turro.matching.ProcessMatching< T >.processFor ( entity,
List< IndicatorVariable variables 
)

Definition at line 88 of file ProcessMatching.java.

88  {
89  prepareEntity(entity);
90  try(Stream<String> related = Indicators.getIndicator("generic").getEntityPaths(relatedRoot())) {
91  related.forEach(r -> {
92  variables.forEach(v -> {
93  if(!v.isPreprocess()) {
94  process(entity, r, v);
95  }
96  });
97  });
98  }
99  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ relatedRoot()

abstract String org.turro.matching.ProcessMatching< T >.relatedRoot ( )
abstractprotected
Here is the caller graph for this function:

◆ start()

void org.turro.matching.ProcessMatching< T >.start ( )
protected

Definition at line 101 of file ProcessMatching.java.

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

◆ startProcess()

void org.turro.matching.ProcessMatching< T >.startProcess ( )

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

Definition at line 44 of file ProcessMatching.java.

44  {
45  Logger.getLogger(ProcessMatching.class.getName())
46  .log(Level.INFO, ElephantContext.logMsg("Start " + instanceClass().getSimpleName() + "..."));
47  start();
48  truncate();
49  Logger.getLogger(ProcessMatching.class.getName())
50  .log(Level.INFO, ElephantContext.logMsg("Truncated"));
51  List<IndicatorVariable> vars = Indicators.getMatchingVariables(indicatorsRoot());
52  prepareProcess(vars);
53  Logger.getLogger(ProcessMatching.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(ProcessMatching.class.getName())
61  .log(Level.INFO, ElephantContext.logMsg("Processed"));
62  postProcess(vars);
63  Logger.getLogger(ProcessMatching.class.getName())
64  .log(Level.INFO, ElephantContext.logMsg("Postprocessed"));
65  calculateMatching();
66  end();
67  Logger.getLogger(ProcessMatching.class.getName())
68  .log(Level.INFO, ElephantContext.logMsg("End " + instanceClass().getSimpleName()));
69  }
void postProcess(List< IndicatorVariable > variables)
abstract Stream< T > getEntityStream()
void process(Stream< T > stream, List< IndicatorVariable > variables)
void prepareProcess(List< IndicatorVariable > variables)
Here is the call graph for this function:

◆ startProcessFor()

void org.turro.matching.ProcessMatching< T >.startProcessFor ( Object  entity)

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

Definition at line 72 of file ProcessMatching.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.getMatchingVariables(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.matching.ProcessMatching< T >.tableName ( )

Implements org.turro.indicator.IPreprocessor.

Definition at line 241 of file ProcessMatching.java.

241  {
242  return instanceClass().getSimpleName();
243  }
Here is the call graph for this function:

◆ truncate()

void org.turro.matching.ProcessMatching< T >.truncate ( )
protected

Definition at line 104 of file ProcessMatching.java.

104  {
105  if(getSelectedPaths() == null) {
106  getDao().executeNativeUpdate("truncate table " + instanceClass().getSimpleName());
107  } else {
108  WhereClause wc = new WhereClause();
109  wc.addClause("delete from " + instanceClass().getSimpleName());
110  wc.addIn("where", "entityPath", getSelectedPaths());
111  getDao().executeUpdate(wc);
112  }
113  }
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: