[PORTAL-16 PORTAL-18] Widget ms; staging
[portal.git] / ecomp-portal-BE-common / src / main / java / org / openecomp / portalapp / portal / transport / FunctionalMenuItem.java
1 /*-
2  * ================================================================================
3  * ECOMP Portal
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ================================================================================
19  */
20 package org.openecomp.portalapp.portal.transport;
21
22 import java.io.Serializable;
23 import java.util.List;
24
25 import javax.persistence.Column;
26 import javax.persistence.Entity;
27 import javax.persistence.GeneratedValue;
28 import javax.persistence.GenerationType;
29 import javax.persistence.Id;
30 import javax.persistence.Table;
31 import javax.persistence.Transient;
32
33 @Entity
34 @Table(name="fn_menu_functional")
35 public class FunctionalMenuItem implements Serializable {
36         public FunctionalMenuItem(){};
37         
38         private static final long serialVersionUID = 1L;
39
40         @Id
41     @GeneratedValue(strategy=GenerationType.IDENTITY)
42         @Column(name = "MENU_ID")
43         public Long menuId;
44         
45         @Column(name = "COLUMN_NUM")
46         public Integer column;
47         
48         @Column(name = "TEXT")
49         public String text;
50         
51         @Column(name = "PARENT_MENU_ID")
52         public Integer parentMenuId;
53         
54         @Column(name = "URL")
55         public String url;
56         
57         @Column(name="ACTIVE_YN")
58         public String active_yn;
59
60         @Transient
61         public Integer appid;
62         
63         public List<Integer> getRoles() {
64                 return roles;
65         }
66
67         public void setRoles(List<Integer> roles) {
68                 this.roles = roles;
69         }
70
71         @Transient
72         private List<Integer> roles;
73         
74         @Transient
75         public Boolean restrictedApp;
76         
77         public void normalize() {
78                 if (this.column == null)
79                         this.column = new Integer(1);
80                 this.text = (this.text == null) ? "" : this.text.trim();
81                 if (this.parentMenuId == null)
82                         this.parentMenuId = new Integer(-1);
83                 this.url = (this.url == null) ? "" : this.url.trim();
84         }
85
86         @Override
87         public String toString() {
88                 return "FunctionalMenuItem [menuId=" + menuId + ", column=" + column + ", text=" + text + ", parentMenuId="
89                                 + parentMenuId + ", url=" + url + ", active_yn=" + active_yn + ", appid=" + appid + ", roles=" + roles
90                                 + ", restrictedApp=" + restrictedApp + "]";
91         }
92
93         public void setUrl(String url) {
94                 this.url = url;
95         }
96
97         public void setRestrictedApp(Boolean restrictedApp) {
98                 this.restrictedApp = restrictedApp;
99         }
100 }