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.SequenceGenerator;
58 import javax.persistence.Table;
59 import javax.validation.Valid;
60 import javax.validation.constraints.Digits;
61 import javax.validation.constraints.NotNull;
62 import javax.validation.constraints.Pattern;
63 import javax.validation.constraints.Size;
64 import lombok.AllArgsConstructor;
65 import lombok.Builder;
67 import lombok.NoArgsConstructor;
69 import org.hibernate.validator.constraints.SafeHtml;
70 import org.hibernate.validator.constraints.URL;
73 CREATE TABLE `fn_menu` (
74 `menu_id` int(11) NOT NULL AUTO_INCREMENT,
75 `label` varchar(100) DEFAULT NULL,
76 `parent_id` int(11) DEFAULT NULL,
77 `sort_order` decimal(4,0) DEFAULT NULL,
78 `action` varchar(200) DEFAULT NULL,
79 `function_cd` varchar(30) DEFAULT NULL,
80 `active_yn` varchar(1) NOT NULL DEFAULT 'y',
81 `servlet` varchar(50) DEFAULT NULL,
82 `query_string` varchar(200) DEFAULT NULL,
83 `external_url` varchar(200) DEFAULT NULL,
84 `target` varchar(25) DEFAULT NULL,
85 `menu_set_cd` varchar(10) DEFAULT 'app',
86 `separator_yn` char(1) DEFAULT 'n',
87 `image_src` varchar(100) DEFAULT NULL,
88 PRIMARY KEY (`menu_id`),
89 KEY `fk_fn_menu_ref_196_fn_menu` (`parent_id`),
90 KEY `fk_fn_menu_menu_set_cd` (`menu_set_cd`),
91 KEY `idx_fn_menu_label` (`label`),
92 CONSTRAINT `fk_fn_menu_menu_set_cd` FOREIGN KEY (`menu_set_cd`) REFERENCES `fn_lu_menu_set` (`menu_set_cd`),
93 CONSTRAINT `fk_fn_menu_ref_196_fn_menu` FOREIGN KEY (`parent_id`) REFERENCES `fn_menu` (`menu_id`)
97 @Table(name = "fn_menu", indexes = {
98 @Index(name = "idx_fn_menu_label", columnList = "label"),
99 @Index(name = "fk_fn_menu_ref_196_fn_menu", columnList = "parent_id"),
100 @Index(name = "fk_fn_menu_menu_set_cd", columnList = "menu_set_cd")
108 public class FnMenu implements Serializable {
110 @GeneratedValue(strategy = GenerationType.AUTO)
111 @Column(name = "menu_id", nullable = false, length = 11, columnDefinition = "int(11) auto_increment")
112 @Digits(integer = 11, fraction = 0)
113 private Integer menu_id;
114 @Column(name = "label", length = 100, columnDefinition = "varchar(100) DEFAULT NULL")
117 private String label;
118 @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE)
119 @JoinColumn(name = "parent_Id", columnDefinition = "int(11) DEFAULT NULL")
121 private FnMenu parentId;
122 @Column(name = "sort_order", length = 4, columnDefinition = "decimal(4,0) DEFAULT NULL")
123 @Digits(integer = 4, fraction = 0)
124 private Integer sortOrder;
125 @Column(name = "action", length = 200, columnDefinition = "varchar(200) DEFAULT NULL")
128 private String action;
129 @Column(name = "function_cd", length = 30, columnDefinition = "varchar(30) DEFAULT NULL")
132 private String functionCd;
133 @Column(name = "active_yn", length = 1, columnDefinition = "boolean default true", nullable = false)
135 private Boolean activeYn = true;
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.MERGE, 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 = "boolean default false")
160 private Boolean separatorYn = false;
161 @Column(name = "image_src", length = 100, columnDefinition = "varchar(100) DEFAULT NULL")
164 private String imageSrc;
166 targetEntity = FnMenu.class,
167 mappedBy = "parentId",
168 cascade = CascadeType.MERGE,
169 fetch = FetchType.LAZY
171 private Set<FnMenu> fnMenus;