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 org.apache.commons.lang.StringUtils;
45 import org.onap.portalsdk.core.domain.support.DomainVo;
48 * Model for all columns in the fn_app table.
50 public class EPApp extends DomainVo {
52 private static final long serialVersionUID = 1L;
55 private String imageUrl;
56 private String description;
59 private String alternateUrl;
60 private String appRestEndpoint;
61 private String mlAppName;
62 private String mlAppAdminId;
64 private String username;
65 private String appPassword;
67 private byte[] thumbnail;
69 private Boolean enabled;
70 private String uebTopicName;
71 private String uebKey;
72 private String uebSecret;
73 private Integer appType;
74 private AppContactUs contactUs;
75 private Boolean centralAuth;
76 private String nameSpace;
80 // We set here all default values. We also place protection
81 // into setters for fields with default values.
82 // If we don't use such protection we are able to place null
83 // to these fields and save such fields into DB even if DB has
84 // default values for these fields.
87 this.mlAppAdminId = "";
89 this.appPassword = "";
90 this.open = new Boolean(false);
91 this.enabled = new Boolean(true);
92 this.uebTopicName = "";
98 public String getName() {
102 public void setName(String name) {
103 if (StringUtils.isEmpty(name)) {
109 public String getImageUrl() {
113 public void setImageUrl(String imageUrl) {
114 this.imageUrl = imageUrl;
119 public byte[] getThumbnail() {
120 return this.thumbnail;
123 public void setThumbnail(byte[] thumbnail) {
124 this.thumbnail = thumbnail;
127 public String getDescription() {
131 public void setDescription(String description) {
132 this.description = description;
135 public String getNotes() {
139 public void setNotes(String notes) {
143 public String getUrl() {
147 public void setUrl(String url) {
151 public String getAlternateUrl() {
155 public void setAlternateUrl(String alternateUrl) {
156 this.alternateUrl = alternateUrl;
159 public String getAppRestEndpoint() {
160 return appRestEndpoint;
163 public void setAppRestEndpoint(String appRestEndpoint) {
164 this.appRestEndpoint = appRestEndpoint;
167 public String getMlAppName() {
171 public void setMlAppName(String mlAppName) {
172 if (StringUtils.isEmpty(mlAppName)) {
175 this.mlAppName = mlAppName;
178 public String getMlAppAdminId() {
182 public void setMlAppAdminId(String mlAppAdminId) {
183 if (StringUtils.isEmpty(mlAppAdminId)) {
186 this.mlAppAdminId = mlAppAdminId;
189 public Long getMotsId() {
193 public void setMotsId(Long motsId) {
194 this.motsId = motsId;
197 public String getUsername() {
201 public void setUsername(String username) {
202 this.username = username;
205 public String getAppPassword() {
209 public void setAppPassword(String appPassword) {
210 if (StringUtils.isEmpty(appPassword)) {
213 this.appPassword = appPassword;
216 public Boolean getOpen() {
220 public void setOpen(Boolean open) {
222 open = new Boolean(false);
227 public Boolean getEnabled() {
231 public void setEnabled(Boolean enabled) {
232 if (enabled == null) {
233 enabled = new Boolean(true);
235 this.enabled = enabled;
238 public Integer getAppType() {
242 public void setAppType(Integer appType) {
243 if (appType == null) {
244 appType = new Integer(1);
246 this.appType = appType;
249 public void setRestrictedApp(Boolean restrictedApp) {
254 this.appType = result;
257 public Boolean isRestrictedApp() {
258 return (this.appType == 2 ? true : false);
261 public int compareTo(Object obj) {
263 Long c2 = ((EPApp) obj).getId();
265 return c1.compareTo(c2);
268 public String getUebTopicName() {
269 return this.uebTopicName;
272 public void setUebTopicName(String topicName) {
273 if (StringUtils.isEmpty(topicName)) {
274 this.uebTopicName = "";
276 this.uebTopicName = topicName;
279 public String getUebKey() {
283 public void setUebKey(String uebKey) {
284 if (StringUtils.isEmpty(uebKey)) {
287 this.uebKey = uebKey;
290 public String getUebSecret() {
291 return this.uebSecret;
294 public void setUebSecret(String uebSecret) {
295 if (StringUtils.isEmpty(uebSecret)) {
298 this.uebSecret = uebSecret;
301 public AppContactUs getContactUs() {
305 public void setContactUs(AppContactUs contactUs) {
306 this.contactUs = contactUs;
309 public Boolean getCentralAuth() {
313 public void setCentralAuth(Boolean centralAuth) {
314 if (centralAuth == null) {
315 centralAuth = new Boolean(false);
317 this.centralAuth = centralAuth;
320 public String getNameSpace() {
324 public void setNameSpace(String nameSpace) {
325 if (StringUtils.isEmpty(nameSpace)) {
328 this.nameSpace = nameSpace;
332 public String toString() {
333 String str = "[" + getId() + ":" + getName() + "]";
338 public int hashCode() {
339 final int prime = 31;
341 result = prime * result + ((alternateUrl == null) ? 0 : alternateUrl.hashCode());
342 result = prime * result + ((appPassword == null) ? 0 : appPassword.hashCode());
343 result = prime * result + ((appRestEndpoint == null) ? 0 : appRestEndpoint.hashCode());
344 result = prime * result + ((appType == null) ? 0 : appType.hashCode());
345 result = prime * result + ((centralAuth == null) ? 0 : centralAuth.hashCode());
346 result = prime * result + ((contactUs == null) ? 0 : contactUs.hashCode());
347 result = prime * result + ((description == null) ? 0 : description.hashCode());
348 result = prime * result + ((enabled == null) ? 0 : enabled.hashCode());
349 result = prime * result + ((imageUrl == null) ? 0 : imageUrl.hashCode());
350 result = prime * result + ((mlAppAdminId == null) ? 0 : mlAppAdminId.hashCode());
351 result = prime * result + ((mlAppName == null) ? 0 : mlAppName.hashCode());
352 result = prime * result + ((motsId == null) ? 0 : motsId.hashCode());
353 result = prime * result + ((name == null) ? 0 : name.hashCode());
354 result = prime * result + ((nameSpace == null) ? 0 : nameSpace.hashCode());
355 result = prime * result + ((notes == null) ? 0 : notes.hashCode());
356 result = prime * result + ((open == null) ? 0 : open.hashCode());
357 result = prime * result + Arrays.hashCode(thumbnail);
358 result = prime * result + ((uebKey == null) ? 0 : uebKey.hashCode());
359 result = prime * result + ((uebSecret == null) ? 0 : uebSecret.hashCode());
360 result = prime * result + ((uebTopicName == null) ? 0 : uebTopicName.hashCode());
361 result = prime * result + ((url == null) ? 0 : url.hashCode());
362 result = prime * result + ((username == null) ? 0 : username.hashCode());
367 public boolean equals(Object obj) {
372 if (getClass() != obj.getClass())
374 EPApp other = (EPApp) obj;
375 if (alternateUrl == null) {
376 if (other.alternateUrl != null)
378 } else if (!alternateUrl.equals(other.alternateUrl))
380 if (appPassword == null) {
381 if (other.appPassword != null)
383 } else if (!appPassword.equals(other.appPassword))
385 if (appRestEndpoint == null) {
386 if (other.appRestEndpoint != null)
388 } else if (!appRestEndpoint.equals(other.appRestEndpoint))
390 if (appType == null) {
391 if (other.appType != null)
393 } else if (!appType.equals(other.appType))
395 if (centralAuth == null) {
396 if (other.centralAuth != null)
398 } else if (!centralAuth.equals(other.centralAuth))
400 if (contactUs == null) {
401 if (other.contactUs != null)
403 } else if (!contactUs.equals(other.contactUs))
405 if (description == null) {
406 if (other.description != null)
408 } else if (!description.equals(other.description))
410 if (enabled == null) {
411 if (other.enabled != null)
413 } else if (!enabled.equals(other.enabled))
415 if (imageUrl == null) {
416 if (other.imageUrl != null)
418 } else if (!imageUrl.equals(other.imageUrl))
420 if (mlAppAdminId == null) {
421 if (other.mlAppAdminId != null)
423 } else if (!mlAppAdminId.equals(other.mlAppAdminId))
425 if (mlAppName == null) {
426 if (other.mlAppName != null)
428 } else if (!mlAppName.equals(other.mlAppName))
430 if (motsId == null) {
431 if (other.motsId != null)
433 } else if (!motsId.equals(other.motsId))
436 if (other.name != null)
438 } else if (!name.equals(other.name))
440 if (nameSpace == null) {
441 if (other.nameSpace != null)
443 } else if (!nameSpace.equals(other.nameSpace))
446 if (other.notes != null)
448 } else if (!notes.equals(other.notes))
451 if (other.open != null)
453 } else if (!open.equals(other.open))
455 if (!Arrays.equals(thumbnail, other.thumbnail))
457 if (uebKey == null) {
458 if (other.uebKey != null)
460 } else if (!uebKey.equals(other.uebKey))
462 if (uebSecret == null) {
463 if (other.uebSecret != null)
465 } else if (!uebSecret.equals(other.uebSecret))
467 if (uebTopicName == null) {
468 if (other.uebTopicName != null)
470 } else if (!uebTopicName.equals(other.uebTopicName))
473 if (other.url != null)
475 } else if (!url.equals(other.url))
477 if (username == null) {
478 if (other.username != null)
480 } else if (!username.equals(other.username))