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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * SPDX-License-Identifier: Apache-2.0
19 * ============LICENSE_END=========================================================
22 package org.onap.policy.models.tosca.simple.concepts;
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;
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.ToscaRelationshipType;
38 * Class to represent the relationship type in TOSCA definition.
42 @Table(name = "ToscaRelationshipType")
43 @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
45 @EqualsAndHashCode(callSuper = true)
47 public class JpaToscaRelationshipType extends JpaToscaWithToscaProperties<ToscaRelationshipType> {
49 private static final long serialVersionUID = -563659852901842616L;
52 * The Key Constructor creates a {@link JpaToscaRelationshipType} object with the given concept key.
56 public JpaToscaRelationshipType(@NonNull final PfConceptKey key) {
63 * @param copyConcept the concept to copy from
65 public JpaToscaRelationshipType(final JpaToscaRelationshipType copyConcept) {
70 * Authorative constructor.
72 * @param authorativeConcept the authorative concept to copy from
74 public JpaToscaRelationshipType(final ToscaRelationshipType authorativeConcept) {
75 super(authorativeConcept);
79 public ToscaRelationshipType toAuthorative() {
80 super.setToscaEntity(new ToscaRelationshipType());
81 return super.toAuthorative();
85 public BeanValidationResult validate(@NonNull String fieldName) {
86 return validateWithKey(fieldName);