Implant vid-app-common org.onap.vid.job (main and test)
[vid.git] / vid-app-common / src / main / java / org / onap / vid / model / aaiTree / VfModule.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * VID
4  * ================================================================================
5  * Copyright (C) 2017 - 2019 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.model.aaiTree;
22
23 import static org.onap.vid.aai.util.AAITreeConverter.IS_BASE_VF_MODULE;
24
25 public class VfModule extends Node {
26
27     private boolean isBase;
28     private String volumeGroupName;
29
30     public VfModule(AAITreeNode node) {
31         super(node);
32         fillCloudConfigurationProperties(this, node.getCloudConfiguration());
33     }
34
35     public boolean getIsBase() {
36         return isBase;
37     }
38
39     public void setIsBase(boolean isBase) {
40         this.isBase = isBase;
41     }
42
43     public String getVolumeGroupName() {
44         return volumeGroupName;
45     }
46
47     public void setVolumeGroupName(String volumeGroupName) {
48         this.volumeGroupName = volumeGroupName;
49     }
50
51     public static VfModule from(AAITreeNode node) {
52         VfModule vfModule = new VfModule(node);
53
54         if (node.getAdditionalProperties().get(IS_BASE_VF_MODULE) != null) {
55             vfModule.setIsBase(Boolean.valueOf(node.getAdditionalProperties().get(IS_BASE_VF_MODULE).toString()));
56         }
57
58         return vfModule;
59     }
60 }