XSS Vulnerability fix in AppContactUsController
[portal.git] / ecomp-portal-BE-common / src / main / java / org / onap / portalapp / portal / ecomp / model / AppContactUsItem.java
1 /*-
2  * ============LICENSE_START==========================================
3  * ONAP Portal
4  * ===================================================================
5  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
6  * ===================================================================
7  *
8  * Unless otherwise specified, all software contained herein is licensed
9  * under the Apache License, Version 2.0 (the "License");
10  * you may not use this software except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *             http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  * Unless otherwise specified, all documentation contained herein is licensed
22  * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
23  * you may not use this documentation except in compliance with the License.
24  * You may obtain a copy of the License at
25  *
26  *             https://creativecommons.org/licenses/by/4.0/
27  *
28  * Unless required by applicable law or agreed to in writing, documentation
29  * distributed under the License is distributed on an "AS IS" BASIS,
30  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31  * See the License for the specific language governing permissions and
32  * limitations under the License.
33  *
34  * ============LICENSE_END============================================
35  *
36  * 
37  */
38 package org.onap.portalapp.portal.ecomp.model;
39
40 import javax.persistence.Entity;
41 import javax.persistence.Id;
42
43 import org.hibernate.validator.constraints.SafeHtml;
44 import org.onap.portalsdk.core.domain.support.DomainVo;
45 import com.fasterxml.jackson.annotation.JsonInclude;
46
47 /**
48  * An easily serializable version of row information from the fn_app_contact_us
49  * table; specifically this has an app ID instead of an EPApp object.
50  */
51 @Entity
52 @JsonInclude(JsonInclude.Include.NON_NULL)
53 public class AppContactUsItem extends DomainVo {
54
55         private static final long serialVersionUID = 6964210807573346262L;
56
57         @Id
58         private Long appId;
59         @SafeHtml
60         private String appName;
61         @SafeHtml
62         private String description;
63         @SafeHtml
64         private String contactName;
65         @SafeHtml
66         private String contactEmail;
67         @SafeHtml
68         private String url;
69         @SafeHtml
70         private String activeYN;
71
72         public Long getAppId() {
73                 return appId;
74         }
75
76         public void setAppId(Long appId) {
77                 this.appId = appId;
78         }
79
80         public String getAppName() {
81                 return appName;
82         }
83
84         public void setAppName(String appName) {
85                 this.appName = appName;
86         }
87
88         public String getDescription() {
89                 return description;
90         }
91
92         public void setDescription(String description) {
93                 this.description = description;
94         }
95
96         public String getContactName() {
97                 return contactName;
98         }
99
100         public void setContactName(String contactName) {
101                 this.contactName = contactName;
102         }
103
104         public String getContactEmail() {
105                 return contactEmail;
106         }
107
108         public void setContactEmail(String contactEmail) {
109                 this.contactEmail = contactEmail;
110         }
111
112         public String getUrl() {
113                 return url;
114         }
115
116         public void setUrl(String url) {
117                 this.url = url;
118         }
119
120         public String getActiveYN() {
121                 return activeYN;
122         }
123
124         public void setActiveYN(String activeYN) {
125                 this.activeYN = activeYN;
126         }
127
128         @Override
129         public int hashCode() {
130                 final int prime = 31;
131                 int result = 1;
132                 result = prime * result + ((activeYN == null) ? 0 : activeYN.hashCode());
133                 result = prime * result + ((appId == null) ? 0 : appId.hashCode());
134                 result = prime * result + ((appName == null) ? 0 : appName.hashCode());
135                 result = prime * result + ((contactEmail == null) ? 0 : contactEmail.hashCode());
136                 result = prime * result + ((contactName == null) ? 0 : contactName.hashCode());
137                 result = prime * result + ((description == null) ? 0 : description.hashCode());
138                 result = prime * result + ((url == null) ? 0 : url.hashCode());
139                 return result;
140         }
141
142         @Override
143         public boolean equals(Object obj) {
144                 if (this == obj)
145                         return true;
146                 if (obj == null)
147                         return false;
148                 if (getClass() != obj.getClass())
149                         return false;
150                 AppContactUsItem other = (AppContactUsItem) obj;
151                 if (activeYN == null) {
152                         if (other.activeYN != null)
153                                 return false;
154                 } else if (!activeYN.equals(other.activeYN))
155                         return false;
156                 if (appId == null) {
157                         if (other.appId != null)
158                                 return false;
159                 } else if (!appId.equals(other.appId))
160                         return false;
161                 if (appName == null) {
162                         if (other.appName != null)
163                                 return false;
164                 } else if (!appName.equals(other.appName))
165                         return false;
166                 if (contactEmail == null) {
167                         if (other.contactEmail != null)
168                                 return false;
169                 } else if (!contactEmail.equals(other.contactEmail))
170                         return false;
171                 if (contactName == null) {
172                         if (other.contactName != null)
173                                 return false;
174                 } else if (!contactName.equals(other.contactName))
175                         return false;
176                 if (description == null) {
177                         if (other.description != null)
178                                 return false;
179                 } else if (!description.equals(other.description))
180                         return false;
181                 if (url == null) {
182                         if (other.url != null)
183                                 return false;
184                 } else if (!url.equals(other.url))
185                         return false;
186                 return true;
187         }
188
189         @Override
190         public String toString() {
191                 return "AppContactUsItem [appId=" + appId + ", appName=" + appName + ", description=" + description
192                                 + ", contactName=" + contactName + ", contactEmail=" + contactEmail + ", url=" + url + ", activeYN="
193                                 + activeYN + "]";
194         }
195
196 }