2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * Modifications Copyright (C) 2019 Nordix Foundation.
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
22 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;
42 * 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")
56 public class PolicyDbDaoEntity implements Serializable {
57 private static final long serialVersionUID = 1L;
60 @Column(name = "policyDbDaoUrl", nullable = false, unique = true)
61 private String policyDbDaoUrl;
63 @Temporal(TemporalType.TIMESTAMP)
64 @Column(name = "created_date", updatable = false)
65 private Date createdDate;
67 // username for the pap server that registered this PolicyDbDaoEntity
68 @Column(name = "username")
69 private String username;
71 // AES encrypted password for the pap server that registered this PolicyDbDaoEntity
72 @Column(name = "password")
73 private String password;
75 // A column to allow some descriptive text. For example: Atlanta data center
76 @Column(name = "description", nullable = false, length = 2048)
77 private String description = "NoDescription";
79 @Temporal(TemporalType.TIMESTAMP)
80 @Column(name = "modified_date", nullable = false)
81 private Date modifiedDate;
84 * Instantiates a new policy DB dao entity.
86 public PolicyDbDaoEntity() {
94 public void prePersist() {
95 Date date = new Date();
96 this.createdDate = date;
97 this.modifiedDate = date;
104 public void preUpdate() {
105 this.modifiedDate = new Date();