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

Public Member Functions

LogWrapper date (Date date)
 
LogWrapper comment (String comment)
 
LogWrapper object (Serializable object)
 
LogWrapper stub (Object entity)
 
LogWrapper data (byte[] data)
 
LogWrapper entityPath (String path)
 
LogWrapper entityName (String name)
 
LogWrapper generatorPath (String path)
 
LogWrapper generatorName (String name)
 
LogWrapper entity (Object entity)
 
LogWrapper entity (IElephantEntity entity)
 
LogWrapper generator (IContact from)
 
LogWrapper generator (IElephantEntity generator)
 
void log ()
 
long count ()
 
 LogWrapper (SystemLogType type)
 

Static Public Member Functions

static LogWrapper info ()
 
static LogWrapper warning ()
 
static LogWrapper severe ()
 
static LogWrapper type (SystemLogType type)
 

Detailed Description

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

Definition at line 38 of file LogWrapper.java.

Constructor & Destructor Documentation

◆ LogWrapper()

org.turro.log.LogWrapper.LogWrapper ( SystemLogType  type)

Definition at line 182 of file LogWrapper.java.

182  {
183  this.systemLog = new SystemLog();
184  this.systemLog.setLogType(type);
185  }
void setLogType(SystemLogType logType)
Definition: SystemLog.java:76
static LogWrapper type(SystemLogType type)
Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ comment()

LogWrapper org.turro.log.LogWrapper.comment ( String  comment)

Implements org.turro.log.ILogWrapper.

Definition at line 47 of file LogWrapper.java.

47  {
48  systemLog.setComment(comment);
49  return this;
50  }
LogWrapper comment(String comment)
Definition: LogWrapper.java:47
Here is the call graph for this function:

◆ count()

long org.turro.log.LogWrapper.count ( )

Implements org.turro.log.ILogWrapper.

Definition at line 142 of file LogWrapper.java.

142  {
143  return SqlClause.select("sum(l.counts)")
144  .from("SystemLog l")
145  .where().equal("l.logType", systemLog.getLogType())
146  .startIf(!Strings.isBlank(systemLog.getComment()))
147  .and().equal("l.comment", systemLog.getComment())
148  .endIf()
149  .startIf(!Strings.isBlank(systemLog.getEntityPath()))
150  .and().equal("l.entityPath", systemLog.getEntityPath())
151  .endIf()
152  .startIf(!Strings.isBlank(systemLog.getGeneratorPath()))
153  .and().equal("l.generatorPath", systemLog.getGeneratorPath())
154  .endIf()
155  .startIf(systemLog.getDateLog() != null)
156  .and().greaterOrEqual("l.dateLog", systemLog.getDateLog())
157  .endIf()
158  .dao(new ElephantPU())
159  .singleResult(Long.class);
160  }
Here is the call graph for this function:

◆ data()

LogWrapper org.turro.log.LogWrapper.data ( byte[]  data)

Implements org.turro.log.ILogWrapper.

Definition at line 65 of file LogWrapper.java.

65  {
66  systemLog.setData(data);
67  return this;
68  }
LogWrapper data(byte[] data)
Definition: LogWrapper.java:65
Here is the call graph for this function:

◆ date()

LogWrapper org.turro.log.LogWrapper.date ( Date  date)

Implements org.turro.log.ILogWrapper.

Definition at line 41 of file LogWrapper.java.

41  {
42  systemLog.setDateLog(date);
43  return this;
44  }
LogWrapper date(Date date)
Definition: LogWrapper.java:41
Here is the call graph for this function:
Here is the caller graph for this function:

◆ entity() [1/2]

LogWrapper org.turro.log.LogWrapper.entity ( IElephantEntity  entity)

Implements org.turro.log.ILogWrapper.

Definition at line 100 of file LogWrapper.java.

100  {
101  if((entity == null) || (entity instanceof EmptyController)) {
102  systemLog.setEntityPath("#");
103  systemLog.setEntityName("Unknown");
104  } else {
105  systemLog.setEntityPath(entity.getPath());
106  systemLog.setEntityName(entity.getNameOrLabel());
107  }
108  return this;
109  }
void setEntityName(String entityName)
Definition: SystemLog.java:108
void setEntityPath(String entityPath)
Definition: SystemLog.java:92
LogWrapper entity(Object entity)
Definition: LogWrapper.java:95
Here is the call graph for this function:

◆ entity() [2/2]

LogWrapper org.turro.log.LogWrapper.entity ( Object  entity)

Implements org.turro.log.ILogWrapper.

Definition at line 95 of file LogWrapper.java.

