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