summaryrefslogtreecommitdiffstats
path: root/ecomp-portal-BE-common/src/main/java/org
diff options
context:
space:
mode:
authorDominik Mizyn <d.mizyn@samsung.com>2019-06-18 09:15:39 +0200
committerDominik Mizyn <d.mizyn@samsung.com>2019-06-18 09:16:52 +0200
commitd86b4b4fc44fd3f4b24c09d784889b8b71d540e4 (patch)
tree8e3a57fab7b1c6c52b4aa61f7242aeb6e7fa381c /ecomp-portal-BE-common/src/main/java/org
parentd9a26e7fe8c2dfee2ea43ae697278e11f10f31e9 (diff)
CommonWidget class DB constraints
Java Bean Validation SR 380 annotations added to classes Issue-ID: PORTAL-637 Signed-off-by: Dominik Mizyn <d.mizyn@samsung.com> Change-Id: I64741f835deb8aed14ad8d716d21bb4c1901b55f
Diffstat (limited to 'ecomp-portal-BE-common/src/main/java/org')
-rw-r--r--ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CommonWidget.java77
1 files changed, 14 insertions, 63 deletions
diff --git a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CommonWidget.java b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CommonWidget.java
index 3fbdc3e8..90277877 100644
--- a/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CommonWidget.java
+++ b/ecomp-portal-BE-common/src/main/java/org/onap/portalapp/portal/transport/CommonWidget.java
@@ -44,6 +44,11 @@ import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
+import javax.validation.constraints.Pattern;
+import javax.validation.constraints.Size;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
import org.hibernate.validator.constraints.SafeHtml;
import org.onap.portalsdk.core.domain.support.DomainVo;
import com.fasterxml.jackson.annotation.JsonInclude;
@@ -54,6 +59,9 @@ import com.fasterxml.jackson.annotation.JsonInclude;
@Entity
@Table(name="fn_common_widget_data")
@JsonInclude(JsonInclude.Include.NON_NULL)
+@NoArgsConstructor
+@Getter
+@Setter
public class CommonWidget extends DomainVo{
private static final long serialVersionUID = 7897021982887364557L;
@@ -64,22 +72,28 @@ public class CommonWidget extends DomainVo{
private Long id;
@Column(name = "category")
+ @Size(max = 32)
@SafeHtml
public String category;
@Column(name = "href")
+ @Size(max = 512)
@SafeHtml
public String href;
@Column(name = "title")
+ @Size(max = 256)
@SafeHtml
public String title;
@Column(name = "content")
+ @Size(max = 4096)
@SafeHtml
public String content;
@Column(name = "event_date")
+ @Size(max = 10)
+ @Pattern(regexp = "([1-2][0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])")
@SafeHtml
public String eventDate;
@@ -87,10 +101,6 @@ public class CommonWidget extends DomainVo{
public Integer sortOrder;
- public CommonWidget(){
-
- }
-
public CommonWidget(String category, String href, String title, String content, String eventDate, Integer sortOrder){
this.category = category;
this.href = href;
@@ -100,63 +110,4 @@ public class CommonWidget extends DomainVo{
this.sortOrder = sortOrder;
}
- public String getCategory() {
- return category;
- }
-
- public void setCategory(String category) {
- this.category = category;
- }
-
- public String getHref() {
- return href;
- }
-
- public void setHref(String href) {
- this.href = href;
- }
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public Integer getSortOrder() {
- return sortOrder;
- }
-
- public void setSortOrder(Integer sortOrder) {
- this.sortOrder = sortOrder;
- }
-
- public static long getSerialversionuid() {
- return serialVersionUID;
- }
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getContent() {
- return content;
- }
-
- public void setContent(String content) {
- this.content = content;
- }
-
- public String getEventDate() {
- return eventDate;
- }
-
- public void setEventDate(String eventDate) {
- this.eventDate = eventDate;
- }
}