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.Id;
51 import javax.persistence.Index;
52 import javax.persistence.JoinColumn;
53 import javax.persistence.JoinTable;
54 import javax.persistence.ManyToMany;
55 import javax.persistence.ManyToOne;
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;
69 import org.hibernate.validator.constraints.URL;
70 import org.onap.portal.domain.db.fn.FnUser;
73 CREATE TABLE `cr_report_file_history` (
74 `hist_id` int(11) NOT NULL,
75 `sched_user_id` decimal(11,0) NOT NULL,
76 `schedule_id` decimal(11,0) NOT NULL,
77 `user_id` decimal(11,0) NOT NULL,
78 `rep_id` decimal(11,0) DEFAULT NULL,
79 `run_date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
80 `recurrence` varchar(50) DEFAULT NULL,
81 `file_type_id` decimal(2,0) DEFAULT NULL,
82 `file_name` varchar(80) DEFAULT NULL,
83 `file_blob` blob DEFAULT NULL,
84 `file_size` decimal(11,0) DEFAULT NULL,
85 `raptor_url` varchar(4000) DEFAULT NULL,
86 `error_yn` char(1) DEFAULT 'n',
87 `error_code` decimal(11,0) DEFAULT NULL,
88 `deleted_yn` char(1) DEFAULT 'n',
89 `deleted_by` decimal(38,0) DEFAULT NULL,
90 PRIMARY KEY (`hist_id`),
91 KEY `sys_c0014614` (`file_type_id`),
92 KEY `sys_c0014615` (`rep_id`),
93 CONSTRAINT `sys_c0014614` FOREIGN KEY (`file_type_id`) REFERENCES `cr_lu_file_type` (`lookup_id`),
94 CONSTRAINT `sys_c0014615` FOREIGN KEY (`rep_id`) REFERENCES `cr_report` (`rep_id`)
98 @Table(name = "cr_report_file_history", indexes = {
99 @Index(name = "sys_c0014617", columnList = "user_id"),
100 @Index(name = "sys_c0014614", columnList = "file_type_id"),
101 @Index(name = "sys_c0014615", columnList = "rep_id")
108 public class CrReportFileHistory {
110 @Column(name = "hist_id", nullable = false, length = 11)
111 @Digits(integer = 11, fraction = 0)
113 @Column(name = "sched_user_id", nullable = false)
114 @Digits(integer = 11, fraction = 0)
116 private Long schedUserId;
117 @Column(name = "schedule_id", nullable = false)
118 @Digits(integer = 11, fraction = 0)
120 private Long scheduleId;
121 @Column(name = "user_id", nullable = false)
122 @Digits(integer = 11, fraction = 0)
125 @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
126 @JoinColumn(name = "rep_id")
128 private CrReport repId;
129 @Column(name = "run_date", nullable = false, columnDefinition = "datetime DEFAULT current_timestamp() ON UPDATE current_timestamp()")
131 private LocalDateTime runDate;
132 @Column(name = "recurrence", length = 50, columnDefinition = "varchar(50) DEFAULT NULL")
135 private String recurrence;
136 @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
137 @JoinColumn(name = "file_type_id")
139 private CrLuFileType fileTypeId;
140 @Column(name = "file_name", length = 80, columnDefinition = "varchar(80) DEFAULT NULL")
143 private String fileName;
144 @Column(name = "file_blob", columnDefinition = "blob DEFAULT NULL")
145 private byte[] fileBlob;
146 @Column(name = "file_size", columnDefinition = "decimal(11,0) DEFAULT NULL")
147 @Digits(integer = 11, fraction = 0)
149 private Long file_size;
152 @Column(name = "raptor_url", length = 4000)
155 private String raptorUrl;
156 @Column(name = "error_yn", length = 1, columnDefinition = "character(1) default 'n'")
157 @Pattern(regexp = "[YNyn]")
160 private String errorYn;
161 @Column(name = "error_code", columnDefinition = "decimal(11,0) DEFAULT NULL")
162 @Digits(integer = 11, fraction = 0)
163 private Long errorCode;
164 @Column(name = "deleted_yn", length = 1, columnDefinition = "character(1) default 'n'")
165 @Pattern(regexp = "[YNyn]")
168 private String deletedYn;
169 @Column(name = "deleted_by", columnDefinition = "decimal(38,0) DEFAULT NULL")
170 @Digits(integer = 38, fraction = 0)
171 private Long deletedBy;
173 @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
175 name = "cr_hist_user_map",
176 joinColumns = {@JoinColumn(name = "hist_id", referencedColumnName = "hist_id")},
177 inverseJoinColumns = {@JoinColumn(name = "user_id", referencedColumnName = "user_id")}
179 private List<FnUser> fnUserList = new ArrayList<>();