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.time.LocalDateTime;
44 import java.util.ArrayList;
45 import java.util.List;
46 import javax.persistence.CascadeType;
47 import javax.persistence.Column;
48 import javax.persistence.Entity;
49 import javax.persistence.FetchType;
50 import javax.persistence.GeneratedValue;
51 import javax.persistence.GenerationType;
52 import javax.persistence.Id;
53 import javax.persistence.JoinColumn;
54 import javax.persistence.ManyToOne;
55 import javax.persistence.OneToMany;
56 import javax.persistence.Table;
57 import javax.validation.Valid;
58 import javax.validation.constraints.Digits;
59 import javax.validation.constraints.FutureOrPresent;
60 import javax.validation.constraints.NotNull;
61 import javax.validation.constraints.Pattern;
62 import javax.validation.constraints.Positive;
63 import javax.validation.constraints.Size;
64 import lombok.AllArgsConstructor;
66 import lombok.NoArgsConstructor;
68 import org.hibernate.validator.constraints.SafeHtml;
71 CREATE TABLE `cr_report_schedule` (
72 `schedule_id` decimal(11,0) NOT NULL,
73 `sched_user_id` decimal(11,0) NOT NULL,
74 `rep_id` decimal(11,0) NOT NULL,
75 `enabled_yn` varchar(1) NOT NULL,
76 `start_date` timestamp NOT NULL DEFAULT current_timestamp(),
77 `end_date` timestamp NOT NULL DEFAULT current_timestamp(),
78 `run_date` timestamp NOT NULL DEFAULT current_timestamp(),
79 `recurrence` varchar(50) DEFAULT NULL,
80 `conditional_yn` varchar(1) NOT NULL,
81 `condition_sql` varchar(4000) DEFAULT NULL,
82 `notify_type` int(11) DEFAULT 0,
83 `max_row` int(11) DEFAULT 1000,
84 `initial_formfields` varchar(3500) DEFAULT NULL,
85 `processed_formfields` varchar(3500) DEFAULT NULL,
86 `formfields` varchar(3500) DEFAULT NULL,
87 `condition_large_sql` text DEFAULT NULL,
88 `encrypt_yn` char(1) DEFAULT 'n',
89 `attachment_yn` char(1) DEFAULT 'y',
90 PRIMARY KEY (`schedule_id`),
91 KEY `fk_cr_repor_ref_14707_cr_repor` (`rep_id`),
92 CONSTRAINT `fk_cr_repor_ref_14707_cr_repor` FOREIGN KEY (`rep_id`) REFERENCES `cr_report` (`rep_id`)
97 @Table(name = "cr_report_schedule")
103 public class CrReportSchedule {
105 @GeneratedValue(strategy = GenerationType.AUTO)
106 @Column(name = "schedule_id", length = 11, nullable = false)
107 @Digits(integer = 11, fraction = 0)
109 private Long scheduleId;
110 @Column(name = "sched_user_id", length = 11, nullable = false)
111 @Digits(integer = 11, fraction = 0)
114 private Long schedUserId;
115 @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
116 @JoinColumn(name = "rep_id", nullable = false)
119 private CrReport repId;
120 @Column(name = "enabled_yn", length = 1, nullable = false)
121 @Pattern(regexp = "[YNyn]")
125 private String enabledYn;
126 @Column(name = "start_date", nullable = false, columnDefinition = "datetime DEFAULT current_timestamp()")
129 private LocalDateTime startDate;
130 @Column(name = "end_date", nullable = false, columnDefinition = "datetime DEFAULT current_timestamp()")
133 private LocalDateTime endDate;
134 @Column(name = "run_date", nullable = false, columnDefinition = "datetime DEFAULT current_timestamp()")
137 private LocalDateTime runDate;
138 @Column(name = "recurrence_", length = 50, columnDefinition = "varchar(50) DEFAULT NULL")
141 private String recurrence;
142 @Column(name = "conditional_yn", length = 1, nullable = false)
143 @Pattern(regexp = "[YNyn]")
147 private String conditionalYn;
148 @Column(name = "condition_sql", length = 4000, columnDefinition = "varchar(4000) DEFAULT NULL")
151 private String conditionSql;
152 @Column(name = "notify_type", columnDefinition = "int(11) DEFAULT 0")
153 private Integer notifyType;
154 @Column(name = "max_row", columnDefinition = "integer default 1000")
155 private Integer max_row;
156 @Column(name = "initial_formfields", length = 3500, columnDefinition = "varchar(3500) DEFAULT NULL")
159 private String initialFormfields;
160 @Column(name = "processed_formfields", length = 3500, columnDefinition = "varchar(3500) DEFAULT NULL")
163 private String processedFormfields;
164 @Column(name = "formfields", length = 3500, columnDefinition = "varchar(3500) DEFAULT NULL")
167 private String formfields;
168 @Column(name = "condition_large_sql", length = 65535, columnDefinition = "text DEFAULT NULL")
169 private String conditionLargeSql;
170 @Column(name = "encrypt_yn", length = 1, columnDefinition = "character(1) default 'n'")
171 @Pattern(regexp = "[YNyn]")
174 private String encryptYn;
175 @Column(name = "attachment_yn", length = 1, columnDefinition = "character(1) default 'y'")
176 @Pattern(regexp = "[YNyn]")
179 private String attachmentYn;
181 targetEntity = CrReportScheduleUsers.class,
182 mappedBy = "scheduleId",
183 cascade = CascadeType.ALL,
184 fetch = FetchType.LAZY
186 private List<CrReportScheduleUsers> crReportScheduleUsers = new ArrayList<>();