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;
60 private String imageUrl;
63 private String appDescription;
66 private String appNotes;
69 private String landingPage;
72 private String alternateLandingPage;
75 private String appRestEndpoint;
78 private String mlAppName;
81 private String mlAppAdminId;
85 private String appBasicAuthUsername;
88 private String appBasicAuthPassword;
91 private byte[] thumbnail;
95 private Boolean enabled;
98 private String uebTopicName;
101 private String uebKey;
104 private String uebSecret;
106 private Integer appType;
109 private AppContactUs contactUs;
111 private Boolean rolesInAAF;
113 private String nameSpace;
116 private String modeOfIntegration;
118 private Boolean appAck;
120 private Boolean usesCadi;
124 // We set here all default values. We also place protection
125 // into setters for fields with default values.
126 // If we don't use such protection we are able to place null
127 // to these fields and save such fields into DB even if DB has
128 // default values for these fields.
131 this.mlAppAdminId = "";
132 this.appBasicAuthUsername = "";
133 this.appBasicAuthPassword = "";
134 this.open = new Boolean(false);
135 this.enabled = new Boolean(true);
136 this.uebTopicName = "";
142 public String getName() {
146 public void setName(String name) {
147 if (StringUtils.isEmpty(name)) {
153 public String getImageUrl() {
157 public void setImageUrl(String imageUrl) {
158 this.imageUrl = imageUrl;
161 public byte[] getThumbnail() {
162 return this.thumbnail;
165 public void setThumbnail(byte[] thumbnail) {
166 this.thumbnail = thumbnail;
169 public String getAppDescription() {
170 return appDescription;
173 public void setAppDescription(String appDescription) {
174 this.appDescription = appDescription;
177 public String getAppNotes() {
181 public void setAppNotes(String appNotes) {
182 this.appNotes = appNotes;
185 public String getLandingPage() {
189 public void setLandingPage(String landingPage) {
190 this.landingPage = landingPage;
193 public String getAlternateLandingPage() {
194 return alternateLandingPage;
197 public void setAlternateLandingPage(String alternateLandingPage) {
198 this.alternateLandingPage = alternateLandingPage;
201 public String getAppRestEndpoint() {
202 return appRestEndpoint;
205 public void setAppRestEndpoint(String appRestEndpoint) {
206 this.appRestEndpoint = appRestEndpoint;
209 public String getMlAppName() {
213 public void setMlAppName(String mlAppName) {
214 if (StringUtils.isEmpty(mlAppName)) {
217 this.mlAppName = mlAppName;
220 public String getMlAppAdminId() {
224 public void setMlAppAdminId(String mlAppAdminId) {
225 if (StringUtils.isEmpty(mlAppAdminId)) {
228 this.mlAppAdminId = mlAppAdminId;
231 public Long getMotsId() {
235 public void setMotsId(Long motsId) {
236 this.motsId = motsId;
239 public String getAppBasicAuthUsername() {
240 return appBasicAuthUsername;
243 public void setAppBasicAuthUsername(String appBasicAuthUsername) {
244 this.appBasicAuthUsername = appBasicAuthUsername;
247 public String getAppBasicAuthPassword() {
248 return appBasicAuthPassword;
251 public void setAppBasicAuthPassword(String appBasicAuthPassword) {
252 if (StringUtils.isEmpty(appBasicAuthPassword)) {
253 appBasicAuthPassword = "";
255 this.appBasicAuthPassword = appBasicAuthPassword;
258 public Boolean getOpen() {
262 public void setOpen(Boolean open) {
264 open = new Boolean(false);
269 public Boolean getEnabled() {
273 public void setEnabled(Boolean enabled) {
274 if (enabled == null) {
275 enabled = new Boolean(true);
277 this.enabled = enabled;
280 public Boolean isRestrictedApp() {
281 return (this.appType == 2 ? true : false);
284 public int compareTo(Object obj) {
286 Long c2 = ((EPApp) obj).getId();
288 return c1.compareTo(c2);
291 public String getUebTopicName() {
292 return this.uebTopicName;
295 public void setUebTopicName(String topicName) {
296 if (StringUtils.isEmpty(topicName)) {
297 this.uebTopicName = "";
299 this.uebTopicName = topicName;
302 public String getUebKey() {
306 public void setUebKey(String uebKey) {
307 if (StringUtils.isEmpty(uebKey)) {
310 this.uebKey = uebKey;
313 public String getUebSecret() {
314 return this.uebSecret;
317 public Integer getAppType() {
321 public void setAppType(Integer appType) {
322 this.appType = appType;
325 public void setUebSecret(String uebSecret) {
326 if (StringUtils.isEmpty(uebSecret)) {
329 this.uebSecret = uebSecret;
332 public AppContactUs getContactUs() {
336 public void setContactUs(AppContactUs contactUs) {
337 this.contactUs = contactUs;
340 public Boolean getRolesInAAF() {
344 public void setRolesInAAF(Boolean rolesInAAF) {
345 if (rolesInAAF == null) {
346 rolesInAAF = new Boolean(false);
348 this.rolesInAAF = rolesInAAF;
351 public String getNameSpace() {
355 public void setNameSpace(String nameSpace) {
356 if (StringUtils.isEmpty(nameSpace)) {
359 this.nameSpace = nameSpace;
362 public String getModeOfIntegration() {
363 return modeOfIntegration;
366 public void setModeOfIntegration(String modeOfIntegration) {
367 this.modeOfIntegration = modeOfIntegration;
370 public Boolean getAppAck() {
374 public void setAppAck(Boolean appAck) {
375 this.appAck = appAck;
378 public Boolean getUsesCadi() {
382 public void setUsesCadi(Boolean usesCadi) {
383 this.usesCadi = usesCadi;
387 public String toString() {
388 return "EPApp [name=" + name + ", imageUrl=" + imageUrl + ", appDescription=" + appDescription + ", appNotes="
389 + appNotes + ", landingPage=" + landingPage + ", alternateLandingPage=" + alternateLandingPage
390 + ", appRestEndpoint=" + appRestEndpoint + ", mlAppName=" + mlAppName + ", mlAppAdminId=" + mlAppAdminId
391 + ", motsId=" + motsId + ", appBasicAuthUsername=" + appBasicAuthUsername + ", appBasicAuthPassword="
392 + appBasicAuthPassword + ", thumbnail=" + Arrays.toString(thumbnail) + ", open=" + open + ", enabled="
393 + enabled + ", uebTopicName=" + uebTopicName + ", uebKey=" + uebKey + ", uebSecret=" + uebSecret
394 + ", appType=" + appType + ", contactUs=" + contactUs + ", rolesInAAF=" + rolesInAAF + ", nameSpace="
395 + nameSpace + ", modeOfIntegration=" + modeOfIntegration + ", appAck=" + appAck + ", usesCadi="
400 public int hashCode() {
401 final int prime = 31;
403 result = prime * result + ((alternateLandingPage == null) ? 0 : alternateLandingPage.hashCode());
404 result = prime * result + ((appAck == null) ? 0 : appAck.hashCode());
405 result = prime * result + ((appBasicAuthPassword == null) ? 0 : appBasicAuthPassword.hashCode());
406 result = prime * result + ((appBasicAuthUsername == null) ? 0 : appBasicAuthUsername.hashCode());
407 result = prime * result + ((appDescription == null) ? 0 : appDescription.hashCode());
408 result = prime * result + ((appNotes == null) ? 0 : appNotes.hashCode());
409 result = prime * result + ((appRestEndpoint == null) ? 0 : appRestEndpoint.hashCode());
410 result = prime * result + ((appType == null) ? 0 : appType.hashCode());
411 result = prime * result + ((enabled == null) ? 0 : enabled.hashCode());
412 result = prime * result + ((imageUrl == null) ? 0 : imageUrl.hashCode());
413 result = prime * result + ((landingPage == null) ? 0 : landingPage.hashCode());
414 result = prime * result + ((mlAppAdminId == null) ? 0 : mlAppAdminId.hashCode());
415 result = prime * result + ((mlAppName == null) ? 0 : mlAppName.hashCode());
416 result = prime * result + ((modeOfIntegration == null) ? 0 : modeOfIntegration.hashCode());
417 result = prime * result + ((motsId == null) ? 0 : motsId.hashCode());
418 result = prime * result + ((name == null) ? 0 : name.hashCode());
419 result = prime * result + ((nameSpace == null) ? 0 : nameSpace.hashCode());
420 result = prime * result + ((open == null) ? 0 : open.hashCode());
421 result = prime * result + ((rolesInAAF == null) ? 0 : rolesInAAF.hashCode());
422 result = prime * result + Arrays.hashCode(thumbnail);
423 result = prime * result + ((uebKey == null) ? 0 : uebKey.hashCode());
424 result = prime * result + ((uebSecret == null) ? 0 : uebSecret.hashCode());
425 result = prime * result + ((uebTopicName == null) ? 0 : uebTopicName.hashCode());
426 result = prime * result + ((usesCadi == null) ? 0 : usesCadi.hashCode());
431 public boolean equals(Object obj) {
434 if (!super.equals(obj))
436 if (!(obj instanceof EPApp))
438 EPApp other = (EPApp) obj;
439 if (alternateLandingPage == null) {
440 if (other.alternateLandingPage != null)
442 } else if (!alternateLandingPage.equals(other.alternateLandingPage))
444 if (appAck == null) {
445 if (other.appAck != null)
447 } else if (!appAck.equals(other.appAck))
449 if (appBasicAuthPassword == null) {
450 if (other.appBasicAuthPassword != null)
452 } else if (!appBasicAuthPassword.equals(other.appBasicAuthPassword))
454 if (appBasicAuthUsername == null) {
455 if (other.appBasicAuthUsername != null)
457 } else if (!appBasicAuthUsername.equals(other.appBasicAuthUsername))
459 if (appDescription == null) {
460 if (other.appDescription != null)
462 } else if (!appDescription.equals(other.appDescription))
464 if (appNotes == null) {
465 if (other.appNotes != null)
467 } else if (!appNotes.equals(other.appNotes))
469 if (appRestEndpoint == null) {
470 if (other.appRestEndpoint != null)
472 } else if (!appRestEndpoint.equals(other.appRestEndpoint))
474 if (appType == null) {
475 if (other.appType != null)
477 } else if (!appType.equals(other.appType))
479 if (enabled == null) {
480 if (other.enabled != null)
482 } else if (!enabled.equals(other.enabled))
484 if (imageUrl == null) {
485 if (other.imageUrl != null)
487 } else if (!imageUrl.equals(other.imageUrl))
489 if (landingPage == null) {
490 if (other.landingPage != null)
492 } else if (!landingPage.equals(other.landingPage))
494 if (mlAppAdminId == null) {
495 if (other.mlAppAdminId != null)
497 } else if (!mlAppAdminId.equals(other.mlAppAdminId))
499 if (mlAppName == null) {
500 if (other.mlAppName != null)
502 } else if (!mlAppName.equals(other.mlAppName))
504 if (modeOfIntegration == null) {
505 if (other.modeOfIntegration != null)
507 } else if (!modeOfIntegration.equals(other.modeOfIntegration))
509 if (motsId == null) {
510 if (other.motsId != null)
512 } else if (!motsId.equals(other.motsId))
515 if (other.name != null)
517 } else if (!name.equals(other.name))
519 if (nameSpace == null) {
520 if (other.nameSpace != null)
522 } else if (!nameSpace.equals(other.nameSpace))
525 if (other.open != null)
527 } else if (!open.equals(other.open))
529 if (rolesInAAF == null) {
530 if (other.rolesInAAF != null)
532 } else if (!rolesInAAF.equals(other.rolesInAAF))
534 if (!Arrays.equals(thumbnail, other.thumbnail))
536 if (uebKey == null) {
537 if (other.uebKey != null)
539 } else if (!uebKey.equals(other.uebKey))
541 if (uebSecret == null) {
542 if (other.uebSecret != null)
544 } else if (!uebSecret.equals(other.uebSecret))
546 if (uebTopicName == null) {
547 if (other.uebTopicName != null)
549 } else if (!uebTopicName.equals(other.uebTopicName))
551 if (usesCadi == null) {
552 if (other.usesCadi != null)
554 } else if (!usesCadi.equals(other.usesCadi))