JUnit/SONAR/Checkstyle in ONAP-REST
[policy/engine.git] / ONAP-REST / src / main / java / org / onap / policy / rest / jpa / PolicyDBDaoEntity.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP-REST
4  * ================================================================================
5  * Copyright (C) 2017 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.rest.jpa;
22 /*
23  */
24 import java.io.Serializable;
25 import java.util.Date;
26
27 import javax.persistence.Column;
28 import javax.persistence.Entity;
29 import javax.persistence.Id;
30 import javax.persistence.NamedQueries;
31 import javax.persistence.NamedQuery;
32 import javax.persistence.PrePersist;
33 import javax.persistence.PreUpdate;
34 import javax.persistence.Table;
35 import javax.persistence.Temporal;
36 import javax.persistence.TemporalType;
37
38 /*
39  * The Entity class to persist a PolicyDBDaoEntity object for registration of PolicyDBDao
40  */
41
42 /**
43  *
44  */
45 @Entity
46 @Table(name="PolicyDBDaoEntity")
47
48 @NamedQueries({
49     @NamedQuery(name="PolicyDBDaoEntity.findAll", query="SELECT e FROM PolicyDBDaoEntity e "),
50     @NamedQuery(name="PolicyDBDaoEntity.deleteAll", query="DELETE FROM PolicyDBDaoEntity WHERE 1=1")
51 })
52
53 public class PolicyDBDaoEntity implements Serializable {
54     private static final long serialVersionUID = 1L;
55
56     @Id
57     @Column(name="policyDBDaoUrl", nullable=false, unique=true)
58     private String policyDBDaoUrl;
59
60     @Temporal(TemporalType.TIMESTAMP)
61     @Column(name="created_date", updatable=false)
62     private Date createdDate;
63
64     //username for the pap server that registered this PolicyDBDaoEntity
65     @Column(name="username")
66     private String username;
67
68     //AES encrypted password for the pap server that registered this PolicyDBDaoEntity
69     @Column(name="password")
70     private String password;
71
72     //A column to allow some descriptive text.  For example: Atlanta data center
73     @Column(name="description", nullable=false, length=2048)
74     private String description = "NoDescription";
75
76     @Temporal(TemporalType.TIMESTAMP)
77     @Column(name="modified_date", nullable=false)
78     private Date modifiedDate;
79
80     public PolicyDBDaoEntity() {
81         super();
82     }
83
84     @PrePersist
85     public void prePersist() {
86         Date date = new Date();
87         this.createdDate = date;
88         this.modifiedDate = date;
89     }
90
91     @PreUpdate
92     public void preUpdate() {
93         this.modifiedDate = new Date();
94     }
95
96     /**
97      * @return the policyDBDaoUrl
98      */
99     public String getPolicyDBDaoUrl() {
100         return policyDBDaoUrl;
101     }
102
103     /**
104      * @param url the policyDBDaoUrl to set
105      */
106     public void setPolicyDBDaoUrl(String url) {
107         this.policyDBDaoUrl = url;
108     }
109
110     /**
111      * @return the description
112      */
113     public String getDescription() {
114         return description;
115     }
116
117     /**
118      * @param description the description to set
119      */
120     public void setDescription(String description) {
121         this.description = description;
122     }
123
124     /**
125      * @return the createdDate
126      */
127     public Date getCreatedDate() {
128         return createdDate;
129     }
130
131     /**
132      * @return the modifiedDate
133      */
134     public Date getModifiedDate() {
135         return modifiedDate;
136     }
137
138     public String getUsername(){
139         return this.username;
140     }
141     public void setUsername(String username){
142         this.username = username;
143     }
144     public String getPassword(){
145         return this.password;
146     }
147     public void setPassword(String password){
148         this.password = password;
149     }
150 }