From 91346e516f078aff100c0df25621f09950118150 Mon Sep 17 00:00:00 2001 From: Dominik Mizyn Date: Fri, 14 Jun 2019 11:43:33 +0200 Subject: MicroserviceParameter class DB constraints Java Bean Validation SR 380 annotations added to classes Issue-ID: PORTAL-635 Change-Id: Idcca0d46d1779d5fae874aff38cfd7f59f73c9b0 Signed-off-by: Dominik Mizyn --- .../widget/domain/MicroserviceParameter.java | 45 +++++++--------------- 1 file changed, 13 insertions(+), 32 deletions(-) (limited to 'ecomp-portal-widget-ms/widget-ms/src') diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/MicroserviceParameter.java b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/MicroserviceParameter.java index d95d46c6..7207d0ae 100644 --- a/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/MicroserviceParameter.java +++ b/ecomp-portal-widget-ms/widget-ms/src/main/java/org/onap/portalapp/widget/domain/MicroserviceParameter.java @@ -6,6 +6,11 @@ import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; +import javax.validation.constraints.Digits; +import javax.validation.constraints.Size; +import lombok.Getter; +import lombok.Setter; +import org.hibernate.validator.constraints.SafeHtml; /** * TODO: moved all microservice-related code (domain, controller, service) @@ -13,54 +18,30 @@ import javax.persistence.Table; */ @Entity @Table(name="EP_MICROSERVICE_PARAMETER") +@Getter +@Setter public class MicroserviceParameter { @Id @Column(name = "id") @GeneratedValue(strategy=GenerationType.AUTO) + @Digits(integer = 11, fraction = 0) private Long id; @Column(name = "service_id") + @Digits(integer = 11, fraction = 0) private long serviceId; @Column(name = "para_key") + @Size(max = 50) + @SafeHtml private String para_key; @Column(name = "para_value") + @Size(max = 50) + @SafeHtml private String para_value; - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public long getServiceId() { - return serviceId; - } - - public void setServiceId(long serviceId) { - this.serviceId = serviceId; - } - - public String getPara_key() { - return para_key; - } - - public void setPara_key(String para_key) { - this.para_key = para_key; - } - - public String getPara_value() { - return para_value; - } - - public void setPara_value(String para_value) { - this.para_value = para_value; - } - @Override public String toString() { return "MicroserviceParameter [serviceId=" + serviceId + ", para_key=" + para_key + ", para_value=" + para_value -- cgit 1.2.3-korg