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;
46 import javax.persistence.CascadeType;
47 import javax.persistence.Column;
48 import javax.persistence.Embeddable;
49 import javax.persistence.Entity;
50 import javax.persistence.FetchType;
51 import javax.persistence.Id;
52 import javax.persistence.Index;
53 import javax.persistence.OneToMany;
54 import javax.persistence.Table;
55 import javax.validation.constraints.Digits;
56 import javax.validation.constraints.FutureOrPresent;
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;
64 import lombok.NoArgsConstructor;
66 import org.hibernate.validator.constraints.SafeHtml;
70 CREATE TABLE `cr_report` (
71 `rep_id` decimal(11,0) NOT NULL,
72 `title` varchar(100) NOT NULL,
73 `descr` varchar(255) DEFAULT NULL,
74 `public_yn` varchar(1) NOT NULL DEFAULT 'n',
75 `report_xml` text DEFAULT NULL,
76 `create_id` decimal(11,0) DEFAULT NULL,
77 `create_date` timestamp NOT NULL DEFAULT current_timestamp(),
78 `maint_id` decimal(11,0) DEFAULT NULL,
79 `maint_date` timestamp NOT NULL DEFAULT current_timestamp(),
80 `menu_id` varchar(500) DEFAULT NULL,
81 `menu_approved_yn` varchar(1) NOT NULL DEFAULT 'n',
82 `owner_id` decimal(11,0) DEFAULT NULL,
83 `folder_id` int(11) DEFAULT 0,
84 `dashboard_type_yn` varchar(1) DEFAULT 'n',
85 `dashboard_yn` varchar(1) DEFAULT 'n',
86 PRIMARY KEY (`rep_id`),
87 KEY `cr_report_create_idpublic_yntitle` (`create_id`,`public_yn`,`title`) USING BTREE
92 @Table(name = "cr_report", indexes = {
93 @Index(name = "cr_report_create_idpublic_yntitle", columnList = "create_id, public_yn, title")
102 public class CrReport implements Serializable {
104 @Column(name = "rep_id", length = 11, nullable = false)
105 @Digits(integer = 11, fraction = 0)
108 @Column(name = "title", length = 100, nullable = false)
112 private String title;
113 @Column(name = "descr", columnDefinition = "varchar(255) DEFAULT NULL")
116 private String descr;
117 @Column(name = "public_yn", nullable = false, length = 1, columnDefinition = "character varying(1) default 'n'")
118 @Pattern(regexp = "[YNyn]")
122 private String publicYn;
123 @Column(name = "report_xml", columnDefinition = "text DEFAULT NULL")
124 private String reportXml;
125 @Column(name = "create_id", columnDefinition = "decimal(11,0) DEFAULT NULL")
126 @Digits(integer = 11, fraction = 0)
128 private Long createId;
129 @Column(name = "create_date", nullable = false, columnDefinition = "timestamp DEFAULT current_timestamp()")
132 protected LocalDateTime createDate;
133 @Column(name = "maint_id", columnDefinition = "decimal(11,0) DEFAULT NULL")
134 @Digits(integer = 11, fraction = 0)
135 private Long maintId;
136 @Column(name = "maint_date", nullable = false, columnDefinition = "timestamp DEFAULT current_timestamp()")
139 protected LocalDateTime maintDate;
140 @Column(name = "menu_id", length = 500, columnDefinition = "varchar(500) DEFAULT NULL")
143 private String menuId;
144 @Column(name = "menu_approved_yn", nullable = false, length = 1, columnDefinition = "character varying(1) default 'n'")
145 @Pattern(regexp = "[YNyn]")
149 private String menuApprovedYn;
150 @Column(name = "owner_id", columnDefinition = "decimal(11,0) DEFAULT NULL")
151 @Digits(integer = 11, fraction = 0)
152 private Long ownerId;
153 @Column(name = "folder_id", length = 11, columnDefinition = "int(11) DEFAULT 0")
154 @Digits(integer = 11, fraction = 0)
156 private Integer folderId;
157 @Column(name = "dashboard_type_yn", length = 1, columnDefinition = "character varying(1) default 'n'")
158 @Pattern(regexp = "[YNyn]")
161 private String dashboardTypeYn;
162 @Column(name = "dashboard_yn", length = 1, columnDefinition = "character varying(1) default 'n'")
163 @Pattern(regexp = "[YNyn]")
166 private String dashboardYn;
169 @Digits(integer = 11, fraction = 0) @Positive Long repId,
170 @Size(max = 100) @SafeHtml @NotNull String title,
171 @Size(max = 255) @SafeHtml String descr,
172 @Pattern(regexp = "[YNyn]") @Size(max = 1) @SafeHtml @NotNull String publicYn,
173 @SafeHtml String reportXml,
174 @Digits(integer = 11, fraction = 0) @Positive Long createId,
175 @FutureOrPresent @NotNull LocalDateTime createDate,
176 @Digits(integer = 11, fraction = 0) Long maintId,
177 @FutureOrPresent @NotNull LocalDateTime maintDate,
178 @Size(max = 500) @SafeHtml String menuId,
179 @Pattern(regexp = "[YNyn]") @Size(max = 1) @SafeHtml @NotNull String menuApprovedYn,
180 @Digits(integer = 11, fraction = 0) Long ownerId,
181 @Digits(integer = 11, fraction = 0) @Positive Integer folderId,
182 @Pattern(regexp = "[YNyn]") @Size(max = 1) @SafeHtml String dashboardTypeYn,
183 @Pattern(regexp = "[YNyn]") @Size(max = 1) @SafeHtml String dashboardYn) {
187 this.publicYn = publicYn;
188 this.reportXml = reportXml;
189 this.createId = createId;
190 this.createDate = createDate;
191 this.maintId = maintId;
192 this.maintDate = maintDate;
193 this.menuId = menuId;
194 this.menuApprovedYn = menuApprovedYn;
195 this.ownerId = ownerId;
196 this.folderId = folderId;
197 this.dashboardTypeYn = dashboardTypeYn;
198 this.dashboardYn = dashboardYn;
202 targetEntity = CrReportSchedule.class,
204 cascade = CascadeType.ALL,
205 fetch = FetchType.LAZY
207 private Set<CrReportSchedule> crReportSchedules;
209 targetEntity = CrReportAccess.class,
211 cascade = CascadeType.ALL,
212 fetch = FetchType.LAZY
214 private Set<CrReportAccess> crReportAccesses;
216 targetEntity = CrReportLog.class,
218 cascade = CascadeType.ALL,
219 fetch = FetchType.LAZY
221 private Set<CrReportLog> crReportLogs;
223 targetEntity = CrReportEmailSentLog.class,
225 cascade = CascadeType.ALL,
226 fetch = FetchType.LAZY
228 private Set<CrReportEmailSentLog> crReportEmailSentLogs;
230 targetEntity = CrReportFileHistory.class,
232 cascade = CascadeType.ALL,
233 fetch = FetchType.LAZY
235 private Set<CrReportFileHistory> crReportFileHistories;