2 * ============LICENSE_START==========================================
4 * ===================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ===================================================================
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
13 * http://www.apache.org/licenses/LICENSE-2.0
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.
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
26 * https://creativecommons.org/licenses/by/4.0/
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.
34 * ============LICENSE_END============================================
38 package org.onap.portalapp.portal.domain;
40 import java.util.Arrays;
42 import javax.persistence.Lob;
44 import javax.validation.Valid;
45 import org.apache.commons.lang.StringUtils;
46 import org.hibernate.validator.constraints.SafeHtml;
47 import org.onap.portalsdk.core.domain.support.DomainVo;
50 * Model for all columns in the fn_app table.
52 public class EPApp extends DomainVo {
54 private static final long serialVersionUID = 1L;
58 private String imageUrl;
60 private String description;
66 private String alternateUrl;
68 private String appRestEndpoint;
70 private String mlAppName;
72 private String mlAppAdminId;
75 private String username;
77 private String appPassword;
79 private byte[] thumbnail;
81 private Boolean enabled;
83 private String uebTopicName;
85 private String uebKey;
87 private String uebSecret;
88 private Integer appType;
90 private AppContactUs contactUs;
91 private Boolean centralAuth;
93 private String nameSpace;
97 // We set here all default values. We also place protection
98 // into setters for fields with default values.
99 // If we don't use such protection we are able to place null
100 // to these fields and save such fields into DB even if DB has
101 // default values for these fields.
104 this.mlAppAdminId = "";
106 this.appPassword = "";
107 this.open = new Boolean(false);
108 this.enabled = new Boolean(true);
109 this.uebTopicName = "";
115 public String getName() {
119 public void setName(String name) {
120 if (StringUtils.isEmpty(name)) {
126 public String getImageUrl() {
130 public void setImageUrl(String imageUrl) {
131 this.imageUrl = imageUrl;
136 public byte[] getThumbnail() {
137 return this.thumbnail;
140 public void setThumbnail(byte[] thumbnail) {
141 this.thumbnail = thumbnail;
144 public String getDescription() {
148 public void setDescription(String description) {
149 this.description = description;
152 public String getNotes() {
156 public void setNotes(String notes) {
160 public String getUrl() {
164 public void setUrl(String url) {
168 public String getAlternateUrl() {
172 public void setAlternateUrl(String alternateUrl) {
173 this.alternateUrl = alternateUrl;
176 public String getAppRestEndpoint() {
177 return appRestEndpoint;
180 public void setAppRestEndpoint(String appRestEndpoint) {
181 this.appRestEndpoint = appRestEndpoint;
184 public String getMlAppName() {
188 public void setMlAppName(String mlAppName) {
189 if (StringUtils.isEmpty(mlAppName)) {
192 this.mlAppName = mlAppName;
195 public String getMlAppAdminId() {
199 public void setMlAppAdminId(String mlAppAdminId) {
200 if (StringUtils.isEmpty(mlAppAdminId)) {
203 this.mlAppAdminId = mlAppAdminId;
206 public Long getMotsId() {
210 public void setMotsId(Long motsId) {
211 this.motsId = motsId;
214 public String getUsername() {
218 public void setUsername(String username) {
219 this.username = username;
222 public String getAppPassword() {
226 public void setAppPassword(String appPassword) {
227 if (StringUtils.isEmpty(appPassword)) {
230 this.appPassword = appPassword;
233 public Boolean getOpen() {
237 public void setOpen(Boolean open) {
239 open = new Boolean(false);
244 public Boolean getEnabled() {
248 public void setEnabled(Boolean enabled) {
249 if (enabled == null) {
250 enabled = new Boolean(true);
252 this.enabled = enabled;
255 public Integer getAppType() {
259 public void setAppType(Integer appType) {
260 if (appType == null) {
261 appType = new Integer(1);
263 this.appType = appType;
266 public void setRestrictedApp(Boolean restrictedApp) {
271 this.appType = result;
274 public Boolean isRestrictedApp() {
275 return (this.appType == 2 ? true : false);
278 public int compareTo(Object obj) {
280 Long c2 = ((EPApp) obj).getId();
282 return c1.compareTo(c2);
285 public String getUebTopicName() {
286 return this.uebTopicName;
289 public void setUebTopicName(String topicName) {
290 if (StringUtils.isEmpty(topicName)) {
291 this.uebTopicName = "";
293 this.uebTopicName = topicName;
296 public String getUebKey() {
300 public void setUebKey(String uebKey) {
301 if (StringUtils.isEmpty(uebKey)) {
304 this.uebKey = uebKey;
307 public String getUebSecret() {
308 return this.uebSecret;
311 public void setUebSecret(String uebSecret) {
312 if (StringUtils.isEmpty(uebSecret)) {
315 this.uebSecret = uebSecret;
318 public AppContactUs getContactUs() {
322 public void setContactUs(AppContactUs contactUs) {
323 this.contactUs = contactUs;
326 public Boolean getCentralAuth() {
330 public void setCentralAuth(Boolean centralAuth) {
331 if (centralAuth == null) {
332 centralAuth = new Boolean(false);
334 this.centralAuth = centralAuth;
337 public String getNameSpace() {
341 public void setNameSpace(String nameSpace) {
342 if (StringUtils.isEmpty(nameSpace)) {
345 this.nameSpace = nameSpace;
349 public String toString() {
350 String str = "[" + getId() + ":" + getName() + "]";
355 public int hashCode() {
356 final int prime = 31;
358 result = prime * result + ((alternateUrl == null) ? 0 : alternateUrl.hashCode());
359 result = prime * result + ((appPassword == null) ? 0 : appPassword.hashCode());
360 result = prime * result + ((appRestEndpoint == null) ? 0 : appRestEndpoint.hashCode());
361 result = prime * result + ((appType == null) ? 0 : appType.hashCode());
362 result = prime * result + ((centralAuth == null) ? 0 : centralAuth.hashCode());
363 result = prime * result + ((contactUs == null) ? 0 : contactUs.hashCode());
364 result = prime * result + ((description == null) ? 0 : description.hashCode());
365 result = prime * result + ((enabled == null) ? 0 : enabled.hashCode());
366 result = prime * result + ((imageUrl == null) ? 0 : imageUrl.hashCode());
367 result = prime * result + ((mlAppAdminId == null) ? 0 : mlAppAdminId.hashCode());
368 result = prime * result + ((mlAppName == null) ? 0 : mlAppName.hashCode());
369 result = prime * result + ((motsId == null) ? 0 : motsId.hashCode());
370 result = prime * result + ((name == null) ? 0 : name.hashCode());
371 result = prime * result + ((nameSpace == null) ? 0 : nameSpace.hashCode());
372 result = prime * result + ((notes == null) ? 0 : notes.hashCode());
373 result = prime * result + ((open == null) ? 0 : open.hashCode());
374 result = prime * result + Arrays.hashCode(thumbnail);
375 result = prime * result + ((uebKey == null) ? 0 : uebKey.hashCode());
376 result = prime * result + ((uebSecret == null) ? 0 : uebSecret.hashCode());
377 result = prime * result + ((uebTopicName == null) ? 0 : uebTopicName.hashCode());
378 result = prime * result + ((url == null) ? 0 : url.hashCode());
379 result = prime * result + ((username == null) ? 0 : username.hashCode());
384 public boolean equals(Object obj) {
389 if (getClass() != obj.getClass())
391 EPApp other = (EPApp) obj;
392 if (alternateUrl == null) {
393 if (other.alternateUrl != null)
395 } else if (!alternateUrl.equals(other.alternateUrl))
397 if (appPassword == null) {
398 if (other.appPassword != null)
400 } else if (!appPassword.equals(other.appPassword))
402 if (appRestEndpoint == null) {
403 if (other.appRestEndpoint != null)
405 } else if (!appRestEndpoint.equals(other.appRestEndpoint))
407 if (appType == null) {
408 if (other.appType != null)
410 } else if (!appType.equals(other.appType))
412 if (centralAuth == null) {
413 if (other.centralAuth != null)
415 } else if (!centralAuth.equals(other.centralAuth))
417 if (contactUs == null) {
418 if (other.contactUs != null)
420 } else if (!contactUs.equals(other.contactUs))
422 if (description == null) {
423 if (other.description != null)
425 } else if (!description.equals(other.description))
427 if (enabled == null) {
428 if (other.enabled != null)
430 } else if (!enabled.equals(other.enabled))
432 if (imageUrl == null) {
433 if (other.imageUrl != null)
435 } else if (!imageUrl.equals(other.imageUrl))
437 if (mlAppAdminId == null) {
438 if (other.mlAppAdminId != null)
440 } else if (!mlAppAdminId.equals(other.mlAppAdminId))
442 if (mlAppName == null) {
443 if (other.mlAppName != null)
445 } else if (!mlAppName.equals(other.mlAppName))
447 if (motsId == null) {
448 if (other.motsId != null)
450 } else if (!motsId.equals(other.motsId))
453 if (other.name != null)
455 } else if (!name.equals(other.name))
457 if (nameSpace == null) {
458 if (other.nameSpace != null)
460 } else if (!nameSpace.equals(other.nameSpace))
463 if (other.notes != null)
465 } else if (!notes.equals(other.notes))
468 if (other.open != null)
470 } else if (!open.equals(other.open))
472 if (!Arrays.equals(thumbnail, other.thumbnail))
474 if (uebKey == null) {
475 if (other.uebKey != null)
477 } else if (!uebKey.equals(other.uebKey))
479 if (uebSecret == null) {
480 if (other.uebSecret != null)
482 } else if (!uebSecret.equals(other.uebSecret))
484 if (uebTopicName == null) {
485 if (other.uebTopicName != null)
487 } else if (!uebTopicName.equals(other.uebTopicName))
490 if (other.url != null)
492 } else if (!url.equals(other.url))
494 if (username == null) {
495 if (other.username != null)
497 } else if (!username.equals(other.username))