Deliver centralized role management feature
[portal.git] / ecomp-portal-BE-common / 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  * Model for all columns in the fn_app table.
29  */
30 public class EPApp extends DomainVo {
31
32         private static final long serialVersionUID = 1L;
33
34         private String name;
35         private String imageUrl;
36         private String description;
37         private String notes;
38         private String url;
39         private String alternateUrl;
40         private String appRestEndpoint;
41         private String mlAppName;
42         private String mlAppAdminId;
43         private Long motsId;
44         private String username;
45         private String appPassword;
46         @Lob
47         private byte[] thumbnail;
48         private Boolean open;
49         private Boolean enabled;
50         private String uebTopicName;
51         private String uebKey;
52         private String uebSecret;
53         private Integer appType;
54         private AppContactUs contactUs;
55         private Boolean centralAuth;
56         private String  nameSpace;
57
58         public EPApp() {
59                 // Attention!!!
60                 // We set here all default values. We also place protection
61                 // into setters for fields with default values.
62                 // If we don't use such protection we are able to place null
63                 // to these fields and save such fields into DB even if DB has
64                 // default values for these fields.
65                 this.name = "";
66                 this.mlAppName = "";
67                 this.mlAppAdminId = "";
68                 this.username = "";
69                 this.appPassword = "";
70                 this.open = new Boolean(false);
71                 this.enabled = new Boolean(true);
72                 this.uebTopicName = "";
73                 this.uebKey = "";
74                 this.uebSecret = "";
75                 this.appType = 1;
76         }
77
78         public String getName() {
79                 return name;
80         }
81
82         public void setName(String name) {
83                 if (StringUtils.isEmpty(name)) {
84                         name = "";
85                 }
86                 this.name = name;
87         }
88
89         public String getImageUrl() {
90                 return imageUrl;
91         }
92
93         public void setImageUrl(String imageUrl) {
94                 this.imageUrl = imageUrl;
95         }
96
97         public byte[] getThumbnail() {
98                 return this.thumbnail;
99         }
100
101         public void setThumbnail(byte[] thumbnail) {
102                 this.thumbnail = thumbnail;
103         }
104
105         public String getDescription() {
106                 return description;
107         }
108
109         public void setDescription(String description) {
110                 this.description = description;
111         }
112
113         public String getNotes() {
114                 return notes;
115         }
116
117         public void setNotes(String notes) {
118                 this.notes = notes;
119         }
120
121         public String getUrl() {
122                 return url;
123         }
124
125         public void setUrl(String url) {
126                 this.url = url;
127         }
128
129         public String getAlternateUrl() {
130                 return alternateUrl;
131         }
132
133         public void setAlternateUrl(String alternateUrl) {
134                 this.alternateUrl = alternateUrl;
135         }
136
137         public String getAppRestEndpoint() {
138                 return appRestEndpoint;
139         }
140
141         public void setAppRestEndpoint(String appRestEndpoint) {
142                 this.appRestEndpoint = appRestEndpoint;
143         }
144
145         public String getMlAppName() {
146                 return mlAppName;
147         }
148
149         public void setMlAppName(String mlAppName) {
150                 if (StringUtils.isEmpty(mlAppName)) {
151                         mlAppName = "";
152                 }
153                 this.mlAppName = mlAppName;
154         }
155
156         public String getMlAppAdminId() {
157                 return mlAppAdminId;
158         }
159
160         public void setMlAppAdminId(String mlAppAdminId) {
161                 if (StringUtils.isEmpty(mlAppAdminId)) {
162                         mlAppAdminId = "";
163                 }
164                 this.mlAppAdminId = mlAppAdminId;
165         }
166
167         public Long getMotsId() {
168                 return motsId;
169         }
170
171         public void setMotsId(Long motsId) {
172                 this.motsId = motsId;
173         }
174
175         public String getUsername() {
176                 return username;
177         }
178
179         public void setUsername(String username) {
180                 this.username = username;
181         }
182
183         public String getAppPassword() {
184                 return appPassword;
185         }
186
187         public void setAppPassword(String appPassword) {
188                 if (StringUtils.isEmpty(appPassword)) {
189                         appPassword = "";
190                 }
191                 this.appPassword = appPassword;
192         }
193
194         public Boolean getOpen() {
195                 return open;
196         }
197
198         public void setOpen(Boolean open) {
199                 if (open == null) {
200                         open = new Boolean(false);
201                 }
202                 this.open = open;
203         }
204
205         public Boolean getEnabled() {
206                 return enabled;
207         }
208
209         public void setEnabled(Boolean enabled) {
210                 if (enabled == null) {
211                         enabled = new Boolean(true);
212                 }
213                 this.enabled = enabled;
214         }
215
216         public Integer getAppType() {
217                 return appType;
218         }
219
220         public void setAppType(Integer appType) {
221                 if (appType == null) {
222                         appType = new Integer(1);
223                 }
224                 this.appType = appType;
225         }
226
227         public void setRestrictedApp(Boolean restrictedApp) {
228                 Integer result = 1;
229                 if (restrictedApp) {
230                         result = 2;
231                 }
232                 this.appType = result;
233         }
234
235         public Boolean isRestrictedApp() {
236                 return (this.appType == 2 ? true : false);
237         }
238
239         public int compareTo(Object obj) {
240                 Long c1 = getId();
241                 Long c2 = ((EPApp) obj).getId();
242
243                 return c1.compareTo(c2);
244         }
245
246         public String getUebTopicName() {
247                 return this.uebTopicName;
248         }
249
250         public void setUebTopicName(String topicName) {
251                 if (StringUtils.isEmpty(topicName)) {
252                         this.uebTopicName = "";
253                 }
254                 this.uebTopicName = topicName;
255         }
256
257         public String getUebKey() {
258                 return this.uebKey;
259         }
260
261         public void setUebKey(String uebKey) {
262                 if (StringUtils.isEmpty(uebKey)) {
263                         this.uebKey = "";
264                 }
265                 this.uebKey = uebKey;
266         }
267
268         public String getUebSecret() {
269                 return this.uebSecret;
270         }
271
272         public void setUebSecret(String uebSecret) {
273                 if (StringUtils.isEmpty(uebSecret)) {
274                         this.uebSecret = "";
275                 }
276                 this.uebSecret = uebSecret;
277         }
278
279         public AppContactUs getContactUs() {
280                 return contactUs;
281         }
282
283         public void setContactUs(AppContactUs contactUs) {
284                 this.contactUs = contactUs;
285         }
286         
287         public Boolean getCentralAuth() {
288                 return centralAuth;
289         }
290
291         public void setCentralAuth(Boolean centralAuth) {
292                 if (centralAuth == null) {
293                         centralAuth = new Boolean(false);
294                 }
295                 this.centralAuth = centralAuth;
296         }
297         
298         public String getNameSpace() {
299                 return nameSpace;
300         }
301
302         public void setNameSpace(String nameSpace) {
303                 if (StringUtils.isEmpty(nameSpace)) {
304                         nameSpace = null;
305                 }
306                 this.nameSpace = nameSpace;
307         }
308
309         @Override
310         public String toString() {
311                 String str = "[" + getId() + ":" + getName() + "]";
312                 return str;
313         }
314
315 }