2 * ============LICENSE_START=======================================================
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
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;
23 import java.io.Serializable;
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;
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;
41 private static String domain;
44 @GeneratedValue(strategy = GenerationType.AUTO)
48 @Column(name="parentItemName", nullable=false)
50 private String parentItemName;
52 @Column(name="description")
53 private String description;
55 @Column(name="addressList")
56 private String addressList;
58 @Column(name="serviceList")
59 private String serviceList;
61 /* @Temporal(TemporalType.TIMESTAMP)
62 @Column(name="created_date", updatable=false)
63 private Date createdDate;
65 @Temporal(TemporalType.TIMESTAMP)
66 @Column(name="modified_date", nullable=false)
67 private Date modifiedDate;
69 @ManyToOne(optional = false)
70 @JoinColumn(name="created_by")
71 private UserInfo userCreatedBy;
73 @ManyToOne(optional = false)
74 @JoinColumn(name="modified_by")
75 private UserInfo userModifiedBy;*/
81 public void setId(int id) {
85 public String getParentItemName() {
86 return parentItemName;
89 public String getDescription() {
93 public String getAddressList() {
97 public String getServiceList() {
101 public void setParentItemName(String parentItemName) {
102 this.parentItemName = parentItemName;
105 public void setDescription(String description) {
106 this.description = description;
109 public void setAddressList(String addressList) {
110 this.addressList = addressList;
113 public void setServiceList(String serviceList) {
114 this.serviceList = serviceList;
118 /*public UserInfo getUserCreatedBy() {
119 return userCreatedBy;
122 public void setUserCreatedBy(UserInfo userCreatedBy) {
123 this.userCreatedBy = userCreatedBy;
126 public UserInfo getUserModifiedBy() {
127 return userModifiedBy;
130 public void setUserModifiedBy(UserInfo userModifiedBy) {
131 this.userModifiedBy = userModifiedBy;
134 public FirewallDictionaryList() {
138 public FirewallDictionaryList(String string, String userid) {
141 public FirewallDictionaryList(String domain) {
142 this.parentItemName = domain;
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);
154 public void preUpdate() {
155 this.modifiedDate = new Date();
157 this.userModifiedBy =XacmlAdminAuthorization.getUserId();;
158 } catch (Exception e) {
159 PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "TermList", "Exception caused While adding Modified by Role");
161 auditLogger.debug("Updated Term Name: "+this.parentItemName+" by "+this.userModifiedBy);