From 51e051e86f9f5d10c9439e9e5e57d1e9ee8f8e06 Mon Sep 17 00:00:00 2001 From: ojasdubey Date: Thu, 22 Feb 2018 14:32:06 +0530 Subject: VLAN tagging - Pattern 1A, 1C1 1. Implementation for supporting VLAN tagging in Pattern 1A and 1C1 heats 2. Updated code for switch case refactor with command design pattern 3. Added unit tests and bug fixes Change-Id: I54938ffd6673f865b4506a890ec8e7b9c54597b1 Issue-ID: SDC-1036 Signed-off-by: ojasdubey --- .../sdc/tosca/datatypes/model/PropertyType.java | 35 +++++++++++++++------- 1 file changed, 24 insertions(+), 11 deletions(-) (limited to 'common') diff --git a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/PropertyType.java b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/PropertyType.java index bebf6d34bf..02c4b7fde4 100644 --- a/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/PropertyType.java +++ b/common/openecomp-tosca-datatype/src/main/java/org/openecomp/sdc/tosca/datatypes/model/PropertyType.java @@ -1,28 +1,26 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ +/* + * Copyright © 2016-2018 European Support Limited + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * ============LICENSE_END========================================================= */ package org.openecomp.sdc.tosca.datatypes.model; import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.Map; +import java.util.Set; public enum PropertyType { @@ -39,6 +37,8 @@ public enum PropertyType { private static final Map mMap = Collections.unmodifiableMap(initializeMapping()); + private static final Set simplePropertyTypes = + Collections.unmodifiableSet(initializeSimplePropertyTypes()); private String displayName; PropertyType(String displayName) { @@ -51,7 +51,7 @@ public enum PropertyType { * @return Map */ public static Map initializeMapping() { - Map typeMap = new HashMap(); + Map typeMap = new HashMap<>(); for (PropertyType v : PropertyType.values()) { typeMap.put(v.displayName, v); } @@ -60,7 +60,7 @@ public enum PropertyType { /** * Get Property type by display name. - * @param displayName. + * @param displayName * @return PropertyType */ public static PropertyType getPropertyTypeByDisplayName(String displayName) { @@ -73,6 +73,19 @@ public enum PropertyType { return null; } + private static Set initializeSimplePropertyTypes() { + Set simplePropertyTypes = new HashSet<>(4); + simplePropertyTypes.add(STRING.getDisplayName().toLowerCase()); + simplePropertyTypes.add(INTEGER.getDisplayName().toLowerCase()); + simplePropertyTypes.add(FLOAT.getDisplayName().toLowerCase()); + simplePropertyTypes.add(BOOLEAN.getDisplayName().toLowerCase()); + return simplePropertyTypes; + } + + public static Set getSimplePropertyTypes() { + return simplePropertyTypes; + } + public String getDisplayName() { return displayName; } -- cgit 1.2.3-korg