Java 17 Upgrade
[policy/models.git] / models-tosca / src / main / java / org / onap / policy / models / tosca / simple / concepts / JpaToscaCapabilityType.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * Copyright (C) 2020, 2023 Nordix Foundation.
4  * Modifications Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
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  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  * SPDX-License-Identifier: Apache-2.0
19  * ============LICENSE_END=========================================================
20  */
21
22 package org.onap.policy.models.tosca.simple.concepts;
23
24 import jakarta.persistence.Entity;
25 import jakarta.persistence.Inheritance;
26 import jakarta.persistence.InheritanceType;
27 import jakarta.persistence.Table;
28 import java.io.Serial;
29 import lombok.Data;
30 import lombok.EqualsAndHashCode;
31 import lombok.NoArgsConstructor;
32 import lombok.NonNull;
33 import org.onap.policy.common.parameters.BeanValidationResult;
34 import org.onap.policy.models.base.PfConceptKey;
35 import org.onap.policy.models.tosca.authorative.concepts.ToscaCapabilityType;
36
37 /**
38  * Class to represent the capability type in TOSCA definition.
39  */
40
41 @Entity
42 @Table(name = "ToscaCapabilityType")
43 @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
44 @Data
45 @EqualsAndHashCode(callSuper = true)
46 @NoArgsConstructor
47 public class JpaToscaCapabilityType extends JpaToscaWithToscaProperties<ToscaCapabilityType> {
48     @Serial
49     private static final long serialVersionUID = -563659852901842616L;
50
51     /**
52      * The Key Constructor creates a {@link JpaToscaCapabilityType} object with the given concept key.
53      *
54      * @param key the key
55      */
56     public JpaToscaCapabilityType(@NonNull final PfConceptKey key) {
57         super(key);
58     }
59
60     /**
61      * Copy constructor.
62      *
63      * @param copyConcept the concept to copy from
64      */
65     public JpaToscaCapabilityType(final JpaToscaCapabilityType copyConcept) {
66         super(copyConcept);
67     }
68
69     /**
70      * Authorative constructor.
71      *
72      * @param authorativeConcept the authorative concept to copy from
73      */
74     public JpaToscaCapabilityType(final ToscaCapabilityType authorativeConcept) {
75         super(authorativeConcept);
76     }
77
78     @Override
79     public ToscaCapabilityType toAuthorative() {
80         super.setToscaEntity(new ToscaCapabilityType());
81         return super.toAuthorative();
82     }
83
84     @Override
85     public BeanValidationResult validate(@NonNull String fieldName) {
86         return validateWithKey(fieldName);
87     }
88 }