Transport DTO up
[portal.git] / portal-BE / src / main / java / org / onap / portal / domain / db / cr / CrReport.java
index 391dbb1..791518d 100644 (file)
@@ -42,8 +42,7 @@ package org.onap.portal.domain.db.cr;
 
 import java.io.Serializable;
 import java.time.LocalDateTime;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.Set;
 import javax.persistence.CascadeType;
 import javax.persistence.Column;
 import javax.persistence.Embeddable;
@@ -54,13 +53,13 @@ import javax.persistence.Index;
 import javax.persistence.OneToMany;
 import javax.persistence.Table;
 import javax.validation.constraints.Digits;
+import javax.validation.constraints.FutureOrPresent;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.PastOrPresent;
 import javax.validation.constraints.Pattern;
 import javax.validation.constraints.Positive;
 import javax.validation.constraints.Size;
 import lombok.AllArgsConstructor;
-import lombok.EqualsAndHashCode;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
@@ -95,13 +94,12 @@ CREATE TABLE `cr_report` (
 })
 @NoArgsConstructor
 @AllArgsConstructor
-@EqualsAndHashCode
+
 @Getter
 @Setter
 @Entity
 @Embeddable
 public class CrReport implements Serializable {
-
        @Id
        @Column(name = "rep_id", length = 11, nullable = false)
        @Digits(integer = 11, fraction = 0)
@@ -112,7 +110,7 @@ public class CrReport implements Serializable {
        @SafeHtml
        @NotNull
        private String title;
-       @Column(name = "descr", length = 255, columnDefinition = "varchar(255) DEFAULT NULL")
+       @Column(name = "descr", columnDefinition = "varchar(255) DEFAULT NULL")
        @Size(max = 255)
        @SafeHtml
        private String descr;
@@ -167,10 +165,22 @@ public class CrReport implements Serializable {
        @SafeHtml
        private String dashboardYn;
 
-       public CrReport(final Long repId, final String title, final String descr, final String publicYn,
-               final String reportXml, final Long createId, final LocalDateTime createDate, final Long maintId,
-               final LocalDateTime maintDate, final String menuId, final String menuApprovedYn, final Long ownerId,
-               final Integer folderId, final String dashboardTypeYn, final String dashboardYn) {
+       public CrReport(
+               @Digits(integer = 11, fraction = 0) @Positive Long repId,
+               @Size(max = 100) @SafeHtml @NotNull String title,
+               @Size(max = 255) @SafeHtml String descr,
+               @Pattern(regexp = "[YNyn]") @Size(max = 1) @SafeHtml @NotNull String publicYn,
+               @SafeHtml String reportXml,
+               @Digits(integer = 11, fraction = 0) @Positive Long createId,
+               @FutureOrPresent @NotNull LocalDateTime createDate,
+               @Digits(integer = 11, fraction = 0) Long maintId,
+               @FutureOrPresent @NotNull LocalDateTime maintDate,
+               @Size(max = 500) @SafeHtml String menuId,
+               @Pattern(regexp = "[YNyn]") @Size(max = 1) @SafeHtml @NotNull String menuApprovedYn,
+               @Digits(integer = 11, fraction = 0) Long ownerId,
+               @Digits(integer = 11, fraction = 0) @Positive Integer folderId,
+               @Pattern(regexp = "[YNyn]") @Size(max = 1) @SafeHtml String dashboardTypeYn,
+               @Pattern(regexp = "[YNyn]") @Size(max = 1) @SafeHtml String dashboardYn) {
               this.repId = repId;
               this.title = title;
               this.descr = descr;
@@ -194,34 +204,34 @@ public class CrReport implements Serializable {
                cascade = CascadeType.ALL,
                fetch = FetchType.LAZY
        )
-       private List<CrReportSchedule> crReportSchedules = new ArrayList<>();
+       private Set<CrReportSchedule> crReportSchedules;
        @OneToMany(
                targetEntity = CrReportAccess.class,
                mappedBy = "repId",
                cascade = CascadeType.ALL,
                fetch = FetchType.LAZY
        )
-       private List<CrReportAccess> crReportAccesses = new ArrayList<>();
+       private Set<CrReportAccess> crReportAccesses;
        @OneToMany(
                targetEntity = CrReportLog.class,
                mappedBy = "repId",
                cascade = CascadeType.ALL,
                fetch = FetchType.LAZY
        )
-       private List<CrReportLog> crReportLogs = new ArrayList<>();
+       private Set<CrReportLog> crReportLogs;
        @OneToMany(
                targetEntity = CrReportEmailSentLog.class,
                mappedBy = "repId",
                cascade = CascadeType.ALL,
                fetch = FetchType.LAZY
        )
-       private List<CrReportEmailSentLog> crReportEmailSentLogs = new ArrayList<>();
+       private Set<CrReportEmailSentLog> crReportEmailSentLogs;
        @OneToMany(
                targetEntity = CrReportFileHistory.class,
                mappedBy = "repId",
                cascade = CascadeType.ALL,
                fetch = FetchType.LAZY
        )
-       private List<CrReportFileHistory> crReportFileHistories = new ArrayList<>();
+       private Set<CrReportFileHistory> crReportFileHistories;
 
 }