95  {
96  return entity(Entities.getController(entity));
97  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ entityName()

LogWrapper org.turro.log.LogWrapper.entityName ( String  name)

Implements org.turro.log.ILogWrapper.

Definition at line 77 of file LogWrapper.java.

77  {
78  systemLog.setEntityName(name);
79  return this;
80  }
Here is the call graph for this function:

◆ entityPath()

LogWrapper org.turro.log.LogWrapper.entityPath ( String  path)

Implements org.turro.log.ILogWrapper.

Definition at line 71 of file LogWrapper.java.

71  {
72  systemLog.setEntityPath(path);
73  return this;
74  }
Here is the call graph for this function:

◆ generator() [1/2]

LogWrapper org.turro.log.LogWrapper.generator ( IContact  from)

Implements org.turro.log.ILogWrapper.

Definition at line 112 of file LogWrapper.java.

112  {
113  if(from instanceof IContact) {
114  generator(Entities.getController(((IContact) from).getContact()));
115  } else {
116  generator(Entities.getController(from));
117  }
118  return this;
119  }
LogWrapper generator(IContact from)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ generator() [2/2]

LogWrapper org.turro.log.LogWrapper.generator ( IElephantEntity  generator)

Implements org.turro.log.ILogWrapper.

Definition at line 122 of file LogWrapper.java.

122  {
123  if((generator == null) || (generator instanceof EmptyController)) {
124  systemLog.setGeneratorPath("#");
125  systemLog.setGeneratorName("Unknown");
126  } else {
127  systemLog.setGeneratorPath(generator.getPath());
128  systemLog.setGeneratorName(generator.getNameOrLabel());
129  }
130  return this;
131  }
void setGeneratorPath(String generatorPath)
Definition: SystemLog.java:84
void setGeneratorName(String generatorName)
Definition: SystemLog.java:100
Here is the call graph for this function:

◆ generatorName()

LogWrapper org.turro.log.LogWrapper.generatorName ( String  name)

Implements org.turro.log.ILogWrapper.

Definition at line 89 of file LogWrapper.java.

89  {
90  systemLog.setGeneratorName(name);
91  return this;
92  }
Here is the call graph for this function:

◆ generatorPath()

LogWrapper org.turro.log.LogWrapper.generatorPath ( String  path)

Implements org.turro.log.ILogWrapper.

Definition at line 83 of file LogWrapper.java.

83  {
84  systemLog.setGeneratorPath(path);
85  return this;
86  }
Here is the call graph for this function:

◆ info()

static LogWrapper org.turro.log.LogWrapper.info ( )
static

Definition at line 166 of file LogWrapper.java.

166  {
167  return type(SystemLogType.LOG_INFO);
168  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ log()

void org.turro.log.LogWrapper.log ( )

Implements org.turro.log.ILogWrapper.

Definition at line 134 of file LogWrapper.java.

134  {
135  if(systemLog.getDateLog() == null) date(new Date());
136  if(systemLog.getCounts() == 0) systemLog.setCounts(1);
137  if(Strings.isBlank(systemLog.getGeneratorPath())) generator(Application.getUser());
138  new ElephantPU().saveObject(systemLog);
139  }
Here is the call graph for this function:

◆ object()

LogWrapper org.turro.log.LogWrapper.object ( Serializable  object)

Implements org.turro.log.ILogWrapper.

Definition at line 53 of file LogWrapper.java.

53  {
54  systemLog.setObject(object);
55  return this;
56  }
void setObject(Serializable object)
Definition: SystemLog.java:155
Here is the call graph for this function:

◆ severe()

static LogWrapper org.turro.log.LogWrapper.severe ( )
static

Definition at line 174 of file LogWrapper.java.

174  {
175  return type(SystemLogType.LOG_SEVERE);
176  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stub()

LogWrapper org.turro.log.LogWrapper.stub ( Object  entity)

Implements org.turro.log.ILogWrapper.

Definition at line 59 of file LogWrapper.java.

59  {
60  systemLog.setData(Stubs.json(entity).getBytes());
61  return this;
62  }
Here is the call graph for this function:

◆ type()

static LogWrapper org.turro.log.LogWrapper.type ( SystemLogType  type)
static

Definition at line 178 of file LogWrapper.java.

178  {
179  return new LogWrapper(type);
180  }
LogWrapper(SystemLogType type)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ warning()

static LogWrapper org.turro.log.LogWrapper.warning ( )
static

Definition at line 170 of file LogWrapper.java.

170  {
171  return type(SystemLogType.LOG_WARNING);
172  }
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: