X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=portal-BE%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fportal%2Fdomain%2Fdb%2Fep%2FEpMicroservice.java;h=69e28dc38ab5143c8d93019e0145d0596339bd2f;hb=ffd9af970318c1f5a0bad46d7aad5d4611414aae;hp=35e51be6d6896281d7e593d34aa3043d526ba868;hpb=7ce177cd99096772ff42ef89d8820070c687fd9b;p=portal.git diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpMicroservice.java b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpMicroservice.java index 35e51be6..69e28dc3 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpMicroservice.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/ep/EpMicroservice.java @@ -40,8 +40,8 @@ package org.onap.portal.domain.db.ep; -import java.util.ArrayList; -import java.util.List; +import java.io.Serializable; +import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -54,16 +54,17 @@ import javax.persistence.JoinColumn; import javax.persistence.ManyToMany; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.validation.Valid; import javax.validation.constraints.Digits; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; -import lombok.ToString; import org.hibernate.validator.constraints.SafeHtml; import org.hibernate.validator.constraints.URL; import org.onap.portal.domain.db.fn.FnApp; @@ -90,11 +91,11 @@ CREATE TABLE `ep_microservice` ( }) @NoArgsConstructor @AllArgsConstructor -@ToString +@Builder @Getter @Setter @Entity -public class EpMicroservice { +public class EpMicroservice implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id", length = 11, nullable = false) @@ -108,8 +109,8 @@ public class EpMicroservice { @Size(max = 50) @SafeHtml private String description; - @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) - @JoinColumn(name = "app_Id") + @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.MERGE) + @JoinColumn(name = "app_Id", columnDefinition = "bigint") @Valid private FnApp appId; @Column(name = "endpoint_url", length = 200) @@ -130,20 +131,17 @@ public class EpMicroservice { @Size(max = 50) @SafeHtml private String password; - @Column(name = "active", length = 1, columnDefinition = "CHAR(1) DEFAULT 'Y'") - @Pattern(regexp = "[YNyn]") - @Size(max = 1) - @SafeHtml - private String active; - @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) - private List epWidgetCatalogList = new ArrayList<>(); + @Column(name = "active", length = 1, columnDefinition = "boolean DEFAULT true") + private Boolean active = true; + @ManyToMany(cascade = CascadeType.MERGE, fetch = FetchType.LAZY) + private Set epWidgetCatalogList; @OneToMany( targetEntity = EpMicroserviceParameter.class, mappedBy = "serviceId", - cascade = CascadeType.ALL, + cascade = CascadeType.MERGE, fetch = FetchType.LAZY ) - private List epMicroserviceParameters = new ArrayList<>(); + private Set epMicroserviceParameters; public void copyOf(final EpMicroservice epMicroservice) { this.id = epMicroservice.getId();