2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.onap.policy.rest.jpa;
24 import java.io.Serializable;
25 import java.util.Date;
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;
39 * The Entity class to persist a PolicyDBDaoEntity object for registration of PolicyDBDao
46 @Table(name="PolicyDBDaoEntity")
49 @NamedQuery(name="PolicyDBDaoEntity.findAll", query="SELECT e FROM PolicyDBDaoEntity e "),
50 @NamedQuery(name="PolicyDBDaoEntity.deleteAll", query="DELETE FROM PolicyDBDaoEntity WHERE 1=1")
53 public class PolicyDBDaoEntity implements Serializable {
54 private static final long serialVersionUID = 1L;
57 @Column(name="policyDBDaoUrl", nullable=false, unique=true)
58 private String policyDBDaoUrl;
60 @Temporal(TemporalType.TIMESTAMP)
61 @Column(name="created_date", updatable=false)
62 private Date createdDate;
64 //username for the pap server that registered this PolicyDBDaoEntity
65 @Column(name="username")
66 private String username;
68 //AES encrypted password for the pap server that registered this PolicyDBDaoEntity
69 @Column(name="password")
70 private String password;
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";
76 @Temporal(TemporalType.TIMESTAMP)
77 @Column(name="modified_date", nullable=false)
78 private Date modifiedDate;
80 public PolicyDBDaoEntity() {
85 public void prePersist() {
86 Date date = new Date();
87 this.createdDate = date;
88 this.modifiedDate = date;
92 public void preUpdate() {
93 this.modifiedDate = new Date();
97 * @return the policyDBDaoUrl
99 public String getPolicyDBDaoUrl() {
100 return policyDBDaoUrl;
104 * @param url the policyDBDaoUrl to set
106 public void setPolicyDBDaoUrl(String url) {
107 this.policyDBDaoUrl = url;
111 * @return the description
113 public String getDescription() {
118 * @param description the description to set
120 public void setDescription(String description) {
121 this.description = description;
125 * @return the createdDate
127 public Date getCreatedDate() {
132 * @return the modifiedDate
134 public Date getModifiedDate() {
138 public String getUsername(){
139 return this.username;
141 public void setUsername(String username){
142 this.username = username;
144 public String getPassword(){
145 return this.password;
147 public void setPassword(String password){
148 this.password = password;