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

Public Member Functions

 AttachmentIndicator ()
 
- 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 AttachmentIndicator.java.

Constructor & Destructor Documentation

◆ AttachmentIndicator()

org.turro.indicator.AttachmentIndicator.AttachmentIndicator ( )

Definition at line 38 of file AttachmentIndicator.java.

38  {
39  root = "attach";
40  }

Member Function Documentation

◆ createDao()

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

Reimplemented from org.turro.indicator.AbstractIndicator.

Definition at line 52 of file AttachmentIndicator.java.

52  {
53  return new AttachPU();
54  }

◆ initExternalVariables()

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

Reimplemented from org.turro.indicator.AbstractIndicator.

Definition at line 48 of file AttachmentIndicator.java.

48  {
49  }

◆ initVariables()

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

Reimplemented from org.turro.indicator.AbstractIndicator.

Definition at line 43 of file AttachmentIndicator.java.

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

◆ processMatchingVariable()

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

Reimplemented from org.turro.indicator.AbstractIndicator.

Definition at line 80 of file AttachmentIndicator.java.

80  {
81  WhereClause wc = null;
82  if("contact".equals(relatedRoot)) {
83  switch(variable.getName()) {
84  case "attachments":
85  wc = PreprocessClause.load("Attachment")
86  .setRankingRoot(entityRoot)
87  .setMatchingRoot(relatedRoot)
88  .setRankingField("path")
89  .setMatchingField("owner")
90  .setVariable(variable)
91  .setAggregate("count(id)")
92  .getClause();
93  break;
94  }
95  }
96  if(wc != null) {
97  try(Stream<GenericMatching> stream = dao.stream(GenericMatching.class, wc, 1000)) {
98  stream.forEach(r -> {
99  preprocessor.poolInstance(r.copyTo((IMatching) preprocessor.createInstance()));
100  });
101  preprocessor.finishPreprocessor();
102  }
103  }
104  }
Here is the call graph for this function:

◆ processRankingVariable()

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

Reimplemented from org.turro.indicator.AbstractIndicator.

Definition at line 57 of file AttachmentIndicator.java.

57  {
58  WhereClause wc = null;
59  switch(variable.getName()) {
60  case "attachments":
61  wc = PreprocessClause.load("Attachment")
62  .setRankingRoot(entityRoot)
63  .setRankingField("path")
64  .setVariable(variable)
65  .setAggregate("count(id)")
66  .getClause();
67  break;
68  }
69  if(wc != null) {
70  try(Stream<GenericRanking> stream = dao.stream(GenericRanking.class, wc, 1000)) {
71  stream.forEach(r -> {
72  preprocessor.poolInstance(r.copyTo((IRanking) preprocessor.createInstance()));
73  });
74  preprocessor.finishPreprocessor();
75  }
76  }
77  }
Here is the call graph for this function:

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