Fixed App Onboarding - List page error
[portal.git] / ecomp-portal-BE-os / src / main / java / org / onap / portalapp / portal / transport / OnboardingApp.java
1 /*-
2  * ============LICENSE_START==========================================
3  * ONAP Portal
4  * ===================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ===================================================================
7  *
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
12  *
13  *             http://www.apache.org/licenses/LICENSE-2.0
14  *
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.
20  *
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
25  *
26  *             https://creativecommons.org/licenses/by/4.0/
27  *
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.
33  *
34  * ============LICENSE_END============================================
35  *
36  * 
37  */
38 package org.onap.portalapp.portal.transport;
39
40 import org.hibernate.validator.constraints.SafeHtml;
41 import org.onap.portalapp.portal.domain.EpAppType;
42
43 /**
44  * Model of rows in the fn_app table; serialized as a message add or update an
45  * on-boarded application.
46  */
47 public class OnboardingApp {
48
49         private Long id;
50         @SafeHtml
51         private String appName;
52         @SafeHtml
53         private String imageUrl;
54         @SafeHtml
55         private String imageLink;
56         @SafeHtml
57         private String appDescription;
58         @SafeHtml
59         private String appNotes;
60         @SafeHtml
61         private String landingPage;
62         @SafeHtml
63         private String alternateLandingPage;
64         @SafeHtml
65         private String restUrl;
66
67         @SafeHtml
68         private String applicationType;
69         
70         private Boolean isOpen;
71
72         private Boolean isEnabled;
73
74         private Long motsId;
75         @SafeHtml
76         private String myLoginsAppName;
77         @SafeHtml
78         private String myLoginsAppOwner;
79         @SafeHtml
80         private String appBasicAuthUsername;
81         @SafeHtml
82         private String appBasicAuthPassword;
83         @SafeHtml
84         private String thumbnail;
85         @SafeHtml
86         private String uebTopicName;
87         @SafeHtml
88         private String uebKey;
89         @SafeHtml
90         private String uebSecret;
91
92         private Boolean restrictedApp;
93         
94         private Boolean rolesInAAF;
95         @SafeHtml
96         private String nameSpace;
97
98         @SafeHtml
99         private String modeOfIntegration;
100
101         private Boolean appAck;
102
103         private Boolean usesCadi;
104         
105         /**
106          * Sets the name, myLoginsAppName, myLoginsAppOwner, username and
107          * appPassword fields to the empty string OR trims leading/trailing space,
108          * as appropriate.
109          */
110         public void normalize() {
111                 this.appName = (this.appName == null) ? "" : this.appName.trim();
112                 this.myLoginsAppName = (this.myLoginsAppName == null) ? "" : this.myLoginsAppName.trim();
113                 this.myLoginsAppOwner = (this.myLoginsAppOwner == null) ? "" : this.myLoginsAppOwner.trim();
114                 this.appBasicAuthUsername = (this.appBasicAuthUsername == null) ? "" : this.appBasicAuthUsername.trim();
115                 this.appBasicAuthPassword = (this.appBasicAuthPassword == null) ? "" : this.appBasicAuthPassword.trim();
116         }
117
118         public Long getId() {
119                 return id;
120         }
121
122         public void setId(Long id) {
123                 this.id = id;
124         }
125
126         public String getAppName() {
127                 return appName;
128         }
129
130         public void setAppName(String appName) {
131                 this.appName = appName;
132         }
133
134         public String getImageUrl() {
135                 return imageUrl;
136         }
137
138         public void setImageUrl(String imageUrl) {
139                 this.imageUrl = imageUrl;
140         }
141
142         public String getImageLink() {
143                 return imageLink;
144         }
145
146         public void setImageLink(String imageLink) {
147                 this.imageLink = imageLink;
148         }
149
150         public String getAppDescription() {
151                 return appDescription;
152         }
153
154         public void setAppDescription(String appDescription) {
155                 this.appDescription = appDescription;
156         }
157
158         public String getAppNotes() {
159                 return appNotes;
160         }
161
162         public void setAppNotes(String appNotes) {
163                 this.appNotes = appNotes;
164         }
165
166         public String getLandingPage() {
167                 return landingPage;
168         }
169
170         public void setLandingPage(String landingPage) {
171                 this.landingPage = landingPage;
172         }
173
174         public String getAlternateLandingPage() {
175                 return alternateLandingPage;
176         }
177
178         public void setAlternateLandingPage(String alternateLandingPage) {
179                 this.alternateLandingPage = alternateLandingPage;
180         }
181
182         public String getRestUrl() {
183                 return restUrl;
184         }
185
186         public void setRestUrl(String restUrl) {
187                 this.restUrl = restUrl;
188         }
189
190         public Boolean getIsOpen() {
191                 return isOpen;
192         }
193
194         public void setIsOpen(Boolean isOpen) {
195                 this.isOpen = isOpen;
196         }
197
198         public Boolean getIsEnabled() {
199                 return isEnabled;
200         }
201
202         public void setIsEnabled(Boolean isEnabled) {
203                 this.isEnabled = isEnabled;
204         }
205
206         public Long getMotsId() {
207                 return motsId;
208         }
209
210         public void setMotsId(Long motsId) {
211                 this.motsId = motsId;
212         }
213
214         public String getMyLoginsAppName() {
215                 return myLoginsAppName;
216         }
217
218         public void setMyLoginsAppName(String myLoginsAppName) {
219                 this.myLoginsAppName = myLoginsAppName;
220         }
221
222         public String getMyLoginsAppOwner() {
223                 return myLoginsAppOwner;
224         }
225
226         public void setMyLoginsAppOwner(String myLoginsAppOwner) {
227                 this.myLoginsAppOwner = myLoginsAppOwner;
228         }
229
230         public String getAppBasicAuthUsername() {
231                 return appBasicAuthUsername;
232         }
233
234         public void setAppBasicAuthUsername(String appBasicAuthUsername) {
235                 this.appBasicAuthUsername = appBasicAuthUsername;
236         }
237
238         public String getAppBasicAuthPassword() {
239                 return appBasicAuthPassword;
240         }
241
242         public void setAppBasicAuthPassword(String appBasicAuthPassword) {
243                 this.appBasicAuthPassword = appBasicAuthPassword;
244         }
245
246         public String getThumbnail() {
247                 return thumbnail;
248         }
249
250         public void setThumbnail(String thumbnail) {
251                 this.thumbnail = thumbnail;
252         }
253
254         public String getUebTopicName() {
255                 return uebTopicName;
256         }
257
258         public void setUebTopicName(String uebTopicName) {
259                 this.uebTopicName = uebTopicName;
260         }
261
262         public String getUebKey() {
263                 return uebKey;
264         }
265
266         public void setUebKey(String uebKey) {
267                 this.uebKey = uebKey;
268         }
269
270         public String getUebSecret() {
271                 return uebSecret;
272         }
273
274         public void setUebSecret(String uebSecret) {
275                 this.uebSecret = uebSecret;
276         }
277
278         public Boolean getRestrictedApp() {
279                 return restrictedApp;
280         }
281
282         public void setRestrictedApp(Boolean restrictedApp) {
283                 this.restrictedApp = restrictedApp;
284         }
285
286         public Boolean getRolesInAAF() {
287                 return rolesInAAF;
288         }
289
290         public void setRolesInAAF(Boolean rolesInAAF) {
291                 this.rolesInAAF = rolesInAAF;
292         }
293
294         public String getNameSpace() {
295                 return nameSpace;
296         }
297
298         public void setNameSpace(String nameSpace) {
299                 this.nameSpace = nameSpace;
300         }
301
302         public String getModeOfIntegration() {
303                 return modeOfIntegration;
304         }
305
306         public void setModeOfIntegration(String modeOfIntegration) {
307                 this.modeOfIntegration = modeOfIntegration;
308         }
309
310         public Boolean getAppAck() {
311                 return appAck;
312         }
313
314         public void setAppAck(Boolean appAck) {
315                 this.appAck = appAck;
316         }
317
318         public Boolean getUsesCadi() {
319                 return usesCadi;
320         }
321
322         public void setUsesCadi(Boolean usesCadi) {
323                 this.usesCadi = usesCadi;
324         }
325
326         public String getApplicationType() {
327                 return applicationType;
328         }
329
330         public void setApplicationType(String applicationType) {
331                 this.applicationType = applicationType;
332         }
333         
334         public Integer appTypePersistedValue() {
335                 switch (this.getApplicationType()) {
336                 case EpAppType.GUI_STR:
337                         return EpAppType.GUI;
338                 case EpAppType.HYPERLINK_STR:
339                         return EpAppType.HYPERLINK;
340                 case EpAppType.NONGUI_STR:
341                         return EpAppType.NONGUI;
342                 default:
343                         return 0;
344                 }
345         }
346 }