Introduce new entities
[clamp.git] / src / main / java / org / onap / clamp / dao / model / LoopLog.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP CLAMP
4  * ================================================================================
5  * Copyright (C) 2019 AT&T Intellectual Property. All rights
6  *                             reserved.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END============================================
20  * ===================================================================
21  *
22  */
23
24 package org.onap.clamp.dao.model;
25
26 import com.google.gson.annotations.Expose;
27
28 import java.io.Serializable;
29 import java.time.Instant;
30
31 import javax.persistence.Column;
32 import javax.persistence.Entity;
33 import javax.persistence.EnumType;
34 import javax.persistence.Enumerated;
35 import javax.persistence.FetchType;
36 import javax.persistence.GeneratedValue;
37 import javax.persistence.GenerationType;
38 import javax.persistence.Id;
39 import javax.persistence.JoinColumn;
40 import javax.persistence.ManyToOne;
41 import javax.persistence.Table;
42
43 @Entity
44 @Table(name = "loop_logs")
45 public class LoopLog implements Serializable {
46     /**
47      *
48      */
49     private static final long serialVersionUID = 1988276670074437631L;
50
51     @Expose
52     @Id
53     @GeneratedValue(strategy = GenerationType.AUTO)
54     private long id;
55
56     @Expose
57     @Column(name = "log_type", nullable = false)
58     @Enumerated(EnumType.STRING)
59     private LogType logType;
60
61     @Expose
62     @Column(name = "message", nullable = false)
63     private String message;
64
65     @ManyToOne(fetch = FetchType.LAZY)
66     @JoinColumn(name = "loop_id", nullable = false)
67     private Loop loop;
68
69     @Expose
70     @Column(name = "log_instant", nullable = false)
71     private Instant logInstant = Instant.now();
72
73     public long getId() {
74         return id;
75     }
76
77     public void setId(long id) {
78         this.id = id;
79     }
80
81     public LogType getLogType() {
82         return logType;
83     }
84
85     public void setLogType(LogType logType) {
86         this.logType = logType;
87     }
88
89     public String getMessage() {
90         return message;
91     }
92
93     public void setMessage(String message) {
94         this.message = message;
95     }
96
97     public Loop getLoop() {
98         return loop;
99     }
100
101     public void setLoop(Loop loop) {
102         this.loop = loop;
103     }
104
105     public Instant getLogInstant() {
106         return logInstant;
107     }
108
109     public void setLogInstant(Instant logInstant) {
110         this.logInstant = logInstant;
111     }
112
113 }