2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2018 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;
25 import java.io.Serializable;
26 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 = "ClosedLoopD2Services")
46 @NamedQuery(name="ClosedLoopD2Services.findAll", query="SELECT c FROM ClosedLoopD2Services c ")
47 public class ClosedLoopD2Services implements Serializable{
48 private static final long serialVersionUID = 1L;
52 @GeneratedValue(strategy = GenerationType.AUTO)
55 @Column(name="service_Name", nullable=false, unique=true)
57 private String serviceName;
59 @Column(name="description", nullable=true, length=2048)
60 private String description;
62 @Temporal(TemporalType.TIMESTAMP)
63 @Column(name="created_date", updatable=false)
64 private Date createdDate;
66 @Temporal(TemporalType.TIMESTAMP)
67 @Column(name="modified_date", nullable=false)
68 private Date modifiedDate;
70 @ManyToOne(optional = false)
71 @JoinColumn(name="created_by")
72 private UserInfo userCreatedBy;
74 @ManyToOne(optional = false)
75 @JoinColumn(name="modified_by")
76 private UserInfo userModifiedBy;
78 public UserInfo getUserCreatedBy() {
82 public void setUserCreatedBy(UserInfo userCreatedBy) {
83 this.userCreatedBy = userCreatedBy;
86 public UserInfo getUserModifiedBy() {
87 return userModifiedBy;
90 public void setUserModifiedBy(UserInfo userModifiedBy) {
91 this.userModifiedBy = userModifiedBy;
94 public ClosedLoopD2Services(){
95 //An empty constructor
99 public void prePersist() {
100 Date date = new Date();
101 this.createdDate = date;
102 this.modifiedDate = date;
106 public void preUpdate() {
107 this.modifiedDate = new Date();
114 public void setId(int id) {
118 public String getServiceName() {
122 public void setServiceName(String serviceName) {
123 this.serviceName = serviceName;
126 public String getDescription() {
130 public void setDescription(String description) {
131 this.description = description;
134 public Date getCreatedDate() {
138 public void setCreatedDate(Date createdDate) {
139 this.createdDate = createdDate;
142 public Date getModifiedDate() {
146 public void setModifiedDate(Date modifiedDate) {
147 this.modifiedDate = modifiedDate;