PersUserWidgetServiceAOP and tests up
[portal.git] / portal-BE / src / main / java / org / onap / portal / domain / db / ep / EpWidgetCatalog.java
index a19af28..cd906cf 100644 (file)
@@ -57,9 +57,9 @@ import javax.persistence.OneToMany;
 import javax.persistence.Table;
 import javax.validation.constraints.Digits;
 import javax.validation.constraints.NotNull;
-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;
@@ -83,17 +83,17 @@ CREATE TABLE `ep_widget_catalog` (
 @Getter
 @Setter
 @Entity
+@Builder
 public class EpWidgetCatalog implements Serializable {
        @Id
        @GeneratedValue(strategy = GenerationType.AUTO)
-       @Column(name = "widget_id", length = 11, nullable = false)
-       @Digits(integer = 11, fraction = 0)
+       @Column(name = "widget_id", nullable = false)
        private Long widgetId;
        @Column(name = "wdg_name", length = 100, columnDefinition = "varchar(100) default '?'", nullable = false)
        @Size(max = 100)
        @NotNull
        @SafeHtml
-       private String wdgName;
+       private String wdgName = "?";
        @Column(name = "service_id", length = 11)
        @Digits(integer = 11, fraction = 0)
        private Long serviceId;
@@ -105,14 +105,11 @@ public class EpWidgetCatalog implements Serializable {
        @Size(max = 256)
        @NotNull
        @SafeHtml
-       private String wdgFileLoc;
-       @Column(name = "all_user_flag", length = 1, columnDefinition = "char(1) not null default 'N'", nullable = false)
-       @Pattern(regexp = "[YNyn]")
-       @Size(max = 1)
-       @SafeHtml
+       private String wdgFileLoc = "?";
+       @Column(name = "all_user_flag", length = 1, columnDefinition = "boolean default false", nullable = false)
        @NotNull
-       private String allUserFlag;
-       @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+       private Boolean allUserFlag = false;
+       @ManyToMany(cascade = CascadeType.MERGE, fetch = FetchType.LAZY)
        @JoinTable(
                name = "ep_widget_microservice",
                joinColumns = {@JoinColumn(name = "widget_id", referencedColumnName = "widget_id")},
@@ -126,35 +123,35 @@ public class EpWidgetCatalog implements Serializable {
        @OneToMany(
                targetEntity = EpWidgetCatalogRole.class,
                mappedBy = "widgetId",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<EpWidgetCatalogRole> widgetCatalogRoles;
        @OneToMany(
                targetEntity = EpPersUserWidgetSel.class,
                mappedBy = "widgetId",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<EpPersUserWidgetSel> epPersUserWidgetSels;
        @OneToMany(
                targetEntity = EpPersUserWidgetSel.class,
                mappedBy = "widgetId",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<EpPersUserWidgetSel> persUserWidgetSels;
        @OneToMany(
                targetEntity = EpPersUserWidgetPlacement.class,
                mappedBy = "widgetId",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<EpPersUserWidgetPlacement> epPersUserWidgetPlacements;
        @OneToMany(
                targetEntity = EpWidgetCatalogParameter.class,
                mappedBy = "widgetId",
-               cascade = CascadeType.ALL,
+               cascade = CascadeType.MERGE,
                fetch = FetchType.LAZY
        )
        private Set<EpWidgetCatalogParameter> epWidgetCatalogParameters;