[VID-6] Initial rebase push
[vid.git] / vid-app-common / src / main / java / org / openecomp / vid / asdc / beans / tosca / ToscaCsar.java
1 /*-\r
2  * ============LICENSE_START=======================================================
3  * VID
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");\r
8  * you may not use this file except in compliance with the License.\r
9  * You may obtain a copy of the License at\r
10  * \r
11  *      http://www.apache.org/licenses/LICENSE-2.0\r
12  * \r
13  * Unless required by applicable law or agreed to in writing, software\r
14  * distributed under the License is distributed on an "AS IS" BASIS,\r
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16  * See the License for the specific language governing permissions and\r
17  * limitations under the License.
18  * ============LICENSE_END=========================================================\r
19  */\r
20 \r
21 package org.openecomp.vid.asdc.beans.tosca;\r
22 \r
23 import java.util.Collection;\r
24 import java.util.LinkedList;\r
25 \r
26 /**\r
27  * The Class ToscaCsar.\r
28  */\r
29 public class ToscaCsar {\r
30 \r
31         /** The parent. */\r
32         private final ToscaModel parent;\r
33         \r
34         /** The children. */\r
35         private final Collection<ToscaModel> children;\r
36         \r
37         /**\r
38          * The Class Builder.\r
39          */\r
40         public static class Builder {\r
41                 \r
42                 /** The parent. */\r
43                 private final ToscaModel parent;\r
44                 \r
45                 /** The children. */\r
46                 private Collection<ToscaModel> children = new LinkedList<ToscaModel> ();\r
47                 \r
48                 /**\r
49                  * Instantiates a new builder.\r
50                  *\r
51                  * @param parent the parent\r
52                  */\r
53                 public Builder(ToscaModel parent) {\r
54                         this.parent = parent;\r
55                 }\r
56                 \r
57                 /**\r
58                  * Adds the vnf.\r
59                  *\r
60                  * @param child the child\r
61                  * @return the builder\r
62                  */\r
63                 public Builder addVnf(ToscaModel child) {\r
64                         children.add(child);\r
65                         return this;\r
66                 }\r
67                 \r
68                 /**\r
69                  * Builds the.\r
70                  *\r
71                  * @return the tosca csar\r
72                  */\r
73                 public ToscaCsar build() {\r
74                         return new ToscaCsar(this);\r
75                 }\r
76         }\r
77         \r
78         /**\r
79          * Instantiates a new tosca csar.\r
80          *\r
81          * @param builder the builder\r
82          */\r
83         public ToscaCsar(Builder builder) {\r
84                 this.parent = builder.parent;\r
85                 this.children = builder.children;\r
86         }\r
87         \r
88         /**\r
89          * Gets the parent.\r
90          *\r
91          * @return the parent\r
92          */\r
93         public ToscaModel getParent() { return parent; }\r
94         \r
95         /**\r
96          * Gets the children.\r
97          *\r
98          * @return the children\r
99          */\r
100         public Collection<ToscaModel> getChildren() { return children; }\r
101 }\r