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;
49 import com.fasterxml.jackson.annotation.JsonProperty;
50 import com.fasterxml.jackson.annotation.JsonProperty.Access;
53 * Model for all columns in the fn_app table.
55 public class EPApp extends DomainVo {
57 private static final long serialVersionUID = 1L;
63 private String imageUrl;
66 private String appDescription;
69 private String appNotes;
72 private String landingPage;
75 private String alternateLandingPage;
78 private String appRestEndpoint;
81 private String mlAppName;
84 private String mlAppAdminId;
88 private String appBasicAuthUsername;
91 @JsonProperty(access = Access.WRITE_ONLY)
92 private String appBasicAuthPassword;
95 private byte[] thumbnail;
99 private Boolean enabled;
102 private String uebTopicName;
105 private String uebKey;
108 private String uebSecret;
110 private Integer appType;
113 private AppContactUs contactUs;
115 private Boolean rolesInAAF;
117 private String nameSpace;
120 private String modeOfIntegration;
122 private Boolean appAck;
124 private Boolean usesCadi;
128 // We set here all default values. We also place protection
129 // into setters for fields with default values.
130 // If we don't use such protection we are able to place null
131 // to these fields and save such fields into DB even if DB has
132 // default values for these fields.
135 this.mlAppAdminId = "";
136 this.appBasicAuthUsername = "";
137 this.appBasicAuthPassword = "";
138 this.open = new Boolean(false);
139 this.enabled = new Boolean(true);
140 this.uebTopicName = "";
146 public String getName() {
150 public void setName(String name) {
151 if (StringUtils.isEmpty(name)) {
157 public String getImageUrl() {
161 public void setImageUrl(String imageUrl) {
162 this.imageUrl = imageUrl;
165 public byte[] getThumbnail() {
166 return this.thumbnail;
169 public void setThumbnail(byte[] thumbnail) {
170 this.thumbnail = thumbnail;
173 public String getAppDescription() {
174 return appDescription;
177 public void setAppDescription(String appDescription) {
178 this.appDescription = appDescription;
181 public String getAppNotes() {
185 public void setAppNotes(String appNotes) {
186 this.appNotes = appNotes;
189 public String getLandingPage() {
193 public void setLandingPage(String landingPage) {
194 this.landingPage = landingPage;
197 public String getAlternateLandingPage() {
198 return alternateLandingPage;
201 public void setAlternateLandingPage(String alternateLandingPage) {
202 this.alternateLandingPage = alternateLandingPage;
205 public String getAppRestEndpoint() {
206 return appRestEndpoint;
209 public void setAppRestEndpoint(String appRestEndpoint) {
210 this.appRestEndpoint = appRestEndpoint;
213 public String getMlAppName() {
217 public void setMlAppName(String mlAppName) {
218 if (StringUtils.isEmpty(mlAppName)) {
221 this.mlAppName = mlAppName;
224 public String getMlAppAdminId() {
228 public void setMlAppAdminId(String mlAppAdminId) {
229 if (StringUtils.isEmpty(mlAppAdminId)) {
232 this.mlAppAdminId = mlAppAdminId;
235 public Long getMotsId() {
239 public void setMotsId(Long motsId) {
240 this.motsId = motsId;
243 public String getAppBasicAuthUsername() {
244 return appBasicAuthUsername;
247 public void setAppBasicAuthUsername(String appBasicAuthUsername) {
248 this.appBasicAuthUsername = appBasicAuthUsername;
251 public String getAppBasicAuthPassword() {
252 return appBasicAuthPassword;
255 public void setAppBasicAuthPassword(String appBasicAuthPassword) {
256 if (StringUtils.isEmpty(appBasicAuthPassword)) {
257 appBasicAuthPassword = "";
259 this.appBasicAuthPassword = appBasicAuthPassword;
262 public Boolean getOpen() {
266 public void setOpen(Boolean open) {
268 open = new Boolean(false);
273 public Boolean getEnabled() {
277 public void setEnabled(Boolean enabled) {
278 if (enabled == null) {
279 enabled = new Boolean(true);
281 this.enabled = enabled;
284 public Boolean isRestrictedApp() {
285 return (this.appType == 2 ? true : false);
288 public int compareTo(Object obj) {
290 Long c2 = ((EPApp) obj).getId();
292 return c1.compareTo(c2);
295 public String getUebTopicName() {
296 return this.uebTopicName;
299 public void setUebTopicName(String topicName) {
300 if (StringUtils.isEmpty(topicName)) {
301 this.uebTopicName = "";
303 this.uebTopicName = topicName;
306 public String getUebKey() {
310 public void setUebKey(String uebKey) {
311 if (StringUtils.isEmpty(uebKey)) {
314 this.uebKey = uebKey;
317 public String getUebSecret() {
318 return this.uebSecret;
321 public Integer getAppType() {
325 public void setAppType(Integer appType) {
326 this.appType = appType;
329 public void setUebSecret(String uebSecret) {
330 if (StringUtils.isEmpty(uebSecret)) {
333 this.uebSecret = uebSecret;
336 public AppContactUs getContactUs() {
340 public void setContactUs(AppContactUs contactUs) {
341 this.contactUs = contactUs;
344 public Boolean getRolesInAAF() {
348 public void setRolesInAAF(Boolean rolesInAAF) {
349 if (rolesInAAF == null) {
350 rolesInAAF = new Boolean(false);
352 this.rolesInAAF = rolesInAAF;
355 public String getNameSpace() {
359 public void setNameSpace(String nameSpace) {
360 if (StringUtils.isEmpty(nameSpace)) {
363 this.nameSpace = nameSpace;
366 public String getModeOfIntegration() {
367 return modeOfIntegration;
370 public void setModeOfIntegration(String modeOfIntegration) {
371 this.modeOfIntegration = modeOfIntegration;
374 public Boolean getAppAck() {
378 public void setAppAck(Boolean appAck) {
379 this.appAck = appAck;
382 public Boolean getUsesCadi() {
386 public void setUsesCadi(Boolean usesCadi) {
387 this.usesCadi = usesCadi;
391 public String toString() {
392 return "EPApp [name=" + name + ", imageUrl=" + imageUrl + ", appDescription=" + appDescription + ", appNotes="
393 + appNotes + ", landingPage=" + landingPage + ", alternateLandingPage=" + alternateLandingPage
394 + ", appRestEndpoint=" + appRestEndpoint + ", mlAppName=" + mlAppName + ", mlAppAdminId=" + mlAppAdminId
395 + ", motsId=" + motsId + ", appBasicAuthUsername=" + appBasicAuthUsername + ", appBasicAuthPassword="
396 + appBasicAuthPassword + ", thumbnail=" + Arrays.toString(thumbnail) + ", open=" + open + ", enabled="
397 + enabled + ", uebTopicName=" + uebTopicName + ", uebKey=" + uebKey + ", uebSecret=" + uebSecret
398 + ", appType=" + appType + ", contactUs=" + contactUs + ", rolesInAAF=" + rolesInAAF + ", nameSpace="
399 + nameSpace + ", modeOfIntegration=" + modeOfIntegration + ", appAck=" + appAck + ", usesCadi="
404 public int hashCode() {
405 final int prime = 31;
407 result = prime * result + ((alternateLandingPage == null) ? 0 : alternateLandingPage.hashCode());
408 result = prime * result + ((appAck == null) ? 0 : appAck.hashCode());
409 result = prime * result + ((appBasicAuthPassword == null) ? 0 : appBasicAuthPassword.hashCode());
410 result = prime * result + ((appBasicAuthUsername == null) ? 0 : appBasicAuthUsername.hashCode());
411 result = prime * result + ((appDescription == null) ? 0 : appDescription.hashCode());
412 result = prime * result + ((appNotes == null) ? 0 : appNotes.hashCode());
413 result = prime * result + ((appRestEndpoint == null) ? 0 : appRestEndpoint.hashCode());
414 result = prime * result + ((appType == null) ? 0 : appType.hashCode());
415 result = prime * result + ((enabled == null) ? 0 : enabled.hashCode());
416 result = prime * result + ((imageUrl == null) ? 0 : imageUrl.hashCode());
417 result = prime * result + ((landingPage == null) ? 0 : landingPage.hashCode());
418 result = prime * result + ((mlAppAdminId == null) ? 0 : mlAppAdminId.hashCode());
419 result = prime * result + ((mlAppName == null) ? 0 : mlAppName.hashCode());
420 result = prime * result + ((modeOfIntegration == null) ? 0 : modeOfIntegration.hashCode());
421 result = prime * result + ((motsId == null) ? 0 : motsId.hashCode());
422 result = prime * result + ((name == null) ? 0 : name.hashCode());
423 result = prime * result + ((nameSpace == null) ? 0 : nameSpace.hashCode());
424 result = prime * result + ((open == null) ? 0 : open.hashCode());
425 result = prime * result + ((rolesInAAF == null) ? 0 : rolesInAAF.hashCode());
426 result = prime * result + Arrays.hashCode(thumbnail);
427 result = prime * result + ((uebKey == null) ? 0 : uebKey.hashCode());
428 result = prime * result + ((uebSecret == null) ? 0 : uebSecret.hashCode());
429 result = prime * result + ((uebTopicName == null) ? 0 : uebTopicName.hashCode());
430 result = prime * result + ((usesCadi == null) ? 0 : usesCadi.hashCode());
435 public boolean equals(Object obj) {
438 if (!super.equals(obj))
440 if (!(obj instanceof EPApp))
442 EPApp other = (EPApp) obj;
443 if (alternateLandingPage == null) {
444 if (other.alternateLandingPage != null)
446 } else if (!alternateLandingPage.equals(other.alternateLandingPage))
448 if (appAck == null) {
449 if (other.appAck != null)
451 } else if (!appAck.equals(other.appAck))
453 if (appBasicAuthPassword == null) {
454 if (other.appBasicAuthPassword != null)
456 } else if (!appBasicAuthPassword.equals(other.appBasicAuthPassword))
458 if (appBasicAuthUsername == null) {
459 if (other.appBasicAuthUsername != null)
461 } else if (!appBasicAuthUsername.equals(other.appBasicAuthUsername))
463 if (appDescription == null) {
464 if (other.appDescription != null)
466 } else if (!appDescription.equals(other.appDescription))
468 if (appNotes == null) {
469 if (other.appNotes != null)
471 } else if (!appNotes.equals(other.appNotes))
473 if (appRestEndpoint == null) {
474 if (other.appRestEndpoint != null)
476 } else if (!appRestEndpoint.equals(other.appRestEndpoint))
478 if (appType == null) {
479 if (other.appType != null)
481 } else if (!appType.equals(other.appType))
483 if (enabled == null) {
484 if (other.enabled != null)
486 } else if (!enabled.equals(other.enabled))
488 if (imageUrl == null) {
489 if (other.imageUrl != null)
491 } else if (!imageUrl.equals(other.imageUrl))
493 if (landingPage == null) {
494 if (other.landingPage != null)
496 } else if (!landingPage.equals(other.landingPage))
498 if (mlAppAdminId == null) {
499 if (other.mlAppAdminId != null)
501 } else if (!mlAppAdminId.equals(other.mlAppAdminId))
503 if (mlAppName == null) {
504 if (other.mlAppName != null)
506 } else if (!mlAppName.equals(other.mlAppName))
508 if (modeOfIntegration == null) {
509 if (other.modeOfIntegration != null)
511 } else if (!modeOfIntegration.equals(other.modeOfIntegration))
513 if (motsId == null) {
514 if (other.motsId != null)
516 } else if (!motsId.equals(other.motsId))
519 if (other.name != null)
521 } else if (!name.equals(other.name))
523 if (nameSpace == null) {
524 if (other.nameSpace != null)
526 } else if (!nameSpace.equals(other.nameSpace))
529 if (other.open != null)
531 } else if (!open.equals(other.open))
533 if (rolesInAAF == null) {
534 if (other.rolesInAAF != null)
536 } else if (!rolesInAAF.equals(other.rolesInAAF))
538 if (!Arrays.equals(thumbnail, other.thumbnail))
540 if (uebKey == null) {
541 if (other.uebKey != null)
543 } else if (!uebKey.equals(other.uebKey))
545 if (uebSecret == null) {
546 if (other.uebSecret != null)
548 } else if (!uebSecret.equals(other.uebSecret))
550 if (uebTopicName == null) {
551 if (other.uebTopicName != null)
553 } else if (!uebTopicName.equals(other.uebTopicName))
555 if (usesCadi == null) {
556 if (other.usesCadi != null)
558 } else if (!usesCadi.equals(other.usesCadi))