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 javax.persistence.Lob;
24 import org.apache.commons.lang.StringUtils;
25 import org.openecomp.portalsdk.core.domain.support.DomainVo;
28 public class EPApp extends DomainVo {
30 private static final long serialVersionUID = 1L;
33 private String imageUrl;
34 private String description;
37 private String alternateUrl;
38 private String appRestEndpoint;
39 private String mlAppName;
40 private String mlAppAdminId;
42 private String username;
43 private String appPassword;
45 private byte[] thumbnail;
47 private Boolean enabled;
48 private String uebTopicName;
49 private String uebKey;
50 private String uebSecret;
51 private Integer appType;
53 private AppContactUs contactUs;
57 private SortedSet<Widget> widgets = new TreeSet<Widget>();
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;
99 public byte[] getThumbnail() {
100 return this.thumbnail;
103 public void setThumbnail(byte[] thumbnail) {
104 this.thumbnail = thumbnail;
107 public String getDescription() {
111 public void setDescription(String description) {
112 this.description = description;
115 public String getNotes() {
119 public void setNotes(String notes) {
123 public String getUrl() {
127 public void setUrl(String url) {
131 public String getAlternateUrl() {
135 public void setAlternateUrl(String alternateUrl) {
136 this.alternateUrl = alternateUrl;
139 public String getAppRestEndpoint() {
140 return appRestEndpoint;
143 public void setAppRestEndpoint(String appRestEndpoint) {
144 this.appRestEndpoint = appRestEndpoint;
147 public String getMlAppName() {
151 public void setMlAppName(String mlAppName) {
152 if (StringUtils.isEmpty(mlAppName)) {
155 this.mlAppName = mlAppName;
158 public String getMlAppAdminId() {
162 public void setMlAppAdminId(String mlAppAdminId) {
163 if (StringUtils.isEmpty(mlAppAdminId)) {
166 this.mlAppAdminId = mlAppAdminId;
169 public Long getMotsId() {
173 public void setMotsId(Long motsId) {
174 this.motsId = motsId;
177 public String getUsername() {
181 public void setUsername(String username) {
182 this.username = username;
185 public String getAppPassword() {
189 public void setAppPassword(String appPassword) {
190 if (StringUtils.isEmpty(appPassword)) {
193 this.appPassword = appPassword;
196 public Boolean getOpen() {
200 public void setOpen(Boolean open) {
202 open = new Boolean(false);
207 public Boolean getEnabled() {
211 public void setEnabled(Boolean enabled) {
212 if (enabled == null) {
213 enabled = new Boolean(true);
215 this.enabled = enabled;
218 public Integer getAppType() {
222 public void setAppType(Integer appType) {
223 if (appType == null) {
224 appType = new Integer(1);
226 this.appType = appType;
229 public void setRestrictedApp(Boolean restrictedApp) {
234 this.appType = result;
237 public Boolean isRestrictedApp() {
238 return (this.appType == 2 ? true : false);
242 public SortedSet<Widget> getWidgets() {
246 public void setWidgets(SortedSet<Widget> widgets) {
247 this.widgets = widgets;
250 public void addWidget(Widget widget) {
251 this.widgets.add(widget);
254 public void removeWidget(Long widgetId) {
255 for (Widget widget: widgets) {
256 if (widget.getId().equals(widgetId)) {
257 widgets.remove(widget);
264 public int compareTo(Object obj) {
266 Long c2 = ((EPApp) obj).getId();
268 return c1.compareTo(c2);
271 public String getUebTopicName() {
272 return this.uebTopicName;
275 public void setUebTopicName(String topicName) {
276 if (StringUtils.isEmpty(topicName)) {
277 this.uebTopicName = "";
279 this.uebTopicName = topicName;
282 public String getUebKey() {
286 public void setUebKey(String uebKey) {
287 if (StringUtils.isEmpty(uebKey)) {
290 this.uebKey = uebKey;
293 public String getUebSecret() {
294 return this.uebSecret;
297 public void setUebSecret(String uebSecret) {
298 if (StringUtils.isEmpty(uebSecret)) {
301 this.uebSecret = uebSecret;
304 public AppContactUs getContactUs() {
308 public void setContactUs(AppContactUs contactUs) {
309 this.contactUs = contactUs;
313 public String toString() {
314 String str = "["+getId()+":"+getName()+"]";