Fix import policy issues
[sdc.git] / catalog-be / src / main / java / org / openecomp / sdc / be / tosca / ToscaUtils.java
index 59dd8d0..0f13395 100644 (file)
@@ -7,9 +7,9 @@
  * 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.
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.openecomp.sdc.be.tosca;
 
-import org.apache.commons.lang3.StringUtils;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition;
 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
 import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
 import org.openecomp.sdc.be.model.Component;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum;
 
-import java.lang.reflect.Field;
-import java.util.*;
 public class ToscaUtils {
 
-    private ToscaUtils() {}
+    private ToscaUtils() {
+    }
 
     public static boolean isNotComplexVfc(Component component) {
         if (ComponentTypeEnum.RESOURCE == component.getComponentType()) {
-            ResourceTypeEnum resourceType = ((ResourceMetadataDataDefinition) component.getComponentMetadataDefinition().getMetadataDataDefinition()).getResourceType();
+            ResourceTypeEnum resourceType = ((ResourceMetadataDataDefinition) component.getComponentMetadataDefinition().getMetadataDataDefinition())
+                .getResourceType();
             if (ResourceTypeEnum.CVFC == resourceType) {
                 return false;
             }
+            if (component.getComponentMetadataDefinition() != null && component.getComponentMetadataDefinition().getMetadataDataDefinition() != null
+                && component.getComponentMetadataDefinition().getMetadataDataDefinition().getDescription() != null) {
+                if (component.getComponentMetadataDefinition().getMetadataDataDefinition().getDescription()
+                    .equalsIgnoreCase("Nested VF in service")) {
+                    return false;
+                }
+            }
         }
         return true;
     }
@@ -47,9 +56,7 @@ public class ToscaUtils {
     public static Map<String, Object> objectToMap(Object objectToConvert, Class<?> clazz) throws IllegalAccessException {
         Map<String, Object> map = new HashMap<>();
         List<Field> fields = new ArrayList<>();
-
         fields = getAllFields(fields, clazz);
-
         for (Field field : fields) {
             field.setAccessible(true);
             map.put(field.getName(), field.get(objectToConvert));
@@ -72,13 +79,13 @@ public class ToscaUtils {
         private String owner = "";
 
         SubstitutionEntry(String fullName, String sourceName, String owner) {
-            if(fullName != null) {
+            if (fullName != null) {
                 this.fullName = fullName;
             }
-            if(sourceName != null) {
+            if (sourceName != null) {
                 this.sourceName = sourceName;
             }
-            if(owner != null) {
+            if (owner != null) {
                 this.owner = owner;
             }
         }
@@ -107,5 +114,4 @@ public class ToscaUtils {
             this.owner = owner;
         }
     }
-
 }