BrightSide Workbench Full Report + Source Code
LogEntry.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2011 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 package org.turro.contacts;
19 
20 import java.io.Serializable;
21 import java.util.Date;
22 import javax.persistence.*;
23 import org.turro.elephant.log.LogType;
24 import org.turro.plugin.GenericObject;
25 
30 @Entity
31 @Table(indexes={
32  @Index(name="IndexName", columnList="name,dateLog"),
33  @Index(name="IndexPath", columnList="LOG_PATH,dateLog"),
34  @Index(name="IndexComment", columnList="comment")
35 })
36 @org.hibernate.annotations.GenericGenerator(name = "hibernate-uuid", strategy = "uuid")
37 public class LogEntry implements java.io.Serializable {
38 
39  @Id
40  @GeneratedValue(generator = "hibernate-uuid")
41  @Column(name="IDENTIFIER")
42  private String id;
43 
44  private LogType logType;
45 
46  @Column(name="LOG_PATH")
47  private String path;
48 
49  private String idUser;
50  private String name;
51 
52  @Temporal(value = javax.persistence.TemporalType.TIMESTAMP)
53  private java.util.Date dateLog;
54 
55  private String comment;
56 
57  @Lob
58  @Column(name="LOG_DATA")
59  private byte[] data;
60 
61  public String getComment() {
62  return comment;
63  }
64 
65  public void setComment(String comment) {
66  this.comment = comment;
67  }
68 
69  public byte[] getData() {
70  return data;
71  }
72 
73  public void setData(byte[] data) {
74  this.data = data;
75  }
76 
77  public Date getDateLog() {
78  return dateLog;
79  }
80 
81  public void setDateLog(Date dateLog) {
82  this.dateLog = dateLog;
83  }
84 
85  public String getId() {
86  return id;
87  }
88 
89  public void setId(String id) {
90  this.id = id;
91  }
92 
93  public String getIdUser() {
94  return idUser;
95  }
96 
97  public void setIdUser(String idUser) {
98  this.idUser = idUser;
99  }
100 
101  public LogType getLogType() {
102  return logType;
103  }
104 
105  public void setLogType(LogType logType) {
106  this.logType = logType;
107  }
108 
109  public String getName() {
110  return name;
111  }
112 
113  public void setName(String name) {
114  this.name = name;
115  }
116 
117  public String getPath() {
118  return path;
119  }
120 
121  public void setPath(String path) {
122  this.path = path;
123  }
124 
125  /* Helpers */
126 
127  public Object getObject() {
128  if(data != null) {
129  GenericObject go = new GenericObject();
130  go.bytesToObject(data);
131  return go.getObject();
132  } else {
133  return null;
134  }
135  }
136 
137  public void setObject(Serializable object) {
138  if(object != null) {
139  GenericObject go = new GenericObject();
140  go.setObject(object);
141  data = go.objectToBytes();
142  } else {
143  data = null;
144  }
145  }
146 
147 }
void setObject(Serializable object)
Definition: LogEntry.java:137
void setData(byte[] data)
Definition: LogEntry.java:73
void setIdUser(String idUser)
Definition: LogEntry.java:97
void setLogType(LogType logType)
Definition: LogEntry.java:105
void setId(String id)
Definition: LogEntry.java:89
void setPath(String path)
Definition: LogEntry.java:121
void setComment(String comment)
Definition: LogEntry.java:65
void setDateLog(Date dateLog)
Definition: LogEntry.java:81
void setName(String name)
Definition: LogEntry.java:113