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;
44 import javax.persistence.CascadeType;
45 import javax.persistence.Column;
46 import javax.persistence.Entity;
47 import javax.persistence.EntityResult;
48 import javax.persistence.FetchType;
49 import javax.persistence.FieldResult;
50 import javax.persistence.Id;
51 import javax.persistence.JoinColumn;
52 import javax.persistence.MapsId;
53 import javax.persistence.NamedNativeQueries;
54 import javax.persistence.NamedNativeQuery;
55 import javax.persistence.OneToOne;
56 import javax.persistence.SqlResultSetMapping;
57 import javax.persistence.Table;
58 import javax.validation.Valid;
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.dto.DomainVo;
71 CREATE TABLE `fn_app_contact_us` (
72 `app_id` int(11) NOT NULL,
73 `contact_name` varchar(128) DEFAULT NULL,
74 `contact_email` varchar(128) DEFAULT NULL,
75 `url` varchar(256) DEFAULT NULL,
76 `active_yn` varchar(2) DEFAULT NULL,
77 `description` varchar(1024) DEFAULT NULL,
78 PRIMARY KEY (`app_id`),
79 CONSTRAINT `fk_fn_a_con__ref_202_fn_app` FOREIGN KEY (`app_id`) REFERENCES `fn_app` (`app_id`)
84 name = "fnAppContactUsMapping",
87 entityClass = FnAppContactUs.class,
89 @FieldResult(name = "appId", column = "app_Id"),
90 @FieldResult(name = "contactName", column = "contactName"),
91 @FieldResult(name = "contact_email", column = "contactEmail"),
92 @FieldResult(name = "description", column = "description"),
93 @FieldResult(name = "activeYN", column = "activeYN")
100 name = "FnAppContactUs.getAppsAndContacts",
102 + "a.app_id as app_Id, a.app_name as appName,"
103 + "c.contact_name as contactName, "
104 + "c.contact_email as contactEmail, c.url, c.description, "
105 + "c.active_yn as activeYN"
109 + "fn_app_contact_us c"
110 + "on a.app_id = c.app_id"
112 + "a.enabled = 'Y' and a.app_name is not null and a.app_name != '';",
113 resultClass = FnAppContactUs.class,
114 resultSetMapping = "fnAppContactUsMapping"),
116 name = "FnAppContactUs.getAppContactUsItems",
118 + " c.app_id as app_Id,\n"
119 + " c.contact_name as contact_name,\n"
120 + " c.contact_email as contact_email,\n"
122 + " c.description,\n"
123 + " c.active_yn as active_yn,\n"
124 + " a.app_name as appName\n"
126 + " fn_app_contact_us c\n"
127 + " left join fn_app a on a.app_id = c.app_id\n"
129 + " a.enabled = 'Y'\n"
130 + " and a.app_name is not null\n"
131 + " and a.app_name != ''",
132 resultClass = FnAppContactUs.class,
133 resultSetMapping = "fnAppContactUsMapping")
136 @Table(name = "fn_app_contact_us")
139 @EqualsAndHashCode(callSuper = true)
143 public class FnAppContactUs extends DomainVo implements Serializable {
145 @Column(name = "app_id")
148 @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
149 @JoinColumn(name = "app_id")
153 @Column(name = "contact_name", length = 128, columnDefinition = "varchar(128) default null")
156 private String contactName;
157 @Column(name = "contact_email", length = 128, columnDefinition = "varchar(128) default null")
160 private String contactEmail;
161 @Column(name = "url", length = 256, columnDefinition = "varchar(128) default null")
167 @Column(name = "active_yn", length = 1, columnDefinition = "varchar(1) default null")
168 @Pattern(regexp = "[YNyn]")
171 private String activeYn;
172 @Column(name = "description", length = 1024, columnDefinition = "varchar(1024) default null")
175 private String description;