769016db85012664478906eb2934646513773eea
[portal.git] / ecomp-portal-BE-common / src / main / java / org / openecomp / portalapp / portal / domain / RoleApp.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.domain;
21
22 import java.io.Serializable;
23 import java.util.Set;
24
25 import javax.persistence.CascadeType;
26 import javax.persistence.Column;
27 import javax.persistence.FetchType;
28 import javax.persistence.GeneratedValue;
29 import javax.persistence.GenerationType;
30 import javax.persistence.Id;
31 import javax.persistence.JoinColumn;
32 import javax.persistence.ManyToMany;
33 import javax.persistence.ManyToOne;
34
35 import com.fasterxml.jackson.annotation.JsonIgnore;
36
37 //@Entity
38 //@Table(name = "FN_ROLE")
39 public class RoleApp implements Serializable{
40         private static final long serialVersionUID = 1L;
41
42         //@Id
43         //@Column(name = "ROLE_ID")
44         //@GeneratedValue(strategy=GenerationType.AUTO)
45         private Long roleId;
46         
47         
48         //@Column(name = "ROLE_Name")
49         private String roleName;
50         
51         //@ManyToOne(fetch = FetchType.EAGER)
52         //@JoinColumn(name="APP_ID")
53         private App app;
54         
55         //@JsonIgnore
56         //@ManyToMany(fetch = FetchType.EAGER, cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}, mappedBy="widgetRoles")
57         private Set<WidgetCatalog> widgets;
58
59         /*@PreRemove
60         private void removeGroupsFromUsers() {
61             for (WidgetCatalog w : widgets) {
62                 w.getWidgetRoles().remove(this);
63             }
64         }*/
65         
66         /*@ManyToOne
67         @JoinColumn(name = "WIDGET_ID", nullable = false)
68         WidgetCatalog widgetCatalog;*/
69
70         //@JsonIgnore
71         //@ManyToMany(mappedBy = "widgetRoles")
72         //@ManyToMany(fetch = FetchType.EAGER, mappedBy = "widgetRoles")
73         //private Set<WidgetCatalog> widgets  = new HashSet<WidgetCatalog>();
74         
75         public Long getRoleId() {
76                 return roleId;
77         }
78
79         public void setRoleId(Long roleId) {
80                 this.roleId = roleId;
81         }
82
83         public String getRoleName() {
84                 return roleName;
85         }
86
87         public void setRoleName(String roleName) {
88                 this.roleName = roleName;
89         }
90
91         public App getApp() {
92                 return app;
93         }
94
95         public void setApp(App app) {
96                 this.app = app;
97         }
98         
99         
100
101         public Set<WidgetCatalog> getWidgets() {
102                 return widgets;
103         }
104
105         public void setWidgets(Set<WidgetCatalog> widgets) {
106                 this.widgets = widgets;
107         }
108
109         @Override
110         public String toString() {
111                 return "Role [roleId=" + roleId + ", roleName=" + roleName + ", app=" + app + "]";
112         }
113         
114 }