[PORTAL-7] Rebase
[portal.git] / ecomp-portal-BE-common / src / main / java / org / openecomp / portalapp / portal / domain / EPApp.java
1 /*-\r
2  * ================================================================================\r
3  * ECOMP Portal\r
4  * ================================================================================\r
5  * Copyright (C) 2017 AT&T Intellectual Property\r
6  * ================================================================================\r
7  * Licensed under the Apache License, Version 2.0 (the "License");\r
8  * you may not use this file except in compliance with the License.\r
9  * You may obtain a copy of the License at\r
10  * \r
11  *      http://www.apache.org/licenses/LICENSE-2.0\r
12  * \r
13  * Unless required by applicable law or agreed to in writing, software\r
14  * distributed under the License is distributed on an "AS IS" BASIS,\r
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16  * See the License for the specific language governing permissions and\r
17  * limitations under the License.\r
18  * ================================================================================\r
19  */\r
20 package org.openecomp.portalapp.portal.domain;\r
21 \r
22 import javax.persistence.Lob;\r
23 \r
24 import org.apache.commons.lang.StringUtils;\r
25 import org.openecomp.portalsdk.core.domain.support.DomainVo;\r
26 \r
27 /**\r
28  * Model for all columns in the fn_app table.\r
29  */\r
30 public class EPApp extends DomainVo {\r
31 \r
32         private static final long serialVersionUID = 1L;\r
33 \r
34         private String name;\r
35         private String imageUrl;\r
36         private String description;\r
37         private String notes;\r
38         private String url;\r
39         private String alternateUrl;\r
40         private String appRestEndpoint;\r
41         private String mlAppName;\r
42         private String mlAppAdminId;\r
43         private Long motsId;\r
44         private String username;\r
45         private String appPassword;\r
46         @Lob\r
47         private byte[] thumbnail;\r
48         private Boolean open;\r
49         private Boolean enabled;\r
50         private String uebTopicName;\r
51         private String uebKey;\r
52         private String uebSecret;\r
53         private Integer appType;\r
54 \r
55         private AppContactUs contactUs;\r
56 \r
57         public EPApp() {\r
58                 // Attention!!!\r
59                 // We set here all default values. We also place protection\r
60                 // into setters for fields with default values.\r
61                 // If we don't use such protection we are able to place null\r
62                 // to these fields and save such fields into DB even if DB has\r
63                 // default values for these fields.\r
64                 this.name = "";\r
65                 this.mlAppName = "";\r
66                 this.mlAppAdminId = "";\r
67                 this.username = "";\r
68                 this.appPassword = "";\r
69                 this.open = new Boolean(false);\r
70                 this.enabled = new Boolean(true);\r
71                 this.uebTopicName = "";\r
72                 this.uebKey = "";\r
73                 this.uebSecret = "";\r
74                 this.appType = 1;\r
75         }\r
76 \r
77         public String getName() {\r
78                 return name;\r
79         }\r
80 \r
81         public void setName(String name) {\r
82                 if (StringUtils.isEmpty(name)) {\r
83                         name = "";\r
84                 }\r
85                 this.name = name;\r
86         }\r
87 \r
88         public String getImageUrl() {\r
89                 return imageUrl;\r
90         }\r
91 \r
92         public void setImageUrl(String imageUrl) {\r
93                 this.imageUrl = imageUrl;\r
94         }\r
95 \r
96         public byte[] getThumbnail() {\r
97                 return this.thumbnail;\r
98         }\r
99 \r
100         public void setThumbnail(byte[] thumbnail) {\r
101                 this.thumbnail = thumbnail;\r
102         }\r
103 \r
104         public String getDescription() {\r
105                 return description;\r
106         }\r
107 \r
108         public void setDescription(String description) {\r
109                 this.description = description;\r
110         }\r
111 \r
112         public String getNotes() {\r
113                 return notes;\r
114         }\r
115 \r
116         public void setNotes(String notes) {\r
117                 this.notes = notes;\r
118         }\r
119 \r
120         public String getUrl() {\r
121                 return url;\r
122         }\r
123 \r
124         public void setUrl(String url) {\r
125                 this.url = url;\r
126         }\r
127 \r
128         public String getAlternateUrl() {\r
129                 return alternateUrl;\r
130         }\r
131 \r
132         public void setAlternateUrl(String alternateUrl) {\r
133                 this.alternateUrl = alternateUrl;\r
134         }\r
135 \r
136         public String getAppRestEndpoint() {\r
137                 return appRestEndpoint;\r
138         }\r
139 \r
140         public void setAppRestEndpoint(String appRestEndpoint) {\r
141                 this.appRestEndpoint = appRestEndpoint;\r
142         }\r
143 \r
144         public String getMlAppName() {\r
145                 return mlAppName;\r
146         }\r
147 \r
148         public void setMlAppName(String mlAppName) {\r
149                 if (StringUtils.isEmpty(mlAppName)) {\r
150                         mlAppName = "";\r
151                 }\r
152                 this.mlAppName = mlAppName;\r
153         }\r
154 \r
155         public String getMlAppAdminId() {\r
156                 return mlAppAdminId;\r
157         }\r
158 \r
159         public void setMlAppAdminId(String mlAppAdminId) {\r
160                 if (StringUtils.isEmpty(mlAppAdminId)) {\r
161                         mlAppAdminId = "";\r
162                 }\r
163                 this.mlAppAdminId = mlAppAdminId;\r
164         }\r
165 \r
166         public Long getMotsId() {\r
167                 return motsId;\r
168         }\r
169 \r
170         public void setMotsId(Long motsId) {\r
171                 this.motsId = motsId;\r
172         }\r
173 \r
174         public String getUsername() {\r
175                 return username;\r
176         }\r
177 \r
178         public void setUsername(String username) {\r
179                 this.username = username;\r
180         }\r
181 \r
182         public String getAppPassword() {\r
183                 return appPassword;\r
184         }\r
185 \r
186         public void setAppPassword(String appPassword) {\r
187                 if (StringUtils.isEmpty(appPassword)) {\r
188                         appPassword = "";\r
189                 }\r
190                 this.appPassword = appPassword;\r
191         }\r
192 \r
193         public Boolean getOpen() {\r
194                 return open;\r
195         }\r
196 \r
197         public void setOpen(Boolean open) {\r
198                 if (open == null) {\r
199                         open = new Boolean(false);\r
200                 }\r
201                 this.open = open;\r
202         }\r
203 \r
204         public Boolean getEnabled() {\r
205                 return enabled;\r
206         }\r
207 \r
208         public void setEnabled(Boolean enabled) {\r
209                 if (enabled == null) {\r
210                         enabled = new Boolean(true);\r
211                 }\r
212                 this.enabled = enabled;\r
213         }\r
214 \r
215         public Integer getAppType() {\r
216                 return appType;\r
217         }\r
218 \r
219         public void setAppType(Integer appType) {\r
220                 if (appType == null) {\r
221                         appType = new Integer(1);\r
222                 }\r
223                 this.appType = appType;\r
224         }\r
225 \r
226         public void setRestrictedApp(Boolean restrictedApp) {\r
227                 Integer result = 1;\r
228                 if (restrictedApp) {\r
229                         result = 2;\r
230                 }\r
231                 this.appType = result;\r
232         }\r
233 \r
234         public Boolean isRestrictedApp() {\r
235                 return (this.appType == 2 ? true : false);\r
236         }\r
237 \r
238         public int compareTo(Object obj) {\r
239                 Long c1 = getId();\r
240                 Long c2 = ((EPApp) obj).getId();\r
241 \r
242                 return c1.compareTo(c2);\r
243         }\r
244 \r
245         public String getUebTopicName() {\r
246                 return this.uebTopicName;\r
247         }\r
248 \r
249         public void setUebTopicName(String topicName) {\r
250                 if (StringUtils.isEmpty(topicName)) {\r
251                         this.uebTopicName = "";\r
252                 }\r
253                 this.uebTopicName = topicName;\r
254         }\r
255 \r
256         public String getUebKey() {\r
257                 return this.uebKey;\r
258         }\r
259 \r
260         public void setUebKey(String uebKey) {\r
261                 if (StringUtils.isEmpty(uebKey)) {\r
262                         this.uebKey = "";\r
263                 }\r
264                 this.uebKey = uebKey;\r
265         }\r
266 \r
267         public String getUebSecret() {\r
268                 return this.uebSecret;\r
269         }\r
270 \r
271         public void setUebSecret(String uebSecret) {\r
272                 if (StringUtils.isEmpty(uebSecret)) {\r
273                         this.uebSecret = "";\r
274                 }\r
275                 this.uebSecret = uebSecret;\r
276         }\r
277 \r
278         public AppContactUs getContactUs() {\r
279                 return contactUs;\r
280         }\r
281 \r
282         public void setContactUs(AppContactUs contactUs) {\r
283                 this.contactUs = contactUs;\r
284         }\r
285 \r
286         @Override\r
287         public String toString() {\r
288                 String str = "[" + getId() + ":" + getName() + "]";\r
289                 return str;\r
290         }\r
291 \r
292 }\r