2 * ============LICENSE_START==========================================
4 * ===================================================================
5 * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
6 * ===================================================================
7 * Modifications Copyright (c) 2019 Samsung
8 * ===================================================================
10 * Unless otherwise specified, all software contained herein is licensed
11 * under the Apache License, Version 2.0 (the "License");
12 * you may not use this software except in compliance with the License.
13 * You may obtain a copy of the License at
15 * http://www.apache.org/licenses/LICENSE-2.0
17 * Unless required by applicable law or agreed to in writing, software
18 * distributed under the License is distributed on an "AS IS" BASIS,
19 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 * See the License for the specific language governing permissions and
21 * limitations under the License.
23 * Unless otherwise specified, all documentation contained herein is licensed
24 * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
25 * you may not use this documentation except in compliance with the License.
26 * You may obtain a copy of the License at
28 * https://creativecommons.org/licenses/by/4.0/
30 * Unless required by applicable law or agreed to in writing, documentation
31 * distributed under the License is distributed on an "AS IS" BASIS,
32 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
33 * See the License for the specific language governing permissions and
34 * limitations under the License.
36 * ============LICENSE_END============================================
41 package org.onap.portal.domain.db.cr;
43 import java.io.Serializable;
44 import java.time.LocalDateTime;
45 import java.util.ArrayList;
46 import java.util.List;
47 import javax.persistence.CascadeType;
48 import javax.persistence.Column;
49 import javax.persistence.Embeddable;
50 import javax.persistence.Entity;
51 import javax.persistence.FetchType;
52 import javax.persistence.Id;
53 import javax.persistence.Index;
54 import javax.persistence.OneToMany;
55 import javax.persistence.Table;
56 import javax.validation.constraints.Digits;
57 import javax.validation.constraints.NotNull;
58 import javax.validation.constraints.PastOrPresent;
59 import javax.validation.constraints.Pattern;
60 import javax.validation.constraints.Positive;
61 import javax.validation.constraints.Size;
62 import lombok.AllArgsConstructor;
63 import lombok.EqualsAndHashCode;
65 import lombok.NoArgsConstructor;
67 import org.hibernate.validator.constraints.SafeHtml;
71 CREATE TABLE `cr_report` (
72 `rep_id` decimal(11,0) NOT NULL,
73 `title` varchar(100) NOT NULL,
74 `descr` varchar(255) DEFAULT NULL,
75 `public_yn` varchar(1) NOT NULL DEFAULT 'n',
76 `report_xml` text DEFAULT NULL,
77 `create_id` decimal(11,0) DEFAULT NULL,
78 `create_date` timestamp NOT NULL DEFAULT current_timestamp(),
79 `maint_id` decimal(11,0) DEFAULT NULL,
80 `maint_date` timestamp NOT NULL DEFAULT current_timestamp(),
81 `menu_id` varchar(500) DEFAULT NULL,
82 `menu_approved_yn` varchar(1) NOT NULL DEFAULT 'n',
83 `owner_id` decimal(11,0) DEFAULT NULL,
84 `folder_id` int(11) DEFAULT 0,
85 `dashboard_type_yn` varchar(1) DEFAULT 'n',
86 `dashboard_yn` varchar(1) DEFAULT 'n',
87 PRIMARY KEY (`rep_id`),
88 KEY `cr_report_create_idpublic_yntitle` (`create_id`,`public_yn`,`title`) USING BTREE
93 @Table(name = "cr_report", indexes = {
94 @Index(name = "cr_report_create_idpublic_yntitle", columnList = "create_id, public_yn, title")
103 public class CrReport implements Serializable {
106 @Column(name = "rep_id", length = 11, nullable = false)
107 @Digits(integer = 11, fraction = 0)
110 @Column(name = "title", length = 100, nullable = false)
114 private String title;
115 @Column(name = "descr", length = 255, columnDefinition = "varchar(255) DEFAULT NULL")
118 private String descr;
119 @Column(name = "public_yn", nullable = false, length = 1, columnDefinition = "character varying(1) default 'n'")
120 @Pattern(regexp = "[YNyn]")
124 private String publicYn;
125 @Column(name = "report_xml", columnDefinition = "text DEFAULT NULL")
126 private String reportXml;
127 @Column(name = "create_id", columnDefinition = "decimal(11,0) DEFAULT NULL")
128 @Digits(integer = 11, fraction = 0)
130 private Long createId;
131 @Column(name = "create_date", nullable = false, columnDefinition = "timestamp DEFAULT current_timestamp()")
134 protected LocalDateTime createDate;
135 @Column(name = "maint_id", columnDefinition = "decimal(11,0) DEFAULT NULL")
136 @Digits(integer = 11, fraction = 0)
137 private Long maintId;
138 @Column(name = "maint_date", nullable = false, columnDefinition = "timestamp DEFAULT current_timestamp()")
141 protected LocalDateTime maintDate;
142 @Column(name = "menu_id", length = 500, columnDefinition = "varchar(500) DEFAULT NULL")
145 private String menuId;
146 @Column(name = "menu_approved_yn", nullable = false, length = 1, columnDefinition = "character varying(1) default 'n'")
147 @Pattern(regexp = "[YNyn]")
151 private String menuApprovedYn;
152 @Column(name = "owner_id", columnDefinition = "decimal(11,0) DEFAULT NULL")
153 @Digits(integer = 11, fraction = 0)
154 private Long ownerId;
155 @Column(name = "folder_id", length = 11, columnDefinition = "int(11) DEFAULT 0")
156 @Digits(integer = 11, fraction = 0)
158 private Integer folderId;
159 @Column(name = "dashboard_type_yn", length = 1, columnDefinition = "character varying(1) default 'n'")
160 @Pattern(regexp = "[YNyn]")
163 private String dashboardTypeYn;
164 @Column(name = "dashboard_yn", length = 1, columnDefinition = "character varying(1) default 'n'")
165 @Pattern(regexp = "[YNyn]")
168 private String dashboardYn;
170 public CrReport(final Long repId, final String title, final String descr, final String publicYn,
171 final String reportXml, final Long createId, final LocalDateTime createDate, final Long maintId,
172 final LocalDateTime maintDate, final String menuId, final String menuApprovedYn, final Long ownerId,
173 final Integer folderId, final String dashboardTypeYn, final String dashboardYn) {
177 this.publicYn = publicYn;
178 this.reportXml = reportXml;
179 this.createId = createId;
180 this.createDate = createDate;
181 this.maintId = maintId;
182 this.maintDate = maintDate;
183 this.menuId = menuId;
184 this.menuApprovedYn = menuApprovedYn;
185 this.ownerId = ownerId;
186 this.folderId = folderId;
187 this.dashboardTypeYn = dashboardTypeYn;
188 this.dashboardYn = dashboardYn;
192 targetEntity = CrReportSchedule.class,
194 cascade = CascadeType.ALL,
195 fetch = FetchType.LAZY
197 private List<CrReportSchedule> crReportSchedules = new ArrayList<>();
199 targetEntity = CrReportAccess.class,
201 cascade = CascadeType.ALL,
202 fetch = FetchType.LAZY
204 private List<CrReportAccess> crReportAccesses = new ArrayList<>();
206 targetEntity = CrReportLog.class,
208 cascade = CascadeType.ALL,
209 fetch = FetchType.LAZY
211 private List<CrReportLog> crReportLogs = new ArrayList<>();
213 targetEntity = CrReportEmailSentLog.class,
215 cascade = CascadeType.ALL,
216 fetch = FetchType.LAZY
218 private List<CrReportEmailSentLog> crReportEmailSentLogs = new ArrayList<>();
220 targetEntity = CrReportFileHistory.class,
222 cascade = CascadeType.ALL,
223 fetch = FetchType.LAZY
225 private List<CrReportFileHistory> crReportFileHistories = new ArrayList<>();