Ecomp DTO up
[portal.git] / portal-BE / src / main / java / org / onap / portal / domain / dto / ecomp / EPApp.java
1 /*
2  * ============LICENSE_START==========================================
3  * ONAP Portal
4  * ===================================================================
5  * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
6  * ===================================================================
7  * Modifications Copyright (c) 2019 Samsung
8  * ===================================================================
9  *
10  * Unless otherwise specified, all software contained herein is licensed
11  * under the Apache License, Version 2.0 (the "License");
12  * you may not use this software except in compliance with the License.
13  * You may obtain a copy of the License at
14  *
15  *             http://www.apache.org/licenses/LICENSE-2.0
16  *
17  * Unless required by applicable law or agreed to in writing, software
18  * distributed under the License is distributed on an "AS IS" BASIS,
19  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20  * See the License for the specific language governing permissions and
21  * limitations under the License.
22  *
23  * Unless otherwise specified, all documentation contained herein is licensed
24  * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
25  * you may not use this documentation except in compliance with the License.
26  * You may obtain a copy of the License at
27  *
28  *             https://creativecommons.org/licenses/by/4.0/
29  *
30  * Unless required by applicable law or agreed to in writing, documentation
31  * distributed under the License is distributed on an "AS IS" BASIS,
32  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
33  * See the License for the specific language governing permissions and
34  * limitations under the License.
35  *
36  * ============LICENSE_END============================================
37  *
38  *
39  */
40
41 package org.onap.portal.domain.dto.ecomp;
42
43 import javax.persistence.Lob;
44 import javax.validation.Valid;
45 import lombok.AllArgsConstructor;
46 import lombok.EqualsAndHashCode;
47 import lombok.Getter;
48 import lombok.Setter;
49 import org.apache.commons.lang.StringUtils;
50 import org.hibernate.validator.constraints.SafeHtml;
51 import org.onap.portal.domain.dto.DomainVo;
52
53 @Getter
54 @Setter
55 @EqualsAndHashCode(callSuper = false)
56 @AllArgsConstructor
57 public class EPApp extends DomainVo {
58
59        private static final long serialVersionUID = 1L;
60
61        @SafeHtml
62        private String name;
63        @SafeHtml
64        private String imageUrl;
65        @SafeHtml
66        private String description;
67        @SafeHtml
68        private String notes;
69        @SafeHtml
70        private String url;
71        @SafeHtml
72        private String alternateUrl;
73        @SafeHtml
74        private String appRestEndpoint;
75        @SafeHtml
76        private String mlAppName;
77        @SafeHtml
78        private String mlAppAdminId;
79        private Long motsId;
80        @SafeHtml
81        private String username;
82        @SafeHtml
83        private String appPassword;
84        @Lob
85        private byte[] thumbnail;
86        private Boolean open;
87        private Boolean enabled;
88        @SafeHtml
89        private String uebTopicName;
90        @SafeHtml
91        private String uebKey;
92        @SafeHtml
93        private String uebSecret;
94        private Integer appType;
95        @Valid
96        private AppContactUs contactUs;
97        private Boolean centralAuth;
98        @SafeHtml
99        private String nameSpace;
100
101        public EPApp() {
102               this.name = "";
103               this.mlAppName = "";
104               this.mlAppAdminId = "";
105               this.username = "";
106               this.appPassword = "";
107               this.open = Boolean.FALSE;
108               this.enabled = Boolean.TRUE;
109               this.uebTopicName = "";
110               this.uebKey = "";
111               this.uebSecret = "";
112               this.appType = 1;
113        }
114
115
116        public void setName(String name) {
117               if (StringUtils.isEmpty(name)) {
118                      name = "";
119               }
120               this.name = name;
121        }
122
123        public void setMlAppName(String mlAppName) {
124               if (StringUtils.isEmpty(mlAppName)) {
125                      mlAppName = "";
126               }
127               this.mlAppName = mlAppName;
128        }
129
130        public void setMlAppAdminId(String mlAppAdminId) {
131               if (StringUtils.isEmpty(mlAppAdminId)) {
132                      mlAppAdminId = "";
133               }
134               this.mlAppAdminId = mlAppAdminId;
135        }
136
137
138        public void setAppPassword(String appPassword) {
139               if (StringUtils.isEmpty(appPassword)) {
140                      appPassword = "";
141               }
142               this.appPassword = appPassword;
143        }
144
145        public void setOpen(Boolean open) {
146               if (open == null) {
147                      open = Boolean.FALSE;
148               }
149               this.open = open;
150        }
151
152        public void setEnabled(Boolean enabled) {
153               if (enabled == null) {
154                      enabled = Boolean.TRUE;
155               }
156               this.enabled = enabled;
157        }
158
159        public void setAppType(Integer appType) {
160               if (appType == null) {
161                      appType = 1;
162               }
163               this.appType = appType;
164        }
165
166        public void setRestrictedApp(Boolean restrictedApp) {
167               Integer result = 1;
168               if (restrictedApp) {
169                      result = 2;
170               }
171               this.appType = result;
172        }
173
174        public Boolean isRestrictedApp() {
175               return (this.appType == 2);
176        }
177
178        public int compareTo(Object obj) {
179               Long c1 = getId();
180               Long c2 = ((EPApp) obj).getId();
181
182               return c1.compareTo(c2);
183        }
184
185        public void setUebTopicName(String topicName) {
186               if (StringUtils.isEmpty(topicName)) {
187                      this.uebTopicName = "";
188               }
189               this.uebTopicName = topicName;
190        }
191
192        public void setUebKey(String uebKey) {
193               if (StringUtils.isEmpty(uebKey)) {
194                      this.uebKey = "";
195               }
196               this.uebKey = uebKey;
197        }
198
199
200        public void setUebSecret(String uebSecret) {
201               if (StringUtils.isEmpty(uebSecret)) {
202                      this.uebSecret = "";
203               }
204               this.uebSecret = uebSecret;
205        }
206
207        public void setCentralAuth(Boolean centralAuth) {
208               if (centralAuth == null) {
209                      centralAuth = Boolean.FALSE;
210               }
211               this.centralAuth = centralAuth;
212        }
213
214        public void setNameSpace(String nameSpace) {
215               if (StringUtils.isEmpty(nameSpace)) {
216                      nameSpace = null;
217               }
218               this.nameSpace = nameSpace;
219        }
220
221        @Override
222        public String toString() {
223               return "[" + getId() + ":" + getName() + "]";
224        }
225
226 }