27f5e75bdc4effcfa166d71421f79e71ecedeb89
[policy/engine.git] / ONAP-REST / src / main / java / org / onap / policy / rest / jpa / FirewallDictionaryList.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP-REST
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
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
25 import javax.persistence.Column;
26 import javax.persistence.Entity;
27 import javax.persistence.GeneratedValue;
28 import javax.persistence.GenerationType;
29 import javax.persistence.Id;
30 import javax.persistence.NamedQuery;
31 import javax.persistence.OrderBy;
32 import javax.persistence.Table;
33
34
35 @Entity
36 @Table(name="parentdictionaryitems")
37 @NamedQuery(name="FirewallDictionaryList.findAll", query="SELECT e FROM FirewallDictionaryList e")
38 public class FirewallDictionaryList implements Serializable {
39         private static final long serialVersionUID = 1L;
40
41         private static String domain;
42
43         @Id
44         @GeneratedValue(strategy = GenerationType.AUTO)
45         @Column(name="id")
46         private int id;
47         
48         @Column(name="parentItemName", nullable=false)
49         @OrderBy("asc")
50         private String parentItemName;
51         
52         @Column(name="description")
53         private String description;
54         
55         @Column(name="addressList")
56         private String addressList;
57         
58         @Column(name="serviceList")
59         private String serviceList;
60         
61 /*      @Temporal(TemporalType.TIMESTAMP)
62         @Column(name="created_date", updatable=false)
63         private Date createdDate;
64
65         @Temporal(TemporalType.TIMESTAMP)
66         @Column(name="modified_date", nullable=false)
67         private Date modifiedDate;
68         
69         @ManyToOne(optional = false)
70         @JoinColumn(name="created_by")
71         private UserInfo userCreatedBy;
72
73         @ManyToOne(optional = false)
74         @JoinColumn(name="modified_by")
75         private UserInfo userModifiedBy;*/
76
77         public int getId() {
78                 return this.id;
79         }
80
81         public void setId(int id) {
82                 this.id = id;
83         }
84         
85         public String getParentItemName() {
86                 return parentItemName;
87         }
88
89         public String getDescription() {
90                 return description;
91         }
92
93         public String getAddressList() {
94                 return addressList;
95         }
96
97         public String getServiceList() {
98                 return serviceList;
99         }
100
101         public void setParentItemName(String parentItemName) {
102                 this.parentItemName = parentItemName;
103         }
104
105         public void setDescription(String description) {
106                 this.description = description;
107         }
108
109         public void setAddressList(String addressList) {
110                 this.addressList = addressList;
111         }
112
113         public void setServiceList(String serviceList) {
114                 this.serviceList = serviceList;
115         }
116         
117         
118         /*public UserInfo getUserCreatedBy() {
119                 return userCreatedBy;
120         }
121
122         public void setUserCreatedBy(UserInfo userCreatedBy) {
123                 this.userCreatedBy = userCreatedBy;
124         }
125
126         public UserInfo getUserModifiedBy() {
127                 return userModifiedBy;
128         }
129
130         public void setUserModifiedBy(UserInfo userModifiedBy) {
131                 this.userModifiedBy = userModifiedBy;
132         }*/
133
134         public FirewallDictionaryList() {
135                 
136         }
137         
138         public FirewallDictionaryList(String string, String userid) {
139                 this(domain);
140         }
141         public FirewallDictionaryList(String domain) {
142                 this.parentItemName = domain;
143         }       
144
145         /*@PrePersist
146         public void     prePersist() {
147                 Date date = new Date();
148                 this.createdDate = date;
149                 this.modifiedDate = date;
150                 auditLogger.debug("Added New Term Name: "+this.parentItemName+" by "+this.userCreatedBy);
151                 
152         }
153         @PreUpdate
154         public void preUpdate() {
155                 this.modifiedDate = new Date();
156                 try {
157                         this.userModifiedBy =XacmlAdminAuthorization.getUserId();;
158                 } catch (Exception e) {
159                         PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "TermList", "Exception caused While adding Modified by Role");
160                 }
161                 auditLogger.debug("Updated Term Name: "+this.parentItemName+" by "+this.userModifiedBy);
162         }
163 */
164 }