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