302195f0cf67b48e15fb297308546cdaec7175cd
[portal.git] / ecomp-portal-BE-common / src / main / java / org / openecomp / portalapp / portal / domain / Widget.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 org.apache.commons.lang.StringUtils;
23
24 import org.openecomp.portalsdk.core.domain.support.DomainVo;
25
26 public class Widget extends DomainVo {
27
28         private static final long serialVersionUID = 1L;
29
30         private String name;
31
32         private Integer width;
33
34         private Integer height;
35
36         private String url;
37
38         private Long appId;
39
40         public Widget() {
41                 // Attention!!!
42                 // We set here all default values. We also place protection
43                 // into setters for fields with default values.
44                 // If we don't use such protection we are able to place null
45                 // to these fields and save such fields into DB even if DB has
46                 // default values for these fields.
47                 this.name = "";
48                 this.width = new Integer(0);
49                 this.height = new Integer(0);
50                 this.url = "";
51         }
52
53         public String getName() {
54                 return name;
55         }
56
57         public void setName(String name) {
58                 if (StringUtils.isEmpty(name)) {
59                         name = "";
60                 }
61                 this.name = name;
62         }
63
64         public Integer getWidth() {
65                 return width;
66         }
67
68         public void setWidth(Integer width) {
69                 if (width == null) {
70                         width = new Integer(0);
71                 }
72                 this.width = width;
73         }
74
75         public Integer getHeight() {
76                 return height;
77         }
78
79         public void setHeight(Integer height) {
80                 if (height == null) {
81                         height = new Integer(0);
82                 }
83                 this.height = height;
84         }
85
86         public String getUrl() {
87                 return url;
88         }
89
90         public void setUrl(String url) {
91                 if (StringUtils.isEmpty(url)) {
92                         url = "";
93                 }
94                 this.url = url;
95         }
96
97         public Long getAppId() {
98                 return appId;
99         }
100
101         public void setAppId(Long appId) {
102                 this.appId = appId;
103         }
104
105 }