Re-format source code
[policy/engine.git] / PolicyEngineUtils / src / main / java / org / onap / policy / jpa / BackUpMonitorEntity.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * PolicyEngineUtils
4  * ================================================================================
5  * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.policy.jpa;
22
23 import java.io.Serializable;
24 import java.util.Date;
25
26 import javax.persistence.Column;
27 import javax.persistence.Entity;
28 import javax.persistence.GeneratedValue;
29 import javax.persistence.GenerationType;
30 import javax.persistence.Id;
31 import javax.persistence.Lob;
32 import javax.persistence.NamedQuery;
33 import javax.persistence.PrePersist;
34 import javax.persistence.PreUpdate;
35 import javax.persistence.Table;
36 import javax.persistence.Temporal;
37 import javax.persistence.TemporalType;
38
39 @Entity
40 @Table(name = "BackUpMonitorEntity")
41 @NamedQuery(name = "BackUpMonitorEntity.findAll", query = "SELECT b FROM BackUpMonitorEntity b ")
42 public class BackUpMonitorEntity implements Serializable {
43
44     private static final long serialVersionUID = -9190606334322230630L;
45
46     @Id
47     @GeneratedValue(strategy = GenerationType.AUTO)
48     @Column(name = "id")
49     private int id;
50
51     @Column(name = "node_name", nullable = false)
52     private String resourceNodeName;
53
54     @Column(name = "resource_name", nullable = false, unique = true)
55     private String resourceName;
56
57     @Column(name = "flag", nullable = false)
58     private String flag;
59
60     @Lob
61     @Column(name = "notification_record")
62     private String notificationRecord;
63
64     @Temporal(TemporalType.TIMESTAMP)
65     @Column(name = "last_seen")
66     private Date timeStamp;
67
68     @PrePersist
69     public void prePersist() {
70         this.timeStamp = new Date();
71     }
72
73     @PreUpdate
74     public void preUpdate() {
75         this.timeStamp = new Date();
76     }
77
78     public String getResourceName() {
79         return this.resourceName;
80     }
81
82     public String getResourceNodeName() {
83         return this.resourceNodeName;
84     }
85
86     public String getFlag() {
87         return this.flag;
88     }
89
90     public String getNotificationRecord() {
91         return this.notificationRecord;
92     }
93
94     public Date getTimeStamp() {
95         return this.timeStamp;
96     }
97
98     public void setResourceName(String resourceName) {
99         this.resourceName = resourceName;
100     }
101
102     public void setResourceNodeName(String resourceNodeName) {
103         this.resourceNodeName = resourceNodeName;
104     }
105
106     public void setFlag(String flag) {
107         this.flag = flag;
108     }
109
110     public void setNotificationRecord(String notificationRecord) {
111         this.notificationRecord = notificationRecord;
112     }
113
114     public void setTimeStamp(Date timeStamp) {
115         this.timeStamp = timeStamp;
116     }
117 }