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;
47 import javax.persistence.CascadeType;
48 import javax.persistence.Column;
49 import javax.persistence.Entity;
50 import javax.persistence.FetchType;
51 import javax.persistence.Id;
52 import javax.persistence.Index;
53 import javax.persistence.JoinColumn;
54 import javax.persistence.JoinTable;
55 import javax.persistence.ManyToMany;
56 import javax.persistence.ManyToOne;
57 import javax.persistence.Table;
58 import javax.validation.Valid;
59 import javax.validation.constraints.Digits;
60 import javax.validation.constraints.FutureOrPresent;
61 import javax.validation.constraints.NotNull;
62 import javax.validation.constraints.Pattern;
63 import javax.validation.constraints.Positive;
64 import javax.validation.constraints.Size;
65 import lombok.AllArgsConstructor;
67 import lombok.NoArgsConstructor;
69 import org.hibernate.validator.constraints.SafeHtml;
70 import org.hibernate.validator.constraints.URL;
71 import org.onap.portal.domain.db.fn.FnUser;
74 CREATE TABLE `cr_report_file_history` (
75 `hist_id` int(11) NOT NULL,
76 `sched_user_id` decimal(11,0) NOT NULL,
77 `schedule_id` decimal(11,0) NOT NULL,
78 `user_id` decimal(11,0) NOT NULL,
79 `rep_id` decimal(11,0) DEFAULT NULL,
80 `run_date` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
81 `recurrence` varchar(50) DEFAULT NULL,
82 `file_type_id` decimal(2,0) DEFAULT NULL,
83 `file_name` varchar(80) DEFAULT NULL,
84 `file_blob` blob DEFAULT NULL,
85 `file_size` decimal(11,0) DEFAULT NULL,
86 `raptor_url` varchar(4000) DEFAULT NULL,
87 `error_yn` char(1) DEFAULT 'n',
88 `error_code` decimal(11,0) DEFAULT NULL,
89 `deleted_yn` char(1) DEFAULT 'n',
90 `deleted_by` decimal(38,0) DEFAULT NULL,
91 PRIMARY KEY (`hist_id`),
92 KEY `sys_c0014614` (`file_type_id`),
93 KEY `sys_c0014615` (`rep_id`),
94 CONSTRAINT `sys_c0014614` FOREIGN KEY (`file_type_id`) REFERENCES `cr_lu_file_type` (`lookup_id`),
95 CONSTRAINT `sys_c0014615` FOREIGN KEY (`rep_id`) REFERENCES `cr_report` (`rep_id`)
99 @Table(name = "cr_report_file_history", indexes = {
100 @Index(name = "sys_c0014617", columnList = "user_id"),
101 @Index(name = "sys_c0014614", columnList = "file_type_id"),
102 @Index(name = "sys_c0014615", columnList = "rep_id")
109 public class CrReportFileHistory {
111 @Column(name = "hist_id", nullable = false, length = 11)
112 @Digits(integer = 11, fraction = 0)
114 @Column(name = "sched_user_id", nullable = false)
115 @Digits(integer = 11, fraction = 0)
117 private Long schedUserId;
118 @Column(name = "schedule_id", nullable = false)
119 @Digits(integer = 11, fraction = 0)
121 private Long scheduleId;
122 @Column(name = "user_id", nullable = false)
123 @Digits(integer = 11, fraction = 0)
126 @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
127 @JoinColumn(name = "rep_id")
129 private CrReport repId;
130 @Column(name = "run_date", nullable = false, columnDefinition = "datetime DEFAULT current_timestamp() ON UPDATE current_timestamp()")
132 private LocalDateTime runDate;
133 @Column(name = "recurrence", length = 50, columnDefinition = "varchar(50) DEFAULT NULL")
136 private String recurrence;
137 @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
138 @JoinColumn(name = "file_type_id")
140 private CrLuFileType fileTypeId;
141 @Column(name = "file_name", length = 80, columnDefinition = "varchar(80) DEFAULT NULL")
144 private String fileName;
145 @Column(name = "file_blob", columnDefinition = "blob DEFAULT NULL")
146 private byte[] fileBlob;
147 @Column(name = "file_size", columnDefinition = "decimal(11,0) DEFAULT NULL")
148 @Digits(integer = 11, fraction = 0)
150 private Long file_size;
153 @Column(name = "raptor_url", length = 4000)
156 private String raptorUrl;
157 @Column(name = "error_yn", length = 1, columnDefinition = "character(1) default 'n'")
158 @Pattern(regexp = "[YNyn]")
161 private String errorYn;
162 @Column(name = "error_code", columnDefinition = "decimal(11,0) DEFAULT NULL")
163 @Digits(integer = 11, fraction = 0)
164 private Long errorCode;
165 @Column(name = "deleted_yn", length = 1, columnDefinition = "character(1) default 'n'")
166 @Pattern(regexp = "[YNyn]")
169 private String deletedYn;
170 @Column(name = "deleted_by", columnDefinition = "decimal(38,0) DEFAULT NULL")
171 @Digits(integer = 38, fraction = 0)
172 private Long deletedBy;
174 @ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
176 name = "cr_hist_user_map",
177 joinColumns = {@JoinColumn(name = "hist_id", referencedColumnName = "hist_id")},
178 inverseJoinColumns = {@JoinColumn(name = "user_id", referencedColumnName = "user_id")}
180 private Set<FnUser> fnUserList;