Merge "Added Junis for Policy ONAP-REST"
[policy/engine.git] / ONAP-REST / src / main / java / org / onap / policy / rest / jpa / DescriptiveScope.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP-REST
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
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 import java.io.Serializable;
24 import java.util.Date;
25
26 import javax.persistence.Column;
27 import javax.persistence.Entity;
28 import javax.persistence.GeneratedValue;
29 import javax.persistence.GenerationType;
30 import javax.persistence.Id;
31 import javax.persistence.JoinColumn;
32 import javax.persistence.ManyToOne;
33 import javax.persistence.NamedQuery;
34 import javax.persistence.OrderBy;
35 import javax.persistence.PrePersist;
36 import javax.persistence.PreUpdate;
37 import javax.persistence.Table;
38 import javax.persistence.Temporal;
39 import javax.persistence.TemporalType;
40
41
42 @Entity
43 @Table(name = "DescriptiveScope")
44 @NamedQuery(name = "DescriptiveScope.findAll", query= "Select p from DescriptiveScope p")
45 public class DescriptiveScope implements Serializable {
46         private static final long serialVersionUID = 1L;
47         @Id
48         @GeneratedValue(strategy = GenerationType.AUTO)
49         @Column(name = "Id")
50         private int id;
51
52         @Column(name="scopename", nullable=false)
53         @OrderBy("asc")
54         private String descriptiveScopeName;
55
56         @Column(name="description", nullable=true, length=2048)
57         private String description;
58
59         @Column(name="search", nullable=true)
60         @OrderBy("asc")
61         private String search;
62
63         @Temporal(TemporalType.TIMESTAMP)
64         @Column(name="created_date", updatable=false)
65         private Date createdDate;
66
67         @Temporal(TemporalType.TIMESTAMP)
68         @Column(name="modified_date", nullable=false)
69         private Date modifiedDate;
70
71         @ManyToOne(optional = false)
72         @JoinColumn(name="created_by")
73         private UserInfo userCreatedBy;
74
75         @ManyToOne(optional = false)
76         @JoinColumn(name="modified_by")
77         private UserInfo userModifiedBy;
78         
79         public UserInfo getUserCreatedBy() {
80                 return userCreatedBy;
81         }
82
83         public void setUserCreatedBy(UserInfo userCreatedBy) {
84                 this.userCreatedBy = userCreatedBy;
85         }
86
87         public UserInfo getUserModifiedBy() {
88                 return userModifiedBy;
89         }
90
91         public void setUserModifiedBy(UserInfo userModifiedBy) {
92                 this.userModifiedBy = userModifiedBy;
93         }
94         
95         @PrePersist
96         public void     prePersist() {
97                 Date date = new Date();
98                 this.createdDate = date;
99                 this.modifiedDate = date;
100         }
101         
102         @PreUpdate
103         public void preUpdate() {
104                 this.modifiedDate = new Date();
105         }
106         
107         public int getId() {
108                 return this.id;
109         }
110         public void setId(int id) {
111                 this.id = id;
112         }
113         
114         public String getScopeName() {
115                 return descriptiveScopeName;
116         }
117
118         public void setScopeName(String descriptiveScopeName) {
119                 this.descriptiveScopeName = descriptiveScopeName;
120         }
121
122         public String getSearch() {
123                 return search;
124         }
125
126         public void setSearch(String search) {
127                 this.search = search;
128         }
129         
130         public Date getCreatedDate() {
131                 return this.createdDate;
132         }
133         
134         public void setCreatedDate(Date createdDate) {
135                 this.createdDate = createdDate;
136         }
137         
138         public String getDescription() {
139                 return this.description;
140         }
141         
142         public void setDescription(String description) {
143                 this.description = description;
144         }
145         
146         public Date getModifiedDate() {
147                 return this.modifiedDate;
148         }
149         
150         public void setModifiedDate(Date modifiedDate) {
151                 this.modifiedDate = modifiedDate;
152         }
153
154 }