2 * ================================================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ================================================================================
20 package org.openecomp.portalapp.portal.domain;
22 import java.util.Arrays;
24 import javax.persistence.Lob;
26 import org.apache.commons.lang.StringUtils;
27 import org.openecomp.portalsdk.core.domain.support.DomainVo;
30 * Model for all columns in the fn_app table.
32 public class EPApp extends DomainVo {
34 private static final long serialVersionUID = 1L;
37 private String imageUrl;
38 private String description;
41 private String alternateUrl;
42 private String appRestEndpoint;
43 private String mlAppName;
44 private String mlAppAdminId;
46 private String username;
47 private String appPassword;
49 private byte[] thumbnail;
51 private Boolean enabled;
52 private String uebTopicName;
53 private String uebKey;
54 private String uebSecret;
55 private Integer appType;
56 private AppContactUs contactUs;
57 private Boolean centralAuth;
58 private String nameSpace;
62 // We set here all default values. We also place protection
63 // into setters for fields with default values.
64 // If we don't use such protection we are able to place null
65 // to these fields and save such fields into DB even if DB has
66 // default values for these fields.
69 this.mlAppAdminId = "";
71 this.appPassword = "";
72 this.open = new Boolean(false);
73 this.enabled = new Boolean(true);
74 this.uebTopicName = "";
80 public String getName() {
84 public void setName(String name) {
85 if (StringUtils.isEmpty(name)) {
91 public String getImageUrl() {
95 public void setImageUrl(String imageUrl) {
96 this.imageUrl = imageUrl;
101 public byte[] getThumbnail() {
102 return this.thumbnail;
105 public void setThumbnail(byte[] thumbnail) {
106 this.thumbnail = thumbnail;
109 public String getDescription() {
113 public void setDescription(String description) {
114 this.description = description;
117 public String getNotes() {
121 public void setNotes(String notes) {
125 public String getUrl() {
129 public void setUrl(String url) {
133 public String getAlternateUrl() {
137 public void setAlternateUrl(String alternateUrl) {
138 this.alternateUrl = alternateUrl;
141 public String getAppRestEndpoint() {
142 return appRestEndpoint;
145 public void setAppRestEndpoint(String appRestEndpoint) {
146 this.appRestEndpoint = appRestEndpoint;
149 public String getMlAppName() {
153 public void setMlAppName(String mlAppName) {
154 if (StringUtils.isEmpty(mlAppName)) {
157 this.mlAppName = mlAppName;
160 public String getMlAppAdminId() {
164 public void setMlAppAdminId(String mlAppAdminId) {
165 if (StringUtils.isEmpty(mlAppAdminId)) {
168 this.mlAppAdminId = mlAppAdminId;
171 public Long getMotsId() {
175 public void setMotsId(Long motsId) {
176 this.motsId = motsId;
179 public String getUsername() {
183 public void setUsername(String username) {
184 this.username = username;
187 public String getAppPassword() {
191 public void setAppPassword(String appPassword) {
192 if (StringUtils.isEmpty(appPassword)) {
195 this.appPassword = appPassword;
198 public Boolean getOpen() {
202 public void setOpen(Boolean open) {
204 open = new Boolean(false);
209 public Boolean getEnabled() {
213 public void setEnabled(Boolean enabled) {
214 if (enabled == null) {
215 enabled = new Boolean(true);
217 this.enabled = enabled;
220 public Integer getAppType() {
224 public void setAppType(Integer appType) {
225 if (appType == null) {
226 appType = new Integer(1);
228 this.appType = appType;
231 public void setRestrictedApp(Boolean restrictedApp) {
236 this.appType = result;
239 public Boolean isRestrictedApp() {
240 return (this.appType == 2 ? true : false);
243 public int compareTo(Object obj) {
245 Long c2 = ((EPApp) obj).getId();
247 return c1.compareTo(c2);
250 public String getUebTopicName() {
251 return this.uebTopicName;
254 public void setUebTopicName(String topicName) {
255 if (StringUtils.isEmpty(topicName)) {
256 this.uebTopicName = "";
258 this.uebTopicName = topicName;
261 public String getUebKey() {
265 public void setUebKey(String uebKey) {
266 if (StringUtils.isEmpty(uebKey)) {
269 this.uebKey = uebKey;
272 public String getUebSecret() {
273 return this.uebSecret;
276 public void setUebSecret(String uebSecret) {
277 if (StringUtils.isEmpty(uebSecret)) {
280 this.uebSecret = uebSecret;
283 public AppContactUs getContactUs() {
287 public void setContactUs(AppContactUs contactUs) {
288 this.contactUs = contactUs;
291 public Boolean getCentralAuth() {
295 public void setCentralAuth(Boolean centralAuth) {
296 if (centralAuth == null) {
297 centralAuth = new Boolean(false);
299 this.centralAuth = centralAuth;
302 public String getNameSpace() {
306 public void setNameSpace(String nameSpace) {
307 if (StringUtils.isEmpty(nameSpace)) {
310 this.nameSpace = nameSpace;
314 public String toString() {
315 String str = "[" + getId() + ":" + getName() + "]";
320 public int hashCode() {
321 final int prime = 31;
323 result = prime * result + ((alternateUrl == null) ? 0 : alternateUrl.hashCode());
324 result = prime * result + ((appPassword == null) ? 0 : appPassword.hashCode());
325 result = prime * result + ((appRestEndpoint == null) ? 0 : appRestEndpoint.hashCode());
326 result = prime * result + ((appType == null) ? 0 : appType.hashCode());
327 result = prime * result + ((centralAuth == null) ? 0 : centralAuth.hashCode());
328 result = prime * result + ((contactUs == null) ? 0 : contactUs.hashCode());
329 result = prime * result + ((description == null) ? 0 : description.hashCode());
330 result = prime * result + ((enabled == null) ? 0 : enabled.hashCode());
331 result = prime * result + ((imageUrl == null) ? 0 : imageUrl.hashCode());
332 result = prime * result + ((mlAppAdminId == null) ? 0 : mlAppAdminId.hashCode());
333 result = prime * result + ((mlAppName == null) ? 0 : mlAppName.hashCode());
334 result = prime * result + ((motsId == null) ? 0 : motsId.hashCode());
335 result = prime * result + ((name == null) ? 0 : name.hashCode());
336 result = prime * result + ((nameSpace == null) ? 0 : nameSpace.hashCode());
337 result = prime * result + ((notes == null) ? 0 : notes.hashCode());
338 result = prime * result + ((open == null) ? 0 : open.hashCode());
339 result = prime * result + Arrays.hashCode(thumbnail);
340 result = prime * result + ((uebKey == null) ? 0 : uebKey.hashCode());
341 result = prime * result + ((uebSecret == null) ? 0 : uebSecret.hashCode());
342 result = prime * result + ((uebTopicName == null) ? 0 : uebTopicName.hashCode());
343 result = prime * result + ((url == null) ? 0 : url.hashCode());
344 result = prime * result + ((username == null) ? 0 : username.hashCode());
349 public boolean equals(Object obj) {
354 if (getClass() != obj.getClass())
356 EPApp other = (EPApp) obj;
357 if (alternateUrl == null) {
358 if (other.alternateUrl != null)
360 } else if (!alternateUrl.equals(other.alternateUrl))
362 if (appPassword == null) {
363 if (other.appPassword != null)
365 } else if (!appPassword.equals(other.appPassword))
367 if (appRestEndpoint == null) {
368 if (other.appRestEndpoint != null)
370 } else if (!appRestEndpoint.equals(other.appRestEndpoint))
372 if (appType == null) {
373 if (other.appType != null)
375 } else if (!appType.equals(other.appType))
377 if (centralAuth == null) {
378 if (other.centralAuth != null)
380 } else if (!centralAuth.equals(other.centralAuth))
382 if (contactUs == null) {
383 if (other.contactUs != null)
385 } else if (!contactUs.equals(other.contactUs))
387 if (description == null) {
388 if (other.description != null)
390 } else if (!description.equals(other.description))
392 if (enabled == null) {
393 if (other.enabled != null)
395 } else if (!enabled.equals(other.enabled))
397 if (imageUrl == null) {
398 if (other.imageUrl != null)
400 } else if (!imageUrl.equals(other.imageUrl))
402 if (mlAppAdminId == null) {
403 if (other.mlAppAdminId != null)
405 } else if (!mlAppAdminId.equals(other.mlAppAdminId))
407 if (mlAppName == null) {
408 if (other.mlAppName != null)
410 } else if (!mlAppName.equals(other.mlAppName))
412 if (motsId == null) {
413 if (other.motsId != null)
415 } else if (!motsId.equals(other.motsId))
418 if (other.name != null)
420 } else if (!name.equals(other.name))
422 if (nameSpace == null) {
423 if (other.nameSpace != null)
425 } else if (!nameSpace.equals(other.nameSpace))
428 if (other.notes != null)
430 } else if (!notes.equals(other.notes))
433 if (other.open != null)
435 } else if (!open.equals(other.open))
437 if (!Arrays.equals(thumbnail, other.thumbnail))
439 if (uebKey == null) {
440 if (other.uebKey != null)
442 } else if (!uebKey.equals(other.uebKey))
444 if (uebSecret == null) {
445 if (other.uebSecret != null)
447 } else if (!uebSecret.equals(other.uebSecret))
449 if (uebTopicName == null) {
450 if (other.uebTopicName != null)
452 } else if (!uebTopicName.equals(other.uebTopicName))
455 if (other.url != null)
457 } else if (!url.equals(other.url))
459 if (username == null) {
460 if (other.username != null)
462 } else if (!username.equals(other.username))