d54748a57711219c654de1e02082856623b8d582
[portal.git] / ecomp-portal-widget-ms / widget-ms / src / main / java / org / openecomp / portalapp / widget / domain / WidgetCatalog.java
1 /*-
2  * ============LICENSE_START==========================================
3  * ONAP Portal
4  * ===================================================================
5  * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6  * ===================================================================
7  *
8  * Unless otherwise specified, all software contained herein is licensed
9  * under the Apache License, Version 2.0 (the “License”);
10  * you may not use this software except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *             http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  * Unless otherwise specified, all documentation contained herein is licensed
22  * under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
23  * you may not use this documentation except in compliance with the License.
24  * You may obtain a copy of the License at
25  *
26  *             https://creativecommons.org/licenses/by/4.0/
27  *
28  * Unless required by applicable law or agreed to in writing, documentation
29  * distributed under the License is distributed on an "AS IS" BASIS,
30  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31  * See the License for the specific language governing permissions and
32  * limitations under the License.
33  *
34  * ============LICENSE_END============================================
35  *
36  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
37  */
38 package org.openecomp.portalapp.widget.domain;
39
40 import java.util.Set;
41
42 import javax.persistence.CascadeType;
43 import javax.persistence.Column;
44 import javax.persistence.Entity;
45 import javax.persistence.FetchType;
46 import javax.persistence.GeneratedValue;
47 import javax.persistence.GenerationType;
48 import javax.persistence.Id;
49 import javax.persistence.JoinColumn;
50 import javax.persistence.JoinTable;
51 import javax.persistence.ManyToMany;
52 import javax.persistence.Table;
53 import javax.persistence.Transient;
54
55
56 @Entity
57 @Table(name="EP_WIDGET_CATALOG")
58 public class WidgetCatalog{
59         
60         @Id
61         @Column(name = "widget_id")
62         @GeneratedValue(strategy=GenerationType.AUTO)
63         private long id;
64         
65         @Column(name = "wdg_name")
66         private String name;
67         
68         @Column(name = "wdg_desc")
69         private String desc;    
70         
71         @Column(name = "wdg_file_loc")
72         private String fileLocation;
73         
74         @Column(name = "all_user_flag")
75         private String allowAllUser;
76         
77         @Column(name = "service_id")
78         private Long serviceId;
79         
80         @Transient
81         private String sortOrder;
82
83         @Transient
84         private String statusCode;
85
86         @ManyToMany(fetch = FetchType.EAGER, cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH})
87         @JoinTable(name = "ep_widget_catalog_role", 
88                         joinColumns = {@JoinColumn(name = "WIDGET_ID")},
89                         inverseJoinColumns = {@JoinColumn(name = "ROLE_ID")}
90         )
91         private Set<RoleApp> widgetRoles;
92
93         public long getId() {
94                 return id;
95         }
96
97         public void setId(long id) {
98                 this.id = id;
99         }
100
101         public String getName() {
102                 return name;
103         }
104
105         public void setName(String name) {
106                 this.name = name;
107         }
108
109         public String getDesc() {
110                 return desc;
111         }
112
113         public void setDesc(String desc) {
114                 this.desc = desc;
115         }
116
117         public String getFileLocation() {
118                 return fileLocation;
119         }
120
121         public void setFileLocation(String fileLocation) {
122                 this.fileLocation = fileLocation;
123         }
124
125         public Set<RoleApp> getWidgetRoles() {
126                 return widgetRoles;
127         }
128
129         public void setWidgetRoles(Set<RoleApp> widgetRoles) {
130                 this.widgetRoles = widgetRoles;
131         }
132         
133         public String getAllowAllUser() {
134                 return allowAllUser;
135         }
136
137         public void setAllowAllUser(String allowAllUser) {
138                 this.allowAllUser = allowAllUser;
139         }
140
141         public String getSortOrder() {
142                 return sortOrder;
143         }
144
145         public void setSortOrder(String sortOrder) {
146                 this.sortOrder = sortOrder;
147         }
148
149         public String getStatusCode() {
150                 return statusCode;
151         }
152
153         public void setStatusCode(String statusCode) {
154                 this.statusCode = statusCode;
155         }
156
157         public Long getServiceId() {
158                 return serviceId;
159         }
160
161         public void setServiceId(Long serviceId) {
162                 this.serviceId = serviceId;
163         }
164
165         @Override
166         public String toString() {
167                 return "WidgetCatalog [id=" + id + ", name=" + name + ", desc=" + desc + ", fileLocation=" + fileLocation
168                                 + ", allowAllUser=" + allowAllUser + ", serviceId=" + serviceId + ", sortOrder=" + sortOrder
169                                 + ", statusCode=" + statusCode + ", widgetRoles=" + widgetRoles + "]";
170         }
171 }