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.Entity;
48 import javax.persistence.FetchType;
49 import javax.persistence.ForeignKey;
50 import javax.persistence.GeneratedValue;
51 import javax.persistence.GenerationType;
52 import javax.persistence.Id;
53 import javax.persistence.Index;
54 import javax.persistence.JoinColumn;
55 import javax.persistence.ManyToOne;
56 import javax.persistence.OneToMany;
57 import javax.persistence.Table;
58 import javax.validation.Valid;
59 import javax.validation.constraints.Digits;
60 import javax.validation.constraints.NotNull;
61 import javax.validation.constraints.Pattern;
62 import javax.validation.constraints.Size;
63 import lombok.AllArgsConstructor;
65 import lombok.NoArgsConstructor;
67 import org.hibernate.validator.constraints.SafeHtml;
68 import org.hibernate.validator.constraints.URL;
71 CREATE TABLE `fn_menu` (
72 `menu_id` int(11) NOT NULL AUTO_INCREMENT,
73 `label` varchar(100) DEFAULT NULL,
74 `parent_id` int(11) DEFAULT NULL,
75 `sort_order` decimal(4,0) DEFAULT NULL,
76 `action` varchar(200) DEFAULT NULL,
77 `function_cd` varchar(30) DEFAULT NULL,
78 `active_yn` varchar(1) NOT NULL DEFAULT 'y',
79 `servlet` varchar(50) DEFAULT NULL,
80 `query_string` varchar(200) DEFAULT NULL,
81 `external_url` varchar(200) DEFAULT NULL,
82 `target` varchar(25) DEFAULT NULL,
83 `menu_set_cd` varchar(10) DEFAULT 'app',
84 `separator_yn` char(1) DEFAULT 'n',
85 `image_src` varchar(100) DEFAULT NULL,
86 PRIMARY KEY (`menu_id`),
87 KEY `fk_fn_menu_ref_196_fn_menu` (`parent_id`),
88 KEY `fk_fn_menu_menu_set_cd` (`menu_set_cd`),
89 KEY `idx_fn_menu_label` (`label`),
90 CONSTRAINT `fk_fn_menu_menu_set_cd` FOREIGN KEY (`menu_set_cd`) REFERENCES `fn_lu_menu_set` (`menu_set_cd`),
91 CONSTRAINT `fk_fn_menu_ref_196_fn_menu` FOREIGN KEY (`parent_id`) REFERENCES `fn_menu` (`menu_id`)
95 @Table(name = "fn_menu", indexes = {
96 @Index(name = "idx_fn_menu_label", columnList = "label"),
97 @Index(name = "fk_fn_menu_ref_196_fn_menu", columnList = "parent_id"),
98 @Index(name = "fk_fn_menu_menu_set_cd", columnList = "menu_set_cd")
105 public class FnMenu implements Serializable {
107 @GeneratedValue(strategy = GenerationType.AUTO)
108 @Column(name = "menu_id", nullable = false, length = 11, columnDefinition = "int(11) auto_increment")
109 @Digits(integer = 11, fraction = 0)
110 private Integer menu_id;
111 @Column(name = "label", length = 100, columnDefinition = "varchar(100) DEFAULT NULL")
114 private String label;
115 @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
116 @JoinColumn(name = "parent_Id", columnDefinition = "int(11) DEFAULT NULL")
118 private FnMenu parentId;
119 @Column(name = "sort_order", length = 4, columnDefinition = "decimal(4,0) DEFAULT NULL")
120 @Digits(integer = 4, fraction = 0)
121 private Integer sortOrder;
122 @Column(name = "action", length = 200, columnDefinition = "varchar(200) DEFAULT NULL")
125 private String action;
126 @Column(name = "function_cd", length = 30, columnDefinition = "varchar(30) DEFAULT NULL")
129 private String functionCd;
130 @Column(name = "active_yn", length = 1, columnDefinition = "character varying(1) default 'y'", nullable = false)
131 @Pattern(regexp = "[YNyn]")
135 private String activeYn;
136 @Column(name = "servlet", length = 50, columnDefinition = "varchar(50) DEFAULT NULL")
139 private String servlet;
140 @Column(name = "query_string", length = 200, columnDefinition = "varchar(200) DEFAULT NULL")
143 private String queryString;
144 @Column(name = "external_url", length = 200, columnDefinition = "varchar(200) DEFAULT NULL")
149 private String externalUrl;
150 @Column(name = "target", length = 25, columnDefinition = "varchar(25) DEFAULT NULL")
153 private String target;
154 @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
155 @JoinColumn(name = "menu_set_cd", columnDefinition = "character varying(10) default 'app'", foreignKey = @ForeignKey(name = "fk_fn_menu_menu_set_cd"))
157 private FnLuMenuSet menuSetCd;
158 @Column(name = "separator_yn", length = 1, columnDefinition = "character varying(1) default 'n'")
159 @Pattern(regexp = "[YNyn]")
163 private String separatorYn;
164 @Column(name = "image_src", length = 100, columnDefinition = "varchar(100) DEFAULT NULL")
167 private String imageSrc;
169 targetEntity = FnMenu.class,
170 mappedBy = "parentId",
171 cascade = CascadeType.ALL,
172 fetch = FetchType.LAZY
174 private Set<FnMenu> fnMenus;