19 package org.turro.indicator;
21 import java.util.stream.Stream;
22 import org.turro.annotation.ElephantIndicator;
23 import org.turro.contacts.db.ContactsPU;
24 import org.turro.elephant.db.WhereClause;
25 import org.turro.jpa.Dao;
26 import org.turro.matching.GenericMatching;
27 import org.turro.matching.GenericSiblings;
28 import org.turro.matching.IMatching;
29 import org.turro.path.Path;
30 import org.turro.ranking.GenericRanking;
31 import org.turro.ranking.IRanking;
81 try(Stream<GenericRanking> stream = dao.stream(
GenericRanking.class, wc, 1000)) {
93 if(
"contact".equals(relatedRoot)) {
118 try(Stream<GenericMatching> stream = dao.stream(
GenericMatching.class, wc, 1000)) {
119 stream.forEach(r -> {
129 Path path =
new Path(entityPath);
130 if(
"contact".equals(path.getRoot())) {
132 wc.
addClause(
"select new org.turro.matching.GenericSiblings(concat('/contact/', br.contact.id), concat('/contact/', br2.contact.id))");
133 wc.
addClause(
"from BusinessRelation br, BusinessRelation br2");
134 wc.
addClause(
"where br.business.id = br2.business.id");
135 wc.
addClause(
"and br.business.inactive = false");
136 wc.
addClause(
"and br.business.deactivated = false");
144 Path path =
new Path(entityRoot);
145 if(
"contact".equals(path.getRoot())) {
146 return createDao().stream(String.class,
"select concat('/contact/', id) from Contact");
void addClause(String clause)
void addVariable(String name, VariableType type)
Stream< String > getEntityPaths(String entityRoot)
void processMatchingVariable(Dao dao, IPreprocessor preprocessor, IndicatorVariable variable, String entityRoot, String relatedRoot)
void processRankingVariable(Dao dao, IPreprocessor preprocessor, IndicatorVariable variable, String entityRoot)
void initExternalVariables()
Stream< GenericSiblings > getSiblingPaths(String entityPath)
PreprocessClause setMatchingField(String pathField)
PreprocessClause setVariable(IndicatorVariable variable)
PreprocessClause setMatchingRoot(String entityRoot)
PreprocessClause setAggregate(String aggregate)
PreprocessClause setRankingRoot(String entityRoot)
static PreprocessClause load(String table)
PreprocessClause setRankingField(String pathField)
void poolInstance(Object value)
void finishPreprocessor()