Merge "CM Data Subscriptions PoC/Performance test fixes"
[cps.git] / cps-ri / src / main / java / org / onap / cps / spi / entities / AnchorEntity.java
1 /*
2  *  ============LICENSE_START=======================================================
3  *  Copyright (C) 2021 Pantheon.tech
4  *  Modifications Copyright (C) 2023 Nordix Foundation.
5  *  ================================================================================
6  *  Licensed under the Apache License, Version 2.0 (the "License");
7  *  you may not use this file except in compliance with the License.
8  *  You may obtain a copy of the License at
9  *
10  *        http://www.apache.org/licenses/LICENSE-2.0
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *
17  *  SPDX-License-Identifier: Apache-2.0
18  *  ============LICENSE_END=========================================================
19  */
20
21 package org.onap.cps.spi.entities;
22
23
24 import jakarta.persistence.Column;
25 import jakarta.persistence.Entity;
26 import jakarta.persistence.FetchType;
27 import jakarta.persistence.GeneratedValue;
28 import jakarta.persistence.GenerationType;
29 import jakarta.persistence.Id;
30 import jakarta.persistence.JoinColumn;
31 import jakarta.persistence.ManyToOne;
32 import jakarta.persistence.Table;
33 import jakarta.validation.constraints.NotNull;
34 import java.io.Serializable;
35 import lombok.AllArgsConstructor;
36 import lombok.Builder;
37 import lombok.EqualsAndHashCode;
38 import lombok.Getter;
39 import lombok.NoArgsConstructor;
40 import lombok.Setter;
41
42 /**
43  * Entity to store an anchor.
44  */
45 @Getter
46 @Setter
47 @NoArgsConstructor
48 @AllArgsConstructor
49 @Builder
50 @Entity
51 @Table(name = "anchor")
52 @EqualsAndHashCode(onlyExplicitlyIncluded = true)
53 public class AnchorEntity implements Serializable {
54
55     private static final long serialVersionUID = -8049987915308262518L;
56
57     @Id
58     @GeneratedValue(strategy = GenerationType.IDENTITY)
59     private Long id;
60
61     @NotNull
62     @Column
63     @EqualsAndHashCode.Include
64     private String name;
65
66     @NotNull
67     @ManyToOne(fetch = FetchType.LAZY)
68     @JoinColumn(name = "schema_set_id")
69     private SchemaSetEntity schemaSet;
70
71     @NotNull
72     @ManyToOne(fetch = FetchType.LAZY)
73     @JoinColumn(name = "dataspace_id")
74     @EqualsAndHashCode.Include
75     private DataspaceEntity dataspace;
76 }