2 * ============LICENSE_START==========================================
4 * ===================================================================
5 * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
6 * ===================================================================
7 * Modifications Copyright (c) 2019 Samsung
8 * ===================================================================
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
15 * http://www.apache.org/licenses/LICENSE-2.0
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.
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
28 * https://creativecommons.org/licenses/by/4.0/
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.
36 * ============LICENSE_END============================================
41 package org.onap.portal.domain.db.fn;
43 import java.io.Serializable;
45 import javax.persistence.CascadeType;
46 import javax.persistence.Column;
47 import javax.persistence.Embeddable;
48 import javax.persistence.Entity;
49 import javax.persistence.FetchType;
50 import javax.persistence.GeneratedValue;
51 import javax.persistence.GenerationType;
52 import javax.persistence.Id;
53 import javax.persistence.NamedQueries;
54 import javax.persistence.NamedQuery;
55 import javax.persistence.OneToMany;
56 import javax.persistence.Table;
57 import javax.validation.constraints.Digits;
58 import javax.validation.constraints.NotNull;
59 import javax.validation.constraints.Pattern;
60 import javax.validation.constraints.Size;
61 import lombok.AllArgsConstructor;
62 import lombok.EqualsAndHashCode;
64 import lombok.NoArgsConstructor;
66 import org.hibernate.validator.constraints.SafeHtml;
67 import org.hibernate.validator.constraints.URL;
68 import org.onap.portal.domain.db.ep.EpAppFunction;
69 import org.onap.portal.domain.db.ep.EpAppRoleFunction;
70 import org.onap.portal.domain.db.ep.EpMicroservice;
71 import org.onap.portal.domain.db.ep.EpUserRolesRequest;
72 import org.onap.portal.domain.db.ep.EpWebAnalyticsSource;
73 import org.onap.portal.domain.db.ep.EpWidgetCatalogRole;
74 import org.onap.portal.domain.dto.DomainVo;
77 CREATE TABLE `fn_app` (
78 `app_id` int(11) NOT NULL AUTO_INCREMENT,
79 `app_name` varchar(100) NOT NULL DEFAULT '?',
80 `app_image_url` varchar(256) DEFAULT NULL,
81 `app_description` varchar(512) DEFAULT NULL,
82 `app_notes` varchar(4096) DEFAULT NULL,
83 `app_url` varchar(256) DEFAULT NULL,
84 `app_alternate_url` varchar(256) DEFAULT NULL,
85 `app_rest_endpoint` varchar(2000) DEFAULT NULL,
86 `ml_app_name` varchar(50) NOT NULL DEFAULT '?',
87 `ml_app_admin_id` varchar(7) NOT NULL DEFAULT '?',
88 `mots_id` int(11) DEFAULT NULL,
89 `app_password` varchar(256) NOT NULL DEFAULT '?',
90 `open` char(1) DEFAULT 'N',
91 `enabled` char(1) DEFAULT 'Y',
92 `thumbnail` mediumblob DEFAULT NULL,
93 `app_username` varchar(50) DEFAULT NULL,
94 `ueb_key` varchar(256) DEFAULT NULL,
95 `ueb_secret` varchar(256) DEFAULT NULL,
96 `ueb_topic_name` varchar(256) DEFAULT NULL,
97 `app_type` int(11) NOT NULL DEFAULT 1,
98 `auth_central` char(1) NOT NULL DEFAULT 'N',
99 `auth_namespace` varchar(100) DEFAULT NULL,
100 PRIMARY KEY (`app_id`)
106 name = "FnApp.retrieveWhereAuthCentralIsYAndOpenIsNAndAuthNamespaceIsNotNull",
107 query = "from FnApp where authCentral = 'Y' and open = 'N' and authNamespace is not null"),
109 name = "FnApp.getByUebKey",
110 query = "from FnApp where uebKey = :uebKey"
114 @Table(name = "fn_app")
117 @EqualsAndHashCode(callSuper = true)
122 public class FnApp extends DomainVo implements Serializable {
125 @GeneratedValue(strategy = GenerationType.AUTO)
126 @Column(name = "app_Id", length = 11, nullable = false)
127 @Digits(integer = 11, fraction = 0)
129 @Column(name = "app_name", length = 100, nullable = false, columnDefinition = "varchar(100) not null default '?'")
133 private String appName;
134 @Column(name = "app_image_url", length = 256)
137 private String appImageUrl;
138 @Column(name = "app_description", length = 512)
141 private String appDescription;
142 @Column(name = "app_notes", length = 4096)
145 private String appNotes;
146 @Column(name = "app_url", length = 256)
151 private String appUrl;
152 @Column(name = "app_alternate_url", length = 256)
155 private String appAlternateUrl;
156 @Column(name = "app_rest_endpoint", length = 2000)
159 private String appRestEndpoint;
160 @Column(name = "ml_app_name", length = 50, nullable = false, columnDefinition = "varchar(50) not null default '?'")
164 private String ml_app_name;
165 @Column(name = "ml_app_admin_id", length = 7, nullable = false, columnDefinition = "varchar(7) not null default '?'")
169 private String mlAppAdminId;
170 @Column(name = "mots_id", length = 11)
171 @Digits(integer = 11, fraction = 0)
173 @Column(name = "app_password", length = 256, nullable = false, columnDefinition = "varchar(256) not null default '?'")
177 private String appPassword;
178 @Column(name = "_open", length = 1, columnDefinition = "char(1) default 'N'")
179 private Boolean open;
180 @Column(name = "_enabled", length = 1, columnDefinition = "char(1) default 'N'")
181 private Boolean enabled;
182 @Column(name = "active_yn", length = 1, columnDefinition = "char(1) default 'Y'")
183 @Pattern(regexp = "[YNyn]")
187 private String activeYn;
188 @Column(name = "_thumbnail", columnDefinition = "mediumblob null default null")
189 private byte[] thumbnail;
190 @Column(name = "app_username", length = 50)
193 private String appUsername;
194 @Column(name = "ueb_key", length = 256)
197 private String uebKey;
198 @Column(name = "ueb_secret", length = 256)
201 private String uebSecret;
202 @Column(name = "ueb_topic_name", length = 256)
205 private String uebTopicName;
206 @Column(name = "app_type", length = 11, columnDefinition = "int(11) not null default 1")
207 @Digits(integer = 11, fraction = 0)
208 private Long appType;
209 @Column(name = "auth_central", length = 1, columnDefinition = "char(1) not null default 'N'", nullable = false)
210 private Boolean authCentral;
211 @Column(name = "auth_namespace", length = 100)
214 private String authNamespace;
216 targetEntity = FnMenuFunctionalRoles.class,
218 cascade = CascadeType.ALL,
219 fetch = FetchType.LAZY
221 private Set<FnMenuFunctionalRoles> fnMenuFunctionalRoles;
223 targetEntity = EpUserRolesRequest.class,
225 cascade = CascadeType.ALL,
226 fetch = FetchType.LAZY
228 private Set<EpUserRolesRequest> epUserRolesRequests;
230 targetEntity = EpAppFunction.class,
232 cascade = CascadeType.ALL,
233 fetch = FetchType.LAZY
235 private Set<EpAppFunction> epAppFunctions;
237 targetEntity = EpAppRoleFunction.class,
239 cascade = CascadeType.ALL,
240 fetch = FetchType.LAZY
242 private Set<EpAppRoleFunction> epAppRoleFunctions;
244 targetEntity = FnUserRole.class,
246 cascade = CascadeType.ALL,
247 fetch = FetchType.LAZY
249 private Set<FnUserRole> fnUserRoles;
251 targetEntity = EpWebAnalyticsSource.class,
253 cascade = CascadeType.ALL,
254 fetch = FetchType.LAZY
256 private Set<EpWebAnalyticsSource> epWebAnalyticsSources;
258 targetEntity = EpWidgetCatalogRole.class,
260 cascade = CascadeType.ALL,
261 fetch = FetchType.LAZY
263 private Set<EpWidgetCatalogRole> epWidgetCatalogRoles;
265 targetEntity = EpMicroservice.class,
267 cascade = CascadeType.ALL,
268 fetch = FetchType.LAZY
270 private Set<EpMicroservice> epMicroservices;
272 targetEntity = FnPersUserAppSel.class,
274 cascade = CascadeType.ALL,
275 fetch = FetchType.LAZY
277 private Set<FnPersUserAppSel> fnPersUserAppSels;
279 public Boolean isRestrictedApp() {
280 return (this.appType == 2);