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.onap.vid.model;
23 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
24 import org.onap.vid.asdc.beans.tosca.Group;
29 public class VfModule extends org.onap.vid.model.Group {
31 /** The Constant LOG. */
32 private static final EELFLoggerDelegate LOG = EELFLoggerDelegate.getLogger(VfModule.class);
34 public static final String VOLUME_GROUP = "volume_group";
36 /** The volume group allowed. */
37 private boolean volumeGroupAllowed;
40 * Checks if is volume group allowed.
42 * @return true, if is volume group allowed
44 public boolean isVolumeGroupAllowed() {
45 return volumeGroupAllowed;
50 * Sets the volume group allowed.
52 * @param volumeGroupAllowed the new volume group allowed
54 public void setVolumeGroupAllowed(boolean volumeGroupAllowed) {
55 this.volumeGroupAllowed = volumeGroupAllowed;
62 * @param group the group
63 * @return the vf module
65 public static VfModule extractVfModule(String modelCustomizationName, Group group) {
67 String methodName = "extractVfModule";
69 final VfModule vfModule = new VfModule();
72 vfModule.setUuid(group.getMetadata().getVfModuleModelUUID());
73 vfModule.setInvariantUuid(group.getMetadata().getVfModuleModelInvariantUUID());
74 vfModule.setDescription(group.getMetadata().getDescription());
75 vfModule.setName(group.getMetadata().getVfModuleModelName());
76 vfModule.setVersion(group.getMetadata().getVfModuleModelVersion());
77 vfModule.setCustomizationUuid(group.getMetadata().getVfModuleModelCustomizationUUID());
78 vfModule.setModelCustomizationName (modelCustomizationName);
79 vfModule.setProperties(VfModule.extractPropertiesForGroup(group));
81 if (group.getProperties().containsKey(VOLUME_GROUP)) {
82 if (group.getProperties().get(VOLUME_GROUP) != null) {
84 Class<?> c = group.getProperties().get(VOLUME_GROUP).getClass();
85 LOG.debug(EELFLoggerDelegate.debugLogger, methodName + " class name=" +
88 if ( c.getName().equalsIgnoreCase(Boolean.class.getName()) ) {
89 Boolean b = (Boolean)group.getProperties().get(VOLUME_GROUP);
90 vfModule.setVolumeGroupAllowed( b.booleanValue() );
94 vfModule.setVolumeGroupAllowed(false);
97 catch ( Exception e ) {
98 LOG.error(EELFLoggerDelegate.errorLogger, methodName + " Unable to parse VF Module from group: e=" +