Merge "Adding 'name' to yamls and json in model"
[policy/models.git] / models-tosca / src / main / java / org / onap / policy / models / tosca / simple / concepts / JpaToscaServiceTemplates.java
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2019 Nordix Foundation.
4  * ================================================================================
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
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.policy.models.tosca.simple.concepts;
22
23 import java.util.List;
24 import java.util.Map;
25 import java.util.TreeMap;
26
27 import javax.persistence.Entity;
28 import javax.persistence.Inheritance;
29 import javax.persistence.InheritanceType;
30 import javax.persistence.Table;
31
32 import lombok.Data;
33 import lombok.EqualsAndHashCode;
34
35 import org.onap.policy.models.base.PfConceptContainer;
36 import org.onap.policy.models.base.PfConceptKey;
37 import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
38
39 /**
40  * This class is a container for TOSCA service templates.
41  *
42  * @author Liam Fallon (liam.fallon@est.tech)
43  */
44 @Entity
45 @Table(name = "ToscaServiceTemplates")
46 @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
47 @Data
48 @EqualsAndHashCode(callSuper = true)
49 public class JpaToscaServiceTemplates extends PfConceptContainer<JpaToscaServiceTemplate, ToscaServiceTemplate> {
50     private static final long serialVersionUID = -3053257884307604114L;
51
52     /**
53      * The Default Constructor creates a {@link JpaToscaServiceTemplates} object with a null artifact key and creates an
54      * empty concept map.
55      */
56     public JpaToscaServiceTemplates() {
57         super(new PfConceptKey());
58     }
59
60     /**
61      * The Key Constructor creates a {@link JpaToscaServiceTemplates} object with the given artifact key and creates an
62      * empty concept map.
63      *
64      * @param key the concept key
65      */
66     public JpaToscaServiceTemplates(final PfConceptKey key) {
67         super(key, new TreeMap<PfConceptKey, JpaToscaServiceTemplate>());
68     }
69
70     /**
71      * This Constructor creates an concept container with all of its fields defined.
72      *
73      * @param key the concept container key
74      * @param conceptMap the concepts to be stored in the concept container
75      */
76     public JpaToscaServiceTemplates(final PfConceptKey key,
77             final Map<PfConceptKey, JpaToscaServiceTemplate> conceptMap) {
78         super(key, conceptMap);
79     }
80
81     /**
82      * Copy constructor.
83      *
84      * @param copyConcept the concept to copy from
85      */
86     public JpaToscaServiceTemplates(final JpaToscaServiceTemplates copyConcept) {
87         super(copyConcept);
88     }
89
90     /**
91      * Authorative constructor.
92      *
93      * @param authorativeConceptMapList the authorative concept to copy from
94      */
95     public JpaToscaServiceTemplates(final List<Map<String, ToscaServiceTemplate>> authorativeConceptMapList) {
96         this.fromAuthorative(authorativeConceptMapList);
97     }
98 }