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

Public Member Functions

 SystemLogAccumulator (Dao dao)
 
void run ()
 

Static Public Member Functions

static void accumulate ()
 

Detailed Description

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

Definition at line 33 of file SystemLogAccumulator.java.

Constructor & Destructor Documentation

◆ SystemLogAccumulator()

org.turro.log.SystemLogAccumulator.SystemLogAccumulator ( Dao  dao)

Definition at line 43 of file SystemLogAccumulator.java.

43  {
44  this.dao = dao;
45  }
Here is the caller graph for this function:

Member Function Documentation

◆ accumulate()

static void org.turro.log.SystemLogAccumulator.accumulate ( )
static

Definition at line 38 of file SystemLogAccumulator.java.

38  {
39  SystemLogAccumulator accumulator = new SystemLogAccumulator(new ElephantPU());
40  new Thread(accumulator, "ElephantLog accumulator").start();
41  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ run()

void org.turro.log.SystemLogAccumulator.run ( )

Definition at line 60 of file SystemLogAccumulator.java.

60  {
61  Date until = new CheckDate().addYears(-MAX_YEARS).getDate();
62  ensureCounts();
63  SqlClause.select(Words.csv("l.logType").add("l.generatorPath").add("l.entityPath")
64  .add("l.generatorName").add("l.entityName").add("l.comment")
65  .add("sum(l.counts)").add("max(l.dateLog)").toString())
66  .from("SystemLog l")
67  .where().smallerOrEqual("l.dateLog", until)
68  .groupBy(Words.csv("l.logType").add("l.generatorPath").add("l.entityPath")
69  .add("l.generatorName").add("l.entityName").add("l.comment").toString())
70  .dao(dao)
71  .resultList(Object[].class).forEach(c -> {
72  SystemLog sl = new SystemLog();
73  sl.setLogType((SystemLogType) c[0]);
74  sl.setGeneratorPath((String) c[1]);
75  sl.setEntityPath((String) c[2]);
76  sl.setGeneratorName((String) c[3]);
77  sl.setEntityName((String) c[4]);
78  sl.setComment((String) c[5]);
79  sl.setCounts((int)(long) c[6]);
80  sl.setDateLog(until);
81  sl.setData(getDataFrom(sl, (Date) c[7]));
82  dao.saveObject(sl);
83  });
84  SqlClause.delete("SystemLog").where().smaller("logDate", until);
85  }
Here is the call graph for this function:

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