Merge "Reorder modifiers"
[so.git] / bpmn / MSOCommonBPMN / src / main / groovy / org / openecomp / mso / bpmn / common / scripts / VfModule.groovy
1 /*-\r
2  * ============LICENSE_START=======================================================\r
3  * ONAP - SO\r
4  * ================================================================================\r
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
6  * ================================================================================\r
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.\r
18  * ============LICENSE_END=========================================================\r
19  */\r
20 \r
21 package org.openecomp.mso.bpmn.common.scripts;\r
22 \r
23 import org.apache.commons.lang3.*\r
24 \r
25 public class VfModule implements Serializable {\r
26         \r
27         /**\r
28          * Class representing a VF Module Node. Fields of this class include indicators\r
29          * as to whether the VF Module is the only VF Module in its containing Generic VNF\r
30          * and whether the VF Module is the base VF Module in its containing Generic VNF.\r
31          */\r
32 \r
33         private Node node\r
34         private Boolean onlyVfModule\r
35         private Boolean baseVfModule\r
36 \r
37         /**\r
38          * Constructor.\r
39          *\r
40          * @param node Node representing the VF Module xml.\r
41          * @param onlyVfModule Is this VF Module the only VF Module in its containing Generic VNF?\r
42          */\r
43         public VfModule(Node node, boolean onlyVfModule) {\r
44                 this.node = node\r
45                 this.onlyVfModule = onlyVfModule\r
46                 this.baseVfModule = getElementText('is-base-vf-module').equals('true')\r
47         }\r
48 \r
49         /**\r
50          * Get the Node representing the VF Module xml.\r
51          *\r
52          * @return the Node representing the VF Module xml.\r
53          */\r
54         public Node getNode() {\r
55                 return node\r
56         }\r
57 \r
58         public String getElementText(String childNodeName) {\r
59                 def Node childNode = (new MsoUtils()).getChildNode(node, childNodeName)\r
60                 if (childNode == null) {\r
61                         return ''\r
62                 } else {\r
63                         return childNode.text()\r
64                 }\r
65         }\r
66 \r
67         /**\r
68          * Is this VF Module the only VF Module in its containing Generic VNF?\r
69          *\r
70          * @return true if this VF Module is the only VF Module in its containing Generic VNF;\r
71          * false otherwise.\r
72          */\r
73         public boolean isOnlyVfModule() {\r
74                 return onlyVfModule\r
75         }\r
76 \r
77         /**\r
78          * Is this VF Module the base VF Module in its containing Generic VNF?\r
79          *\r
80          * @return true if this VF Module is the base VF Module in its containing Generic VNF;\r
81          * false otherwise.\r
82          */\r
83         public boolean isBaseVfModule() {\r
84                 return baseVfModule\r
85         }\r
86 }\r
87 \r