nexus site path corrected
[portal.git] / ecomp-portal-BE / src / main / java / org / openecomp / portalapp / portal / domain / EPApp.java
1 /*-
2  * ================================================================================
3  * eCOMP Portal
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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  * ================================================================================
19  */
20 package org.openecomp.portalapp.portal.domain;
21
22 import javax.persistence.Lob;
23
24 import org.apache.commons.lang.StringUtils;
25 import org.openecomp.portalsdk.core.domain.support.DomainVo;
26
27
28 public class EPApp extends DomainVo {
29
30         private static final long serialVersionUID = 1L;
31         
32         private String name;
33         private String imageUrl;
34         private String description;
35         private String notes;
36         private String url;
37         private String alternateUrl;
38         private String appRestEndpoint;
39         private String mlAppName;
40         private String mlAppAdminId;
41         private Long motsId;
42         private String username;
43         private String appPassword;
44         @Lob
45         private byte[] thumbnail;
46         private Boolean open;
47         private Boolean enabled;
48         private String uebTopicName;
49         private String uebKey;
50         private String uebSecret;
51         private Integer appType;
52         
53         private AppContactUs contactUs;
54         
55
56 /*
57         private SortedSet<Widget> widgets = new TreeSet<Widget>();
58 */
59
60         public EPApp() {
61                 // Attention!!!
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.
67                 this.name = "";
68                 this.mlAppName = "";
69                 this.mlAppAdminId = "";
70                 this.username = "";
71                 this.appPassword = "";
72                 this.open = new Boolean(false);
73                 this.enabled = new Boolean(true);
74                 this.uebTopicName = "";
75                 this.uebKey = "";
76                 this.uebSecret = "";
77                 this.appType = 1;
78         }
79
80         public String getName() {
81                 return name;
82         }
83
84         public void setName(String name) {
85                 if (StringUtils.isEmpty(name)) {
86                         name = "";
87                 }
88                 this.name = name;
89         }
90
91         public String getImageUrl() {
92                 return imageUrl;
93         }
94
95         public void setImageUrl(String imageUrl) {
96                 this.imageUrl = imageUrl;
97         }
98         
99         public byte[] getThumbnail() {
100                 return this.thumbnail;
101         }
102
103         public void setThumbnail(byte[] thumbnail) {
104                 this.thumbnail = thumbnail;
105         }
106
107         public String getDescription() {
108                 return description;
109         }
110
111         public void setDescription(String description) {
112                 this.description = description;
113         }
114
115         public String getNotes() {
116                 return notes;
117         }
118
119         public void setNotes(String notes) {
120                 this.notes = notes;
121         }
122
123         public String getUrl() {
124                 return url;
125         }
126
127         public void setUrl(String url) {
128                 this.url = url;
129         }
130
131         public String getAlternateUrl() {
132                 return alternateUrl;
133         }
134
135         public void setAlternateUrl(String alternateUrl) {
136                 this.alternateUrl = alternateUrl;
137         }
138
139         public String getAppRestEndpoint() {
140                 return appRestEndpoint;
141         }
142
143         public void setAppRestEndpoint(String appRestEndpoint) {
144                 this.appRestEndpoint = appRestEndpoint;
145         }
146
147         public String getMlAppName() {
148                 return mlAppName;
149         }
150
151         public void setMlAppName(String mlAppName) {
152                 if (StringUtils.isEmpty(mlAppName)) {
153                         mlAppName = "";
154                 }
155                 this.mlAppName = mlAppName;
156         }
157
158         public String getMlAppAdminId() {
159                 return mlAppAdminId;
160         }
161
162         public void setMlAppAdminId(String mlAppAdminId) {
163                 if (StringUtils.isEmpty(mlAppAdminId)) {
164                         mlAppAdminId = "";
165                 }
166                 this.mlAppAdminId = mlAppAdminId;
167         }
168
169         public Long getMotsId() {
170                 return motsId;
171         }
172
173         public void setMotsId(Long motsId) {
174                 this.motsId = motsId;
175         }
176
177         public String getUsername() {
178                 return username;
179         }
180
181         public void setUsername(String username) {
182                 this.username = username;
183         }
184         
185         public String getAppPassword() {
186                 return appPassword;
187         }
188
189         public void setAppPassword(String appPassword) {
190                 if (StringUtils.isEmpty(appPassword)) {
191                         appPassword = "";
192                 }
193                 this.appPassword = appPassword;
194         }
195
196         public Boolean getOpen() {
197                 return open;
198         }
199
200         public void setOpen(Boolean open) {
201                 if (open == null) {
202                         open = new Boolean(false);
203                 }
204                 this.open = open;
205         }
206
207         public Boolean getEnabled() {
208                 return enabled;
209         }
210
211         public void setEnabled(Boolean enabled) {
212                 if (enabled == null) {
213                         enabled = new Boolean(true);
214                 }
215                 this.enabled = enabled;
216         }
217         
218         public Integer getAppType() {
219                 return appType;
220         }
221         
222         public void setAppType(Integer appType) {
223                 if (appType == null) {
224                         appType = new Integer(1);
225                 }
226                 this.appType = appType;
227         }
228         
229         public void setRestrictedApp(Boolean restrictedApp) {
230                 Integer result = 1;
231                 if (restrictedApp) {
232                         result = 2;
233                 }
234                 this.appType = result;
235         }
236         
237         public Boolean isRestrictedApp() {
238                 return (this.appType == 2 ? true : false);
239         }
240
241         /*
242         public SortedSet<Widget> getWidgets() {
243                 return widgets;
244         }
245
246     public void setWidgets(SortedSet<Widget> widgets) {
247         this.widgets = widgets;
248     }
249
250         public void addWidget(Widget widget) {
251                 this.widgets.add(widget);
252         }
253         
254     public void removeWidget(Long widgetId) {
255         for (Widget widget: widgets) {
256                 if (widget.getId().equals(widgetId)) {
257                         widgets.remove(widget);
258                         break;
259                 }
260         }
261     }
262     */
263
264         public int compareTo(Object obj) {
265                 Long c1 = getId();
266                 Long c2 = ((EPApp) obj).getId();
267
268                 return c1.compareTo(c2);
269         }
270         
271         public String getUebTopicName() {
272                 return this.uebTopicName;
273         }
274
275         public void setUebTopicName(String topicName) {
276                 if (StringUtils.isEmpty(topicName)) {
277                         this.uebTopicName = "";
278                 }
279                 this.uebTopicName = topicName;
280         }
281         
282         public String getUebKey() {
283                 return this.uebKey;
284         }
285         
286         public void setUebKey(String uebKey) {
287                 if (StringUtils.isEmpty(uebKey)) {
288                         this.uebKey = "";
289                 }
290                 this.uebKey = uebKey;
291         }
292         
293         public String getUebSecret() {
294                 return this.uebSecret;
295         }
296
297         public void setUebSecret(String uebSecret) {
298                 if (StringUtils.isEmpty(uebSecret)) {
299                         this.uebSecret = "";
300                 }
301                 this.uebSecret = uebSecret;
302         }
303         
304         public AppContactUs getContactUs() {
305                 return contactUs;
306         }
307
308         public void setContactUs(AppContactUs contactUs) {
309                 this.contactUs = contactUs;
310         }
311
312         @Override 
313         public String toString() {
314                 String str = "["+getId()+":"+getName()+"]";
315                 return str;
316         }
317         
318
319 }