WidgetCatalog class DB constraints 23/89823/1
authorDominik Mizyn <d.mizyn@samsung.com>
Thu, 13 Jun 2019 15:10:22 +0000 (17:10 +0200)
committerDominik Mizyn <d.mizyn@samsung.com>
Thu, 13 Jun 2019 15:13:21 +0000 (17:13 +0200)
Java Bean Validation SR 380 annotations added to classes
Plains getter/setter converted to lombok annotation

Issue-ID: PORTAL-630
Change-Id: Id866ec4bc0dc428adfbb7cdc64fe15f7faf837f7
Signed-off-by: Dominik Mizyn <d.mizyn@samsung.com>
ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/WidgetCatalog.java

index 9d153e2..1dc0582 100644 (file)
@@ -14,30 +14,51 @@ import javax.persistence.JoinTable;
 import javax.persistence.ManyToMany;
 import javax.persistence.Table;
 import javax.persistence.Transient;
+import javax.validation.constraints.Digits;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+import lombok.Getter;
+import lombok.Setter;
+import org.hibernate.validator.constraints.SafeHtml;
 
 
 @Entity
 @Table(name="EP_WIDGET_CATALOG")
+@Getter
+@Setter
 public class WidgetCatalog{
        
        @Id
        @Column(name = "widget_id")
        @GeneratedValue(strategy=GenerationType.AUTO)
+       @Digits(integer = 11, fraction = 0)
        private long id;
        
        @Column(name = "wdg_name")
+       @Size(max = 100)
+       @SafeHtml
+       @NotNull
        private String name;
        
        @Column(name = "wdg_desc")
+       @Size(max = 200)
+       @SafeHtml
        private String desc;    
        
        @Column(name = "wdg_file_loc")
+       @Size(max = 256)
+       @SafeHtml
+       @NotNull
        private String fileLocation;
        
        @Column(name = "all_user_flag")
+       @Size(max = 1)
+       @SafeHtml
+       @NotNull
        private String allowAllUser;
        
        @Column(name = "service_id")
+       @Digits(integer = 11, fraction = 0)
        private Long serviceId;
        
        @Transient
@@ -53,78 +74,6 @@ public class WidgetCatalog{
        )
        private Set<RoleApp> widgetRoles;
 
-       public long getId() {
-               return id;
-       }
-
-       public void setId(long id) {
-               this.id = id;
-       }
-
-       public String getName() {
-               return name;
-       }
-
-       public void setName(String name) {
-               this.name = name;
-       }
-
-       public String getDesc() {
-               return desc;
-       }
-
-       public void setDesc(String desc) {
-               this.desc = desc;
-       }
-
-       public String getFileLocation() {
-               return fileLocation;
-       }
-
-       public void setFileLocation(String fileLocation) {
-               this.fileLocation = fileLocation;
-       }
-
-       public Set<RoleApp> getWidgetRoles() {
-               return widgetRoles;
-       }
-
-       public void setWidgetRoles(Set<RoleApp> widgetRoles) {
-               this.widgetRoles = widgetRoles;
-       }
-       
-       public String getAllowAllUser() {
-               return allowAllUser;
-       }
-
-       public void setAllowAllUser(String allowAllUser) {
-               this.allowAllUser = allowAllUser;
-       }
-
-       public String getSortOrder() {
-               return sortOrder;
-       }
-
-       public void setSortOrder(String sortOrder) {
-               this.sortOrder = sortOrder;
-       }
-
-       public String getStatusCode() {
-               return statusCode;
-       }
-
-       public void setStatusCode(String statusCode) {
-               this.statusCode = statusCode;
-       }
-
-       public Long getServiceId() {
-               return serviceId;
-       }
-
-       public void setServiceId(Long serviceId) {
-               this.serviceId = serviceId;
-       }
-
        @Override
        public String toString() {
                return "WidgetCatalog [id=" + id + ", name=" + name + ", desc=" + desc + ", fileLocation=" + fileLocation