[PORTAL-7] Rebase
[portal.git] / ecomp-portal-BE-common / src / main / java / org / openecomp / portalapp / portal / domain / RoleApp.java
1 /*-\r
2  * ================================================================================\r
3  * ECOMP Portal\r
4  * ================================================================================\r
5  * Copyright (C) 2017 AT&T Intellectual Property\r
6  * ================================================================================\r
7  * Licensed under the Apache License, Version 2.0 (the "License");\r
8  * you may not use this file except in compliance with the License.\r
9  * You may obtain a copy of the License at\r
10  * \r
11  *      http://www.apache.org/licenses/LICENSE-2.0\r
12  * \r
13  * Unless required by applicable law or agreed to in writing, software\r
14  * distributed under the License is distributed on an "AS IS" BASIS,\r
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16  * See the License for the specific language governing permissions and\r
17  * limitations under the License.\r
18  * ================================================================================\r
19  */\r
20 package org.openecomp.portalapp.portal.domain;\r
21 \r
22 import java.io.Serializable;\r
23 import java.util.Set;\r
24 \r
25 import javax.persistence.CascadeType;\r
26 import javax.persistence.Column;\r
27 import javax.persistence.FetchType;\r
28 import javax.persistence.GeneratedValue;\r
29 import javax.persistence.GenerationType;\r
30 import javax.persistence.Id;\r
31 import javax.persistence.JoinColumn;\r
32 import javax.persistence.ManyToMany;\r
33 import javax.persistence.ManyToOne;\r
34 \r
35 import com.fasterxml.jackson.annotation.JsonIgnore;\r
36 \r
37 //@Entity\r
38 //@Table(name = "FN_ROLE")\r
39 public class RoleApp implements Serializable{\r
40         private static final long serialVersionUID = 1L;\r
41 \r
42         //@Id\r
43         //@Column(name = "ROLE_ID")\r
44         //@GeneratedValue(strategy=GenerationType.AUTO)\r
45         private Long roleId;\r
46         \r
47         \r
48         //@Column(name = "ROLE_Name")\r
49         private String roleName;\r
50         \r
51         //@ManyToOne(fetch = FetchType.EAGER)\r
52         //@JoinColumn(name="APP_ID")\r
53         private App app;\r
54         \r
55         //@JsonIgnore\r
56         //@ManyToMany(fetch = FetchType.EAGER, cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}, mappedBy="widgetRoles")\r
57         private Set<WidgetCatalog> widgets;\r
58 \r
59         /*@PreRemove\r
60         private void removeGroupsFromUsers() {\r
61             for (WidgetCatalog w : widgets) {\r
62                 w.getWidgetRoles().remove(this);\r
63             }\r
64         }*/\r
65         \r
66         /*@ManyToOne\r
67         @JoinColumn(name = "WIDGET_ID", nullable = false)\r
68         WidgetCatalog widgetCatalog;*/\r
69 \r
70         //@JsonIgnore\r
71         //@ManyToMany(mappedBy = "widgetRoles")\r
72         //@ManyToMany(fetch = FetchType.EAGER, mappedBy = "widgetRoles")\r
73         //private Set<WidgetCatalog> widgets  = new HashSet<WidgetCatalog>();\r
74         \r
75         public Long getRoleId() {\r
76                 return roleId;\r
77         }\r
78 \r
79         public void setRoleId(Long roleId) {\r
80                 this.roleId = roleId;\r
81         }\r
82 \r
83         public String getRoleName() {\r
84                 return roleName;\r
85         }\r
86 \r
87         public void setRoleName(String roleName) {\r
88                 this.roleName = roleName;\r
89         }\r
90 \r
91         public App getApp() {\r
92                 return app;\r
93         }\r
94 \r
95         public void setApp(App app) {\r
96                 this.app = app;\r
97         }\r
98         \r
99         \r
100 \r
101         public Set<WidgetCatalog> getWidgets() {\r
102                 return widgets;\r
103         }\r
104 \r
105         public void setWidgets(Set<WidgetCatalog> widgets) {\r
106                 this.widgets = widgets;\r
107         }\r
108 \r
109         @Override\r
110         public String toString() {\r
111                 return "Role [roleId=" + roleId + ", roleName=" + roleName + ", app=" + app + "]";\r
112         }\r
113         \r
114 }\r