2 * ============LICENSE_START=======================================================
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
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;
26 import java.io.Serializable;
27 import java.util.Date;
28 import javax.persistence.Column;
29 import javax.persistence.Entity;
30 import javax.persistence.GeneratedValue;
31 import javax.persistence.GenerationType;
32 import javax.persistence.Id;
33 import javax.persistence.JoinColumn;
34 import javax.persistence.ManyToOne;
35 import javax.persistence.NamedQuery;
36 import javax.persistence.OrderBy;
37 import javax.persistence.PrePersist;
38 import javax.persistence.PreUpdate;
39 import javax.persistence.Table;
40 import javax.persistence.Temporal;
41 import javax.persistence.TemporalType;
45 @Table(name = "ClosedLoopSite")
46 @NamedQuery(name="ClosedLoopSite.findAll", query="SELECT c FROM ClosedLoopSite c ")
47 public class ClosedLoopSite implements Serializable{
48 private static final long serialVersionUID = 1L;
53 @GeneratedValue(strategy = GenerationType.AUTO)
56 @Column(name="site_Name", nullable=false, unique=true)
58 private String siteName;
60 @Column(name="description", nullable=true, length=2048)
61 private String description;
63 @Temporal(TemporalType.TIMESTAMP)
64 @Column(name="created_date", updatable=false)
65 private Date createdDate;
67 @Temporal(TemporalType.TIMESTAMP)
68 @Column(name="modified_date", nullable=false)
69 private Date modifiedDate;
71 @ManyToOne(optional = false)
72 @JoinColumn(name="created_by")
73 private UserInfo userCreatedBy;
75 @ManyToOne(optional = false)
76 @JoinColumn(name="modified_by")
77 private UserInfo userModifiedBy;
79 public ClosedLoopSite() {
80 this.setModifiedDate(new Date());
84 public UserInfo getUserCreatedBy() {
88 public void setUserCreatedBy(UserInfo userCreatedBy) {
89 this.userCreatedBy = userCreatedBy;
92 public UserInfo getUserModifiedBy() {
93 return userModifiedBy;
96 public void setUserModifiedBy(UserInfo userModifiedBy) {
97 this.userModifiedBy = userModifiedBy;
101 public void prePersist() {
102 Date date = new Date();
103 this.createdDate = date;
104 this.modifiedDate = date;
108 public void preUpdate() {
109 this.modifiedDate = new Date();
116 public void setId(int id) {
120 public String getSiteName() {
124 public void setSiteName(String siteName) {
125 this.siteName = siteName;
128 public String getDescription() {
132 public void setDescription(String description) {
133 this.description = description;
136 public Date getCreatedDate() {
140 public void setCreatedDate(Date createdDate) {
141 this.createdDate = createdDate;
144 public Date getModifiedDate() {
148 public void setModifiedDate(Date modifiedDate) {
149 this.modifiedDate = modifiedDate;