2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.openecomp.vid.model;
23 import org.openecomp.vid.asdc.beans.tosca.Group;
28 public class VfModule {
33 /** The invariant uuid. */
34 private String invariantUuid;
36 /** The description. */
37 private String description;
43 private String version;
45 /** The volume group allowed. */
46 private boolean volumeGroupAllowed;
49 * Instantiates a new vf module.
58 public String getUuid() {
63 * Gets the invariant uuid.
65 * @return the invariant uuid
67 public String getInvariantUuid() {
72 * Gets the description.
74 * @return the description
76 public String getDescription() {
85 public String getName() {
94 public String getVersion() {
99 * Checks if is volume group allowed.
101 * @return true, if is volume group allowed
103 public boolean isVolumeGroupAllowed() {
104 return volumeGroupAllowed;
110 * @param uuid the new uuid
112 public void setUuid(String uuid) {
117 * Sets the invariant uuid.
119 * @param invariantUuid the new invariant uuid
121 public void setInvariantUuid(String invariantUuid) {
122 this.invariantUuid = invariantUuid;
126 * Sets the description.
128 * @param description the new description
130 public void setDescription(String description) {
131 this.description = description;
137 * @param name the new name
139 public void setName(String name) {
146 * @param version the new version
148 public void setVersion(String version) {
149 this.version = version;
153 * Sets the volume group allowed.
155 * @param volumeGroupAllowed the new volume group allowed
157 private void setVolumeGroupAllowed(boolean volumeGroupAllowed) {
158 this.volumeGroupAllowed = volumeGroupAllowed;
164 * @param group the group
165 * @return the vf module
167 public static VfModule extractVfModule(Group group) {
169 final VfModule vfModule = new VfModule();
171 vfModule.setUuid(group.getMetadata().getVfModuleModelUUID());
172 vfModule.setInvariantUuid(group.getMetadata().getVfModuleModelInvariantUUID());
173 vfModule.setDescription(group.getMetadata().getDescription());
174 vfModule.setName(group.getMetadata().getVfModuleModelName());
175 vfModule.setVersion(group.getMetadata().getVfModuleModelVersion());
177 if (group.getProperties().containsKey("volume_group")) {
178 vfModule.setVolumeGroupAllowed(Boolean.valueOf(group.getProperties().get("volume_group")));
180 vfModule.setVolumeGroupAllowed(false);