Reformat common 38/119938/2
authorvasraz <vasyl.razinkov@est.tech>
Sat, 27 Mar 2021 22:58:29 +0000 (22:58 +0000)
committerChristophe Closset <christophe.closset@intl.att.com>
Mon, 29 Mar 2021 07:15:14 +0000 (07:15 +0000)
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Issue-ID: SDC-3449
Change-Id: Ifa1412b8a614f7cdb4c52f05d811ab5e9cf20d83

94 files changed:
common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/Config.java
common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/Configuration.java
common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/ConfigurationLoader.java
common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/ConfigurationManager.java
common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/Hint.java
common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/ConfigurationUtils.java
common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/Constants.java
common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/NonConfigResource.java
common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/AggregateConfiguration.java
common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/CliConfigurationImpl.java
common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationFilter.java
common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationImpl.java
common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationRepository.java
common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ContextListener.java
common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/YamlConfiguration.java
common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/type/ConfigurationMode.java
common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/type/ConfigurationQuery.java
common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/type/ConfigurationType.java
common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/GABService.java
common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/GABServiceImpl.java
common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABQuery.java
common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABResult.java
common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABResultEntry.java
common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABResults.java
common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/yaml/GABYamlParser.java
common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/yaml/YamlParser.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ActivityDefinition.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ArtifactDefinition.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ArtifactType.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/AttributeDefinition.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityAssignment.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityDefinition.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityFilter.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityType.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Condition.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Constraint.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Credential.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/DataType.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/DefinitionOfDataType.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Directive.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/EntrySchema.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/EventFilter.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/GroupDefinition.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/GroupType.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Implementation.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Import.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Interface.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinition.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionTemplate.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionType.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceType.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeFilter.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeTemplate.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeType.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/OperationDefinition.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/OperationDefinitionTemplate.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/OperationDefinitionType.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ParameterDefinition.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PolicyDefinition.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PolicyType.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PreconditionDefinition.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PropertyDefinition.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PropertyType.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RelationshipTemplate.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RelationshipType.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Repository.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RequirementAssignment.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RequirementDefinition.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Scalar.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ScalarUnitValidator.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ServiceTemplate.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Status.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/StepDefinition.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/SubstitutionMapping.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Template.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/TimeInterval.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/TopologyTemplate.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Trigger.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/WorkflowDefinition.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/extension/RequirementAssignmentExt.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/extension/ServiceFilter.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/AnnotationDefinition.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/AnnotationType.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/ParameterDefinitionExt.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/PropertyTypeExt.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/error/ToscaRuntimeException.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/CommonUtil.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/DataModelCloneUtil.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/DataModelConvertUtil.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/DataModelNormalizeUtil.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/MyPropertyUtils.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/StrictMapAppenderConstructor.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/ToscaExtensionYamlUtil.java
common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/YamlUtil.java

index d5b5a10..81a629a 100644 (file)
@@ -13,7 +13,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onap.config.api;
 
 import java.util.Arrays;
@@ -31,7 +30,6 @@ public interface Configuration {
      * @param id tenant id; may be <code>null</code> in which case a default will be used.
      */
     static void setTenantId(String id) {
-
         if (id != null && id.trim().length() > 0) {
             TENANT.set(id);
         } else {
index 78f8b23..572c226 100644 (file)
@@ -13,7 +13,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onap.config.api;
 
 import java.util.Iterator;
@@ -32,7 +31,6 @@ class ConfigurationLoader {
     }
 
     static Configuration load() {
-
         ServiceLoader<ConfigurationManager> loader = ServiceLoader.load(ConfigurationManager.class);
         Iterator<ConfigurationManager> configManagers = loader.iterator();
         while (configManagers.hasNext()) {
@@ -42,7 +40,6 @@ class ConfigurationLoader {
                 // this provider loading has failed, let's try next one
             }
         }
-
         throw new IllegalStateException("No binding found for configuration service");
     }
 }
index 373b643..0f6d6f9 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onap.config.api;
 
 public enum Hint {
-
     DEFAULT(0b0), LATEST_LOOKUP(0b1), EXTERNAL_LOOKUP(0b10), NODE_SPECIFIC(0b100);
-
     private final int lookupHint;
 
     Hint(int hint) {
@@ -29,6 +26,4 @@ public enum Hint {
     public int value() {
         return lookupHint;
     }
-
-
 }
index c13a3a4..71dd457 100644 (file)
  * Modifications Copyright (c) 2019 Samsung
  *
  */
-
 package org.onap.config;
 
+import static java.util.Optional.ofNullable;
+import static org.onap.config.api.Hint.EXTERNAL_LOOKUP;
+import static org.onap.config.api.Hint.LATEST_LOOKUP;
+import static org.onap.config.api.Hint.NODE_SPECIFIC;
+
 import com.virtlink.commons.configuration2.jackson.JsonConfiguration;
 import io.github.classgraph.ClassGraph;
 import io.github.classgraph.ScanResult;
-import org.apache.commons.configuration2.Configuration;
-import org.apache.commons.configuration2.CompositeConfiguration;
-import org.apache.commons.configuration2.FileBasedConfiguration;
-import org.apache.commons.configuration2.PropertiesConfiguration;
-import org.apache.commons.configuration2.XMLConfiguration;
-import org.apache.commons.configuration2.builder.BasicConfigurationBuilder;
-import org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder;
-import org.apache.commons.configuration2.builder.ReloadingFileBasedConfigurationBuilder;
-import org.apache.commons.configuration2.builder.fluent.Configurations;
-import org.apache.commons.configuration2.builder.fluent.Parameters;
-import org.apache.commons.configuration2.convert.DefaultListDelimiterHandler;
-import org.apache.commons.configuration2.ex.ConfigurationException;
-import org.apache.commons.io.IOUtils;
-import org.onap.config.api.Config;
-import org.onap.config.api.ConfigurationManager;
-import org.onap.config.impl.YamlConfiguration;
-import org.onap.config.type.ConfigurationMode;
-import org.onap.config.type.ConfigurationType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import java.io.File;
 import java.io.IOException;
 import java.lang.reflect.Array;
@@ -52,8 +35,8 @@ import java.lang.reflect.Type;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.nio.charset.Charset;
-import java.nio.file.Files;
 import java.nio.file.FileVisitResult;
+import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.SimpleFileVisitor;
 import java.nio.file.attribute.BasicFileAttributes;
@@ -82,22 +65,33 @@ import java.util.function.Predicate;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
-
-import static java.util.Optional.ofNullable;
-import static org.onap.config.api.Hint.EXTERNAL_LOOKUP;
-import static org.onap.config.api.Hint.LATEST_LOOKUP;
-import static org.onap.config.api.Hint.NODE_SPECIFIC;
+import org.apache.commons.configuration2.CompositeConfiguration;
+import org.apache.commons.configuration2.Configuration;
+import org.apache.commons.configuration2.FileBasedConfiguration;
+import org.apache.commons.configuration2.PropertiesConfiguration;
+import org.apache.commons.configuration2.XMLConfiguration;
+import org.apache.commons.configuration2.builder.BasicConfigurationBuilder;
+import org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder;
+import org.apache.commons.configuration2.builder.ReloadingFileBasedConfigurationBuilder;
+import org.apache.commons.configuration2.builder.fluent.Configurations;
+import org.apache.commons.configuration2.builder.fluent.Parameters;
+import org.apache.commons.configuration2.convert.DefaultListDelimiterHandler;
+import org.apache.commons.configuration2.ex.ConfigurationException;
+import org.apache.commons.io.IOUtils;
+import org.onap.config.api.Config;
+import org.onap.config.api.ConfigurationManager;
+import org.onap.config.impl.YamlConfiguration;
+import org.onap.config.type.ConfigurationMode;
+import org.onap.config.type.ConfigurationType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class ConfigurationUtils {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(ConfigurationUtils.class);
-
     private static final String CONFIGURATION_TYPE_NOT_SUPPORTED = "Configuration type not supported:";
-
     private static final Map<Class<?>, Class<?>> ARRAY_CLASS_MAP;
-
     private static final String CONFIG_REGEX_TPL_OPT_1 = "CONFIG(-\\w*){0,1}(-(%s|%s|%s)){0,1}\\.(%s|%s|%s|%s)$";
-
     private static final String CONFIG_REGEX_TPL_OPT_2 = "CONFIG(.)*\\.(%s|%s|%s|%s)$";
 
     static {
@@ -125,12 +119,12 @@ public class ConfigurationUtils {
             Files.walkFileTree(rootPath, new SimpleFileVisitor<Path>() {
                 @Override
                 public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
-                    super.preVisitDirectory(dir,attrs);
+                    super.preVisitDirectory(dir, attrs);
                     if (rootPath.equals(dir)) {
                         return FileVisitResult.CONTINUE;
                     }
                     collection.add(dir.toFile());
-                    return recursive? FileVisitResult.CONTINUE : FileVisitResult.SKIP_SUBTREE;
+                    return recursive ? FileVisitResult.CONTINUE : FileVisitResult.SKIP_SUBTREE;
                 }
 
                 @Override
@@ -153,13 +147,10 @@ public class ConfigurationUtils {
     }
 
     public static String getCommaSeparatedList(List<?> list) {
-
         if ((list == null) || list.isEmpty()) {
             return "";
         }
-
-        return list.stream().filter(o -> o != null && !o.toString().trim().isEmpty())
-                .map(o -> o.toString().trim()).collect(Collectors.joining(","));
+        return list.stream().filter(o -> o != null && !o.toString().trim().isEmpty()).map(o -> o.toString().trim()).collect(Collectors.joining(","));
     }
 
     public static boolean isConfig(URL url) {
@@ -169,26 +160,11 @@ public class ConfigurationUtils {
     public static boolean isConfig(String file) {
         file = file.toUpperCase().substring(file.lastIndexOf('!') + 1);
         file = file.substring(file.lastIndexOf('/') + 1);
-        return file.matches(
-                String.format(
-                        CONFIG_REGEX_TPL_OPT_1,
-                        ConfigurationMode.OVERRIDE,
-                        ConfigurationMode.MERGE,
-                        ConfigurationMode.UNION,
-                        ConfigurationType.PROPERTIES.name(),
-                        ConfigurationType.XML.name(),
-                        ConfigurationType.JSON.name(),
-                        ConfigurationType.YAML.name()
-                )
-        ) || file.matches(
-                String.format(
-                        CONFIG_REGEX_TPL_OPT_2,
-                        ConfigurationType.PROPERTIES.name(),
-                        ConfigurationType.XML.name(),
-                        ConfigurationType.JSON.name(),
-                        ConfigurationType.YAML.name()
-                )
-        );
+        return file.matches(String.format(CONFIG_REGEX_TPL_OPT_1, ConfigurationMode.OVERRIDE, ConfigurationMode.MERGE, ConfigurationMode.UNION,
+            ConfigurationType.PROPERTIES.name(), ConfigurationType.XML.name(), ConfigurationType.JSON.name(), ConfigurationType.YAML.name())) || file
+            .matches(String
+                .format(CONFIG_REGEX_TPL_OPT_2, ConfigurationType.PROPERTIES.name(), ConfigurationType.XML.name(), ConfigurationType.JSON.name(),
+                    ConfigurationType.YAML.name()));
     }
 
     public static boolean isConfig(File file) {
@@ -196,45 +172,31 @@ public class ConfigurationUtils {
     }
 
     private static Optional<String> readNamespace(Configuration config) {
-        return ofNullable(config).flatMap(configuration -> ofNullable(configuration.getString(Constants.NAMESPACE_KEY)))
-                .map(String::toUpperCase);
+        return ofNullable(config).flatMap(configuration -> ofNullable(configuration.getString(Constants.NAMESPACE_KEY))).map(String::toUpperCase);
     }
 
     private static Optional<String> readMergeStrategy(Configuration config) {
-        return ofNullable(config).flatMap(configuration -> ofNullable(configuration.getString(Constants.MODE_KEY)))
-                .map(String::toUpperCase);
+        return ofNullable(config).flatMap(configuration -> ofNullable(configuration.getString(Constants.MODE_KEY))).map(String::toUpperCase);
     }
 
     public static ConfigurationMode getMergeStrategy(File file) {
-        Optional<ConfigurationMode> configurationMode =
-                getConfiguration(file).flatMap(ConfigurationUtils::readMergeStrategy)
-                        .flatMap(ConfigurationUtils::convertConfigurationMode);
+        Optional<ConfigurationMode> configurationMode = getConfiguration(file).flatMap(ConfigurationUtils::readMergeStrategy)
+            .flatMap(ConfigurationUtils::convertConfigurationMode);
         return configurationMode.orElseGet(() -> getMergeStrategy(file.getName().toUpperCase()));
     }
 
     public static ConfigurationMode getMergeStrategy(URL url) {
-        Optional<ConfigurationMode> configurationMode =
-                getConfiguration(url).flatMap(ConfigurationUtils::readMergeStrategy)
-                        .flatMap(ConfigurationUtils::convertConfigurationMode);
+        Optional<ConfigurationMode> configurationMode = getConfiguration(url).flatMap(ConfigurationUtils::readMergeStrategy)
+            .flatMap(ConfigurationUtils::convertConfigurationMode);
         return configurationMode.orElseGet(() -> getMergeStrategy(url.getFile().toUpperCase()));
     }
 
     public static ConfigurationMode getMergeStrategy(String file) {
-
         file = file.toUpperCase().substring(file.lastIndexOf('!') + 1);
         file = file.substring(file.lastIndexOf('/') + 1);
-        Pattern pattern = Pattern.compile(
-                String.format(
-                        CONFIG_REGEX_TPL_OPT_1,
-                        ConfigurationMode.OVERRIDE,
-                        ConfigurationMode.MERGE,
-                        ConfigurationMode.UNION,
-                        ConfigurationType.PROPERTIES.name(),
-                        ConfigurationType.XML.name(),
-                        ConfigurationType.JSON.name(),
-                        ConfigurationType.YAML.name()
-                )
-        );
+        Pattern pattern = Pattern.compile(String
+            .format(CONFIG_REGEX_TPL_OPT_1, ConfigurationMode.OVERRIDE, ConfigurationMode.MERGE, ConfigurationMode.UNION,
+                ConfigurationType.PROPERTIES.name(), ConfigurationType.XML.name(), ConfigurationType.JSON.name(), ConfigurationType.YAML.name()));
         Matcher matcher = pattern.matcher(file);
         boolean b1 = matcher.matches();
         if (b1) {
@@ -250,14 +212,11 @@ public class ConfigurationUtils {
                 }
             }
         }
-
         return null;
     }
 
     public static Optional<FileBasedConfiguration> getConfiguration(URL url) {
-
         try {
-
             ConfigurationType configType = ConfigurationUtils.getConfigType(url);
             switch (configType) {
                 case PROPERTIES:
@@ -274,12 +233,10 @@ public class ConfigurationUtils {
         } catch (ConfigurationException exception) {
             LOGGER.error("Error reading configuration at {}.", url.toString(), exception);
         }
-
         return Optional.empty();
     }
 
     public static Optional<FileBasedConfiguration> getConfiguration(File file) {
-
         try {
             return getConfiguration(file.getAbsoluteFile().toURI().toURL());
         } catch (MalformedURLException e) {
@@ -289,14 +246,12 @@ public class ConfigurationUtils {
 
     public static ConfigurationType getConfigType(File file) {
         Objects.requireNonNull(file, "File cannot be null");
-        return Enum.valueOf(ConfigurationType.class,
-                file.getAbsolutePath().substring(file.getAbsolutePath().lastIndexOf('.') + 1).toUpperCase());
+        return Enum.valueOf(ConfigurationType.class, file.getAbsolutePath().substring(file.getAbsolutePath().lastIndexOf('.') + 1).toUpperCase());
     }
 
     public static ConfigurationType getConfigType(URL url) {
         Objects.requireNonNull(url, "URL cannot be null");
-        return Enum.valueOf(ConfigurationType.class,
-                url.getFile().substring(url.getFile().lastIndexOf('.') + 1).toUpperCase());
+        return Enum.valueOf(ConfigurationType.class, url.getFile().substring(url.getFile().lastIndexOf('.') + 1).toUpperCase());
     }
 
     private static Optional<ConfigurationMode> convertConfigurationMode(String configMode) {
@@ -311,9 +266,7 @@ public class ConfigurationUtils {
 
     public static Class<?> getCollectionGenericType(Field field) {
         Type type = field.getGenericType();
-
         if (type instanceof ParameterizedType) {
-
             ParameterizedType paramType = (ParameterizedType) type;
             Type[] arr = paramType.getActualTypeArguments();
             if (arr.length > 0) {
@@ -325,13 +278,12 @@ public class ConfigurationUtils {
                 }
             }
         }
-
         return String[].class;
     }
 
     public static boolean isWrapperClass(Class<?> clazz) {
-        Predicate<Class<?>> predicateWrapper = type -> type == String.class || type == Boolean.class || type == Character.class
-                || Number.class.isAssignableFrom(type);
+        Predicate<Class<?>> predicateWrapper = type -> type == String.class || type == Boolean.class || type == Character.class || Number.class
+            .isAssignableFrom(type);
         return isA(predicateWrapper, clazz);
     }
 
@@ -368,10 +320,9 @@ public class ConfigurationUtils {
      * Check if clazz is array of primitives or array of primitives wrappers
      */
     public static boolean isAPrimitivesOrWrappersArray(Class<?> clazz) {
-        Predicate<Class<?>> predicatePrimitivesOrWrappersArray =
-                type -> ConfigurationUtils.isAWrappersArray(type) || ConfigurationUtils.isAPrimitivesArray(type);
+        Predicate<Class<?>> predicatePrimitivesOrWrappersArray = type -> ConfigurationUtils.isAWrappersArray(type) || ConfigurationUtils
+            .isAPrimitivesArray(type);
         return isA(predicatePrimitivesOrWrappersArray, clazz);
-
     }
 
     /**
@@ -410,23 +361,18 @@ public class ConfigurationUtils {
         FileBasedConfigurationBuilder<FileBasedConfiguration> builder;
         ConfigurationType configType = ConfigurationUtils.getConfigType(file);
         builder = getFileBasedConfigurationBuilder(configType);
-        builder.configure(new Parameters().fileBased().setFile(file)
-                .setListDelimiterHandler(new DefaultListDelimiterHandler(',')));
+        builder.configure(new Parameters().fileBased().setFile(file).setListDelimiterHandler(new DefaultListDelimiterHandler(',')));
         return builder;
     }
 
     public static BasicConfigurationBuilder<FileBasedConfiguration> getConfigurationBuilder(URL url) {
         ConfigurationType configType = ConfigurationUtils.getConfigType(url);
-        ReloadingFileBasedConfigurationBuilder<FileBasedConfiguration> builder =
-                getFileBasedConfigurationBuilder(configType);
-        builder.configure(
-                new Parameters().fileBased().setURL(url).setListDelimiterHandler(new DefaultListDelimiterHandler(',')));
+        ReloadingFileBasedConfigurationBuilder<FileBasedConfiguration> builder = getFileBasedConfigurationBuilder(configType);
+        builder.configure(new Parameters().fileBased().setURL(url).setListDelimiterHandler(new DefaultListDelimiterHandler(',')));
         return builder;
     }
 
-    private static ReloadingFileBasedConfigurationBuilder<FileBasedConfiguration> getFileBasedConfigurationBuilder(
-            ConfigurationType configType) {
-
+    private static ReloadingFileBasedConfigurationBuilder<FileBasedConfiguration> getFileBasedConfigurationBuilder(ConfigurationType configType) {
         ReloadingFileBasedConfigurationBuilder<FileBasedConfiguration> builder;
         switch (configType) {
             case PROPERTIES:
@@ -490,7 +436,7 @@ public class ConfigurationUtils {
 
     public static Object getWrappersArray(Collection<?> collection, Class<?> clazz) {
         Object array = null;
-        if (isWrapperClass(clazz)){
+        if (isWrapperClass(clazz)) {
             int collectionSize = collection.size();
             array = Array.newInstance(clazz, collection.size());
             Object[] objArray = collection.toArray();
@@ -520,11 +466,10 @@ public class ConfigurationUtils {
             } else if (key.toUpperCase().startsWith("SYS:")) {
                 value = System.getProperty(key.substring(substringStartIndex));
             } else {
-                value = ConfigurationUtils.getCollectionString(
-                        ConfigurationManager.lookup().getAsStringValues(tenant, namespace, key).toString());
+                value = ConfigurationUtils.getCollectionString(ConfigurationManager.lookup().getAsStringValues(tenant, namespace, key).toString());
             }
-            return processVariablesIfPresent(tenant, namespace, data.replaceAll("\\$\\{" + key + "}",
-                    value == null ? "" : value.replace("\\", "\\\\")));
+            return processVariablesIfPresent(tenant, namespace,
+                data.replaceAll("\\$\\{" + key + "}", value == null ? "" : value.replace("\\", "\\\\")));
         } else {
             return data;
         }
@@ -594,7 +539,7 @@ public class ConfigurationUtils {
             return getConcreteCollection(List.class);
         }
         throw new IllegalArgumentException("Only corresponding array classes and any are allowed as argument."
-                + "assignable from TransferQueue, BlockingQueue, Deque, Queue, SortedSet, Set, List class");
+            + "assignable from TransferQueue, BlockingQueue, Deque, Queue, SortedSet, Set, List class");
     }
 
     public static Collection getConcreteCollection(Class<?> clazz) {
@@ -616,18 +561,16 @@ public class ConfigurationUtils {
                 return new LinkedBlockingQueue<>();
             default:
                 throw new IllegalArgumentException("Only corresponding array classes and any are allowed as argument."
-                        + "assignable from TransferQueue, BlockingQueue, Deque, Queue, SortedSet, Set, List class");
+                    + "assignable from TransferQueue, BlockingQueue, Deque, Queue, SortedSet, Set, List class");
         }
     }
 
     public static String getConfigurationRepositoryKey(File file) {
-        return getConfigurationRepositoryKey(
-                ConfigurationUtils.getNamespace(file).split(Constants.TENANT_NAMESPACE_SEPARATOR));
+        return getConfigurationRepositoryKey(ConfigurationUtils.getNamespace(file).split(Constants.TENANT_NAMESPACE_SEPARATOR));
     }
 
     public static String getConfigurationRepositoryKey(URL url) {
-        return getConfigurationRepositoryKey(
-                ConfigurationUtils.getNamespace(url).split(Constants.TENANT_NAMESPACE_SEPARATOR));
+        return getConfigurationRepositoryKey(ConfigurationUtils.getNamespace(url).split(Constants.TENANT_NAMESPACE_SEPARATOR));
     }
 
     public static String getConfigurationRepositoryKey(String[] array) {
@@ -641,49 +584,34 @@ public class ConfigurationUtils {
     }
 
     public static String getNamespace(File file) {
-        Optional<String> namespace =
-                getConfiguration(file).flatMap(ConfigurationUtils::readNamespace).map(String::toUpperCase);
+        Optional<String> namespace = getConfiguration(file).flatMap(ConfigurationUtils::readNamespace).map(String::toUpperCase);
         return namespace.orElseGet(() -> getNamespace(file.getName().toUpperCase()));
     }
 
     public static String getNamespace(String file) {
         file = file.toUpperCase().substring(file.lastIndexOf('!') + 1);
         file = file.substring(file.lastIndexOf('/') + 1);
-        Pattern pattern = Pattern.compile(
-                String.format(
-                        CONFIG_REGEX_TPL_OPT_1,
-                        ConfigurationMode.OVERRIDE,
-                        ConfigurationMode.MERGE,
-                        ConfigurationMode.UNION,
-                        ConfigurationType.PROPERTIES.name(),
-                        ConfigurationType.XML.name(),
-                        ConfigurationType.JSON.name(),
-                        ConfigurationType.YAML.name()
-                )
-        );
+        Pattern pattern = Pattern.compile(String
+            .format(CONFIG_REGEX_TPL_OPT_1, ConfigurationMode.OVERRIDE, ConfigurationMode.MERGE, ConfigurationMode.UNION,
+                ConfigurationType.PROPERTIES.name(), ConfigurationType.XML.name(), ConfigurationType.JSON.name(), ConfigurationType.YAML.name()));
         Matcher matcher = pattern.matcher(file);
         boolean b1 = matcher.matches();
         if (b1) {
             if (matcher.group(1) != null) {
                 String moduleName = matcher.group(1).substring(1);
-                return moduleName.equalsIgnoreCase(ConfigurationMode.OVERRIDE.name()) || moduleName.equalsIgnoreCase(
-                        ConfigurationMode.UNION.name()) || moduleName.equalsIgnoreCase(ConfigurationMode.MERGE.name())
-                        ? Constants.DEFAULT_NAMESPACE : moduleName;
+                return moduleName.equalsIgnoreCase(ConfigurationMode.OVERRIDE.name()) || moduleName.equalsIgnoreCase(ConfigurationMode.UNION.name())
+                    || moduleName.equalsIgnoreCase(ConfigurationMode.MERGE.name()) ? Constants.DEFAULT_NAMESPACE : moduleName;
             } else {
                 return Constants.DEFAULT_NAMESPACE;
             }
         } else if (isConfig(file)) {
             return Constants.DEFAULT_NAMESPACE;
         }
-
         return null;
     }
 
     public static String getNamespace(URL url) {
-
-        Optional<String> namespace =
-                getConfiguration(url).flatMap(ConfigurationUtils::readNamespace).map(String::toUpperCase);
-
+        Optional<String> namespace = getConfiguration(url).flatMap(ConfigurationUtils::readNamespace).map(String::toUpperCase);
         return namespace.orElseGet(() -> getNamespace(url.getFile().toUpperCase()));
     }
 
@@ -738,7 +666,6 @@ public class ConfigurationUtils {
                 return ((Object[]) obj).length == 0;
             }
         }
-
         return false;
     }
 
@@ -747,7 +674,6 @@ public class ConfigurationUtils {
     }
 
     // private methods section starts here
-
     private static int[] getIntsPrimitiveArray(Collection<?> collection) {
         int collectionSize = collection.size();
         int[] array = new int[collectionSize];
@@ -827,5 +753,4 @@ public class ConfigurationUtils {
         }
         return array;
     }
-
 }
index 5e21fbd..5eb0901 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onap.config;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 import java.io.File;
 import java.net.MalformedURLException;
 import java.net.URI;
@@ -33,20 +29,19 @@ import java.util.List;
 import java.util.Objects;
 import java.util.Set;
 import java.util.function.Function;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class NonConfigResource {
-    private static final Logger LOGGER = LoggerFactory.getLogger(NonConfigResource.class);
 
     static final String NODE_CONFIG_LOCATION = "node.config.location";
     static final String CONFIG_LOCATION = "config.location";
-
-    private final List<Function<String, Path>> lookupFunctions =
-            Arrays.asList(this::getFromFile, this::findInFiles, this::getForNode, this::getGlobal, this::findInUris);
-
+    private static final Logger LOGGER = LoggerFactory.getLogger(NonConfigResource.class);
     private final Set<URI> uris = Collections.synchronizedSet(new HashSet<>());
     private final Set<File> files = Collections.synchronizedSet(new HashSet<>());
-
     private final Function<String, String> propertyGetter;
+    private final List<Function<String, Path>> lookupFunctions = Arrays
+        .asList(this::getFromFile, this::findInFiles, this::getForNode, this::getGlobal, this::findInUris);
 
     NonConfigResource(Function<String, String> propertyGetter) {
         this.propertyGetter = propertyGetter;
@@ -56,6 +51,22 @@ public class NonConfigResource {
         this(System::getProperty);
     }
 
+    private static URI toUri(URL url) {
+        try {
+            return url.toURI();
+        } catch (URISyntaxException e) {
+            throw new IllegalStateException("Unexpected URL syntax: " + url, e);
+        }
+    }
+
+    private static URL toUrl(URI uri) {
+        try {
+            return uri.toURL();
+        } catch (MalformedURLException e) {
+            throw new IllegalStateException("Unexpected URI syntax: " + uri, e);
+        }
+    }
+
     public void add(URL url) {
         uris.add(toUri(url));
     }
@@ -65,18 +76,11 @@ public class NonConfigResource {
     }
 
     public Path locate(String resource) {
-
         if (resource == null) {
             return null;
         }
-
         try {
-
-            return lookupFunctions.stream()
-                           .map(f -> f.apply(resource))
-                           .filter(Objects::nonNull)
-                           .findFirst().orElse(null);
-
+            return lookupFunctions.stream().map(f -> f.apply(resource)).filter(Objects::nonNull).findFirst().orElse(null);
         } catch (Exception exception) {
             LOGGER.error("Failed to locate resource '{}'.", resource, exception);
             return null;
@@ -84,17 +88,11 @@ public class NonConfigResource {
     }
 
     private Path locate(File root, String resource) {
-
         if (!root.exists()) {
             return null;
         }
-
-        return ConfigurationUtils.getAllFiles(root, true, false)
-                       .stream()
-                       .filter(f -> !ConfigurationUtils.isConfig(f))
-                       .peek(this::add).filter(f -> f.getAbsolutePath().endsWith(resource))
-                       .findFirst()
-                       .map(file -> Paths.get(file.getAbsolutePath())).orElse(null);
+        return ConfigurationUtils.getAllFiles(root, true, false).stream().filter(f -> !ConfigurationUtils.isConfig(f)).peek(this::add)
+            .filter(f -> f.getAbsolutePath().endsWith(resource)).findFirst().map(file -> Paths.get(file.getAbsolutePath())).orElse(null);
     }
 
     private Path getFromFile(String resource) {
@@ -111,15 +109,12 @@ public class NonConfigResource {
     }
 
     private Path findInFiles(String resource) {
-
         for (File availableFile : files) {
-
             String absolutePath = availableFile.getAbsolutePath();
             if (absolutePath.endsWith(resource) && availableFile.exists()) {
                 return Paths.get(absolutePath);
             }
         }
-
         return null;
     }
 
@@ -135,21 +130,4 @@ public class NonConfigResource {
         String value = propertyGetter.apply(property);
         return (value == null) ? null : locate(new File(value), resource);
     }
-
-    private static URI toUri(URL url) {
-
-        try {
-            return url.toURI();
-        } catch (URISyntaxException e) {
-            throw new IllegalStateException("Unexpected URL syntax: " + url, e);
-        }
-    }
-
-    private static URL toUrl(URI uri) {
-        try {
-            return uri.toURL();
-        } catch (MalformedURLException e) {
-            throw new IllegalStateException("Unexpected URI syntax: " + uri, e);
-        }
-    }
 }
index 07c81e5..0621561 100644 (file)
@@ -13,7 +13,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onap.config.impl;
 
 import static org.onap.config.Constants.LOAD_ORDER_KEY;
@@ -44,17 +43,14 @@ public final class AggregateConfiguration {
     private final Map<String, Configuration> overrideConfig = Collections.synchronizedMap(new LinkedHashMap<>());
 
     public void addConfig(File file) throws ConfigurationException {
-        addConfig(fileToUrl(file), ConfigurationUtils.getMergeStrategy(file),
-                ConfigurationUtils.getConfigurationBuilder(file).getConfiguration());
+        addConfig(fileToUrl(file), ConfigurationUtils.getMergeStrategy(file), ConfigurationUtils.getConfigurationBuilder(file).getConfiguration());
     }
 
     public void addConfig(URL url) throws ConfigurationException {
-        addConfig(url, ConfigurationUtils.getMergeStrategy(url),
-                ConfigurationUtils.getConfigurationBuilder(url).getConfiguration());
+        addConfig(url, ConfigurationUtils.getMergeStrategy(url), ConfigurationUtils.getConfigurationBuilder(url).getConfiguration());
     }
 
     private void addConfig(URL url, ConfigurationMode configMode, Configuration config) {
-
         String normalizedUrl = normalize(url);
         if (configMode != null) {
             switch (configMode) {
@@ -76,28 +72,24 @@ public final class AggregateConfiguration {
 
     private String normalize(URL url) {
         // what about Linux where paths are case sensitive?
-        return  url.toString().toUpperCase();
+        return url.toString().toUpperCase();
     }
 
     private URL fileToUrl(File file) {
-
         try {
-            return  file.getAbsoluteFile().toURI().toURL();
+            return file.getAbsoluteFile().toURI().toURL();
         } catch (MalformedURLException e) {
-            throw new IllegalStateException("URL produced by JDK and is not expected to be malformed. File: "
-                                                    + file.getAbsoluteFile());
+            throw new IllegalStateException("URL produced by JDK and is not expected to be malformed. File: " + file.getAbsoluteFile());
         }
     }
 
     public Configuration getFinalConfiguration() {
-
         CombinedConfiguration ccRoot = new CombinedConfiguration(new MergeCombiner());
         ArrayList<Configuration> tempList = new ArrayList<>(rootConfig.values());
         tempList.sort(this::sortForMerge);
         for (Configuration conf : tempList) {
             ccRoot.addConfiguration(conf);
         }
-
         CombinedConfiguration ccMergeRoot = new CombinedConfiguration(new MergeCombiner());
         ccMergeRoot.addConfiguration(ccRoot);
         tempList = new ArrayList<>(mergeConfig.values());
@@ -105,13 +97,11 @@ public final class AggregateConfiguration {
         for (Configuration conf : tempList) {
             ccMergeRoot.addConfiguration(conf);
         }
-
         CombinedConfiguration ccUnionRoot = new CombinedConfiguration(new UnionCombiner());
         ccUnionRoot.addConfiguration(ccMergeRoot);
         for (Configuration conf : unionConfig.values()) {
             ccUnionRoot.addConfiguration(conf);
         }
-
         ArrayList<Configuration> tempOverrideConfigs = new ArrayList<>(overrideConfig.values());
         Collections.reverse(tempOverrideConfigs);
         tempOverrideConfigs.sort(this::sortForOverride);
@@ -119,7 +109,6 @@ public final class AggregateConfiguration {
         for (Configuration conf : tempOverrideConfigs) {
             ccOverrideRoot.addConfiguration(conf);
         }
-
         ccOverrideRoot.addConfiguration(ccUnionRoot);
         return ccOverrideRoot;
     }
@@ -139,12 +128,10 @@ public final class AggregateConfiguration {
     }
 
     private int readLoadOrder(Configuration conf) {
-
         String order = conf.getString(LOAD_ORDER_KEY);
         if (ConfigurationUtils.isBlank(order) || !order.trim().matches("\\d+")) {
             return 0;
         }
-
         return Integer.parseInt(order.trim());
     }
 }
index f919e23..3ddf0a9 100644 (file)
@@ -13,7 +13,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onap.config.impl;
 
 import static org.onap.config.Constants.DEFAULT_NAMESPACE;
@@ -59,8 +58,7 @@ public final class CliConfigurationImpl extends ConfigurationImpl implements Con
                 if (queryData.isFallback()) {
                     value = get(queryData.getTenant(), queryData.getNamespace(), queryData.getKey(), String[].class, hints);
                 } else {
-                    value = getInternal(queryData.getTenant(), queryData.getNamespace(), queryData.getKey(), String[].class,
-                        hints);
+                    value = getInternal(queryData.getTenant(), queryData.getNamespace(), queryData.getKey(), String[].class, hints);
                 }
                 return ConfigurationUtils.getCommaSeparatedList(value);
             } catch (Exception exception) {
@@ -130,11 +128,7 @@ public final class CliConfigurationImpl extends ConfigurationImpl implements Con
                 }
             }
         } catch (Exception exception) {
-            LOGGER.warn("Error occurred while searching for in-memory keys for namespace: '{}' and tenant: '{}'",
-                namespace,
-                tenant,
-                exception
-            );
+            LOGGER.warn("Error occurred while searching for in-memory keys for namespace: '{}' and tenant: '{}'", namespace, tenant, exception);
         }
         return keys;
     }
index 06981e4..ea48d3f 100644 (file)
@@ -13,7 +13,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onap.config.impl;
 
 import java.io.IOException;
@@ -27,7 +26,6 @@ import javax.servlet.annotation.WebFilter;
 import org.onap.config.Constants;
 import org.onap.config.api.Configuration;
 
-
 @WebFilter("/")
 public class ConfigurationFilter implements Filter {
 
@@ -37,8 +35,8 @@ public class ConfigurationFilter implements Filter {
     }
 
     @Override
-    public void doFilter(ServletRequest paramServletRequest, ServletResponse paramServletResponse,
-            FilterChain paramFilterChain) throws IOException, ServletException {
+    public void doFilter(ServletRequest paramServletRequest, ServletResponse paramServletResponse, FilterChain paramFilterChain)
+        throws IOException, ServletException {
         Configuration.TENANT.set(Constants.DEFAULT_TENANT);
         try {
             paramFilterChain.doFilter(paramServletRequest, paramServletResponse);
@@ -51,5 +49,4 @@ public class ConfigurationFilter implements Filter {
     public void destroy() {
         //Use the default behavior
     }
-
 }
index 5d49fa9..964b8d1 100644 (file)
@@ -13,7 +13,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onap.config.impl;
 
 import static org.onap.config.ConfigurationUtils.isBlank;
@@ -36,7 +35,6 @@ import java.util.Set;
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.function.Predicate;
 import java.util.stream.Collectors;
-
 import org.apache.commons.configuration2.ex.ConfigurationException;
 import org.onap.config.ConfigurationUtils;
 import org.onap.config.Constants;
@@ -49,115 +47,18 @@ import org.slf4j.LoggerFactory;
 public class ConfigurationImpl implements org.onap.config.api.Configuration {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(ConfigurationImpl.class);
-
     private static final String KEY_CANNOT_BE_NULL = "Key can't be null.";
     private static final NonConfigResource NON_CONFIG_RESOURCE = new NonConfigResource();
     private static final Map<String, AggregateConfiguration> MODULE_CONFIG_STORE = new HashMap<>();
 
     static {
-        if (!loadClassPathConfigurationsAndResources()
-                || !loadAdditionalConfigurationsAndResources()
-                || !loadTenantConfigurations()) {
+        if (!loadClassPathConfigurationsAndResources() || !loadAdditionalConfigurationsAndResources() || !loadTenantConfigurations()) {
             throw new IllegalStateException("Failed to initialize configuration");
         }
         populateFinalConfigurationIncrementally(MODULE_CONFIG_STORE);
         loadNodeSpecificConfigurations();
     }
 
-    @Override
-    public <T> T get(String tenant, String namespace, String key, Class<T> clazz, Hint... hints) {
-        String[] tenantNamespaceArray;
-        if (tenant == null && namespace != null) {
-            tenantNamespaceArray = namespace.split(Constants.TENANT_NAMESPACE_SEPARATOR);
-            if (tenantNamespaceArray.length > 1) {
-                tenant = tenantNamespaceArray[0];
-                namespace = tenantNamespaceArray[1];
-            }
-        }
-
-        tenant = ConfigurationRepository.lookup().isValidTenant(tenant) ? tenant.toUpperCase() : Constants.DEFAULT_TENANT;
-        namespace = ConfigurationRepository.lookup().isValidNamespace(namespace) ? namespace.toUpperCase() : Constants.DEFAULT_NAMESPACE;
-        hints = hints == null || hints.length == 0 ? new Hint[]{Hint.EXTERNAL_LOOKUP, Hint.NODE_SPECIFIC} : hints;
-        T returnValue;
-        returnValue = getInternal(tenant, namespace, key, clazz, hints);
-        if ((returnValue == null || ConfigurationUtils.isZeroLengthArray(clazz, returnValue))
-                && !Constants.DEFAULT_TENANT.equals(tenant)) {
-            returnValue = getInternal(Constants.DEFAULT_TENANT, namespace, key, clazz, hints);
-        }
-        if ((returnValue == null || ConfigurationUtils.isZeroLengthArray(clazz, returnValue))
-                && !Constants.DEFAULT_NAMESPACE.equals(namespace)) {
-            returnValue = getInternal(tenant, Constants.DEFAULT_NAMESPACE, key, clazz, hints);
-        }
-        if ((returnValue == null || ConfigurationUtils.isZeroLengthArray(clazz, returnValue))
-                && !Constants.DEFAULT_NAMESPACE.equals(namespace) && !Constants.DEFAULT_TENANT.equals(tenant)) {
-            returnValue = getInternal(Constants.DEFAULT_TENANT, Constants.DEFAULT_NAMESPACE, key, clazz, hints);
-        }
-        if (returnValue == null && ConfigurationUtils.isAPrimitive(clazz)) {
-            returnValue = (T) ConfigurationUtils.getDefaultFor(clazz);
-        }
-        return returnValue;
-    }
-
-    @Override
-    public <T> Map<String, T> populateMap(String tenantId, String namespace, String key, Class<T> clazz) {
-        final String calculatedTenantId = calculateTenant(tenantId);
-        final String calculatedNamespace = calculateNamespace(namespace);
-        Map<String, T> map = new HashMap<>();
-        Iterator<String> keys;
-        try {
-            keys = ConfigurationRepository.lookup().getConfigurationFor(calculatedTenantId, calculatedNamespace).getKeys(key);
-            keys.forEachRemaining(k -> {
-                if (k.startsWith(key + ".")) {
-                    k = k.substring(key.length() + 1);
-                    String subkey = k.substring(0, k.indexOf('.'));
-                    if (!map.containsKey(subkey)) {
-                        map.put(subkey, get(calculatedTenantId, calculatedNamespace, key + "." + subkey, clazz));
-                    }
-                }
-            });
-        } catch (Exception e) {
-            LOGGER.warn(
-                    "Couldn't populate map fot tenant: {}, namespace: {}, key: {}, type: {}",
-                    tenantId,
-                    namespace,
-                    key,
-                    clazz.getSimpleName(),
-                    e
-            );
-        }
-        return map;
-    }
-
-    @Override
-    public Map<Object, Object> generateMap(String tenantId, String namespace, String key) {
-        final String calculatedTenantId = calculateTenant(tenantId);
-        final String calculatedNamespace = calculateNamespace(namespace);
-        Map<Object, Object> parentMap = new HashMap<>();
-        Iterator<String> configKeys;
-        try {
-            if (isBlank(key)) {
-                configKeys = ConfigurationRepository.lookup().getConfigurationFor(calculatedTenantId, calculatedNamespace).getKeys();
-            } else {
-                configKeys = ConfigurationRepository.lookup().getConfigurationFor(calculatedTenantId, calculatedNamespace).getKeys(key);
-            }
-            configKeys.forEachRemaining(subKey -> {
-                if (!isBlank(key) && !subKey.startsWith(key + ".")) {
-                    configKeys.remove();
-                }
-                parseConfigSubKeys(subKey, key, calculatedTenantId, calculatedNamespace, parentMap);
-            });
-        } catch (Exception e) {
-            LOGGER.warn(
-                    "Couldn't generate map fot tenant: {}, namespace: {}, key: {}",
-                    tenantId,
-                    namespace,
-                    key,
-                    e
-            );
-        }
-        return parentMap;
-    }
-
     private static boolean loadClassPathConfigurationsAndResources() {
         List<URL> classpathResources = ConfigurationUtils.getAllClassPathResources();
         Predicate<URL> predicate = ConfigurationUtils::isConfig;
@@ -165,11 +66,8 @@ public class ConfigurationImpl implements org.onap.config.api.Configuration {
         List<URL> configResources = resources.get(true);
         List<URL> nonConfigResources = resources.get(false);
         AtomicReference<Boolean> successFlagHolder = new AtomicReference<>(true);
-
         configResources.forEach(url -> successFlagHolder.set(setUpdateModuleConfigStore(url)));
-
         nonConfigResources.forEach(NON_CONFIG_RESOURCE::add);
-
         return successFlagHolder.get();
     }
 
@@ -183,9 +81,7 @@ public class ConfigurationImpl implements org.onap.config.api.Configuration {
             Map<Boolean, List<File>> resources = filesystemResources.stream().collect(Collectors.partitioningBy(filePredicate));
             List<File> configResources = resources.get(true);
             List<File> nonConfigResources = resources.get(false);
-
             configResources.forEach(file -> successFlagHolder.set(setUpdateModuleConfigStore(file)));
-
             nonConfigResources.forEach(NON_CONFIG_RESOURCE::add);
         }
         return successFlagHolder.get();
@@ -198,20 +94,17 @@ public class ConfigurationImpl implements org.onap.config.api.Configuration {
             File root = new File(tenantConfigLocation);
             Collection<File> tenantsRoot = ConfigurationUtils.getAllFiles(root, false, true);
             Collection<File> filesystemResources = ConfigurationUtils.getAllFiles(root, true, false);
-
             Map<Boolean, List<File>> resources = filesystemResources.stream().collect(Collectors.partitioningBy(ConfigurationUtils::isConfig));
             Collection<File> tenantResources = resources.get(true);
-
             tenantResources.forEach(configFile -> {
                 AtomicReference<String> moduleNameHolder = new AtomicReference<>(ConfigurationUtils.getNamespace(configFile));
                 Predicate<File> startsWithRootPredicate = tenantRoot -> configFile.getAbsolutePath().startsWith(tenantRoot.getAbsolutePath());
-                Collection<File> matchesTenantRoot = tenantsRoot.stream().filter(startsWithRootPredicate).collect(Collectors.toCollection(ArrayList::new));
+                Collection<File> matchesTenantRoot = tenantsRoot.stream().filter(startsWithRootPredicate)
+                    .collect(Collectors.toCollection(ArrayList::new));
                 AtomicReference<String[]> altResource = new AtomicReference<>();
                 matchesTenantRoot.forEach(file -> altResource.set(
-                        (file.getName().toUpperCase() + Constants.TENANT_NAMESPACE_SEPARATOR + moduleNameHolder.get())
-                                .split(Constants.TENANT_NAMESPACE_SEPARATOR)
-                        )
-                );
+                    (file.getName().toUpperCase() + Constants.TENANT_NAMESPACE_SEPARATOR + moduleNameHolder.get())
+                        .split(Constants.TENANT_NAMESPACE_SEPARATOR)));
                 successFlagHolder.set(setUpdateModuleConfigStore(configFile, altResource.get()));
             });
         }
@@ -223,25 +116,20 @@ public class ConfigurationImpl implements org.onap.config.api.Configuration {
         if (!isBlank(nodeConfigLocation)) {
             File root = new File(nodeConfigLocation);
             Collection<File> filesystemResources = ConfigurationUtils.getAllFiles(root, true, false);
-            filesystemResources.stream().filter(ConfigurationUtils::isConfig).forEach(
-                    file -> ConfigurationRepository.lookup().populateOverrideConfiguration(
-                            ConfigurationUtils.getConfigurationRepositoryKey(
-                                    ConfigurationUtils.getNamespace(file).split(Constants.TENANT_NAMESPACE_SEPARATOR)), file)
-            );
+            filesystemResources.stream().filter(ConfigurationUtils::isConfig).forEach(file -> ConfigurationRepository.lookup()
+                .populateOverrideConfiguration(ConfigurationUtils
+                    .getConfigurationRepositoryKey(ConfigurationUtils.getNamespace(file).split(Constants.TENANT_NAMESPACE_SEPARATOR)), file));
         }
     }
 
     private static void populateFinalConfigurationIncrementally(Map<String, AggregateConfiguration> configs) {
         if (configs.get(Constants.DEFAULT_TENANT + Constants.KEY_ELEMENTS_DELIMITER + Constants.DB_NAMESPACE) != null) {
-            ConfigurationRepository.lookup().populateConfiguration(
-                    Constants.DEFAULT_TENANT + Constants.KEY_ELEMENTS_DELIMITER + Constants.DB_NAMESPACE,
-                    configs.remove(Constants.DEFAULT_TENANT + Constants.KEY_ELEMENTS_DELIMITER + Constants.DB_NAMESPACE)
-                            .getFinalConfiguration());
+            ConfigurationRepository.lookup()
+                .populateConfiguration(Constants.DEFAULT_TENANT + Constants.KEY_ELEMENTS_DELIMITER + Constants.DB_NAMESPACE,
+                    configs.remove(Constants.DEFAULT_TENANT + Constants.KEY_ELEMENTS_DELIMITER + Constants.DB_NAMESPACE).getFinalConfiguration());
         }
         Set<String> modules = configs.keySet();
-        modules.forEach(
-                m -> ConfigurationRepository.lookup().populateConfiguration(m, configs.get(m).getFinalConfiguration())
-        );
+        modules.forEach(m -> ConfigurationRepository.lookup().populateConfiguration(m, configs.get(m).getFinalConfiguration()));
     }
 
     private static <T> boolean setUpdateModuleConfigStore(T resource, String... namedResources) {
@@ -292,6 +180,98 @@ public class ConfigurationImpl implements org.onap.config.api.Configuration {
         }
     }
 
+    private static String calculateNamespace(String namespace) {
+        if (isBlank(namespace)) {
+            return Constants.DEFAULT_NAMESPACE;
+        }
+        return namespace.toUpperCase();
+    }
+
+    private static String calculateTenant(String tenant) {
+        if (isBlank(tenant)) {
+            return Constants.DEFAULT_TENANT;
+        }
+        return tenant.toUpperCase();
+    }
+
+    @Override
+    public <T> T get(String tenant, String namespace, String key, Class<T> clazz, Hint... hints) {
+        String[] tenantNamespaceArray;
+        if (tenant == null && namespace != null) {
+            tenantNamespaceArray = namespace.split(Constants.TENANT_NAMESPACE_SEPARATOR);
+            if (tenantNamespaceArray.length > 1) {
+                tenant = tenantNamespaceArray[0];
+                namespace = tenantNamespaceArray[1];
+            }
+        }
+        tenant = ConfigurationRepository.lookup().isValidTenant(tenant) ? tenant.toUpperCase() : Constants.DEFAULT_TENANT;
+        namespace = ConfigurationRepository.lookup().isValidNamespace(namespace) ? namespace.toUpperCase() : Constants.DEFAULT_NAMESPACE;
+        hints = hints == null || hints.length == 0 ? new Hint[]{Hint.EXTERNAL_LOOKUP, Hint.NODE_SPECIFIC} : hints;
+        T returnValue;
+        returnValue = getInternal(tenant, namespace, key, clazz, hints);
+        if ((returnValue == null || ConfigurationUtils.isZeroLengthArray(clazz, returnValue)) && !Constants.DEFAULT_TENANT.equals(tenant)) {
+            returnValue = getInternal(Constants.DEFAULT_TENANT, namespace, key, clazz, hints);
+        }
+        if ((returnValue == null || ConfigurationUtils.isZeroLengthArray(clazz, returnValue)) && !Constants.DEFAULT_NAMESPACE.equals(namespace)) {
+            returnValue = getInternal(tenant, Constants.DEFAULT_NAMESPACE, key, clazz, hints);
+        }
+        if ((returnValue == null || ConfigurationUtils.isZeroLengthArray(clazz, returnValue)) && !Constants.DEFAULT_NAMESPACE.equals(namespace)
+            && !Constants.DEFAULT_TENANT.equals(tenant)) {
+            returnValue = getInternal(Constants.DEFAULT_TENANT, Constants.DEFAULT_NAMESPACE, key, clazz, hints);
+        }
+        if (returnValue == null && ConfigurationUtils.isAPrimitive(clazz)) {
+            returnValue = (T) ConfigurationUtils.getDefaultFor(clazz);
+        }
+        return returnValue;
+    }
+
+    @Override
+    public <T> Map<String, T> populateMap(String tenantId, String namespace, String key, Class<T> clazz) {
+        final String calculatedTenantId = calculateTenant(tenantId);
+        final String calculatedNamespace = calculateNamespace(namespace);
+        Map<String, T> map = new HashMap<>();
+        Iterator<String> keys;
+        try {
+            keys = ConfigurationRepository.lookup().getConfigurationFor(calculatedTenantId, calculatedNamespace).getKeys(key);
+            keys.forEachRemaining(k -> {
+                if (k.startsWith(key + ".")) {
+                    k = k.substring(key.length() + 1);
+                    String subkey = k.substring(0, k.indexOf('.'));
+                    if (!map.containsKey(subkey)) {
+                        map.put(subkey, get(calculatedTenantId, calculatedNamespace, key + "." + subkey, clazz));
+                    }
+                }
+            });
+        } catch (Exception e) {
+            LOGGER.warn("Couldn't populate map fot tenant: {}, namespace: {}, key: {}, type: {}", tenantId, namespace, key, clazz.getSimpleName(), e);
+        }
+        return map;
+    }
+
+    @Override
+    public Map<Object, Object> generateMap(String tenantId, String namespace, String key) {
+        final String calculatedTenantId = calculateTenant(tenantId);
+        final String calculatedNamespace = calculateNamespace(namespace);
+        Map<Object, Object> parentMap = new HashMap<>();
+        Iterator<String> configKeys;
+        try {
+            if (isBlank(key)) {
+                configKeys = ConfigurationRepository.lookup().getConfigurationFor(calculatedTenantId, calculatedNamespace).getKeys();
+            } else {
+                configKeys = ConfigurationRepository.lookup().getConfigurationFor(calculatedTenantId, calculatedNamespace).getKeys(key);
+            }
+            configKeys.forEachRemaining(subKey -> {
+                if (!isBlank(key) && !subKey.startsWith(key + ".")) {
+                    configKeys.remove();
+                }
+                parseConfigSubKeys(subKey, key, calculatedTenantId, calculatedNamespace, parentMap);
+            });
+        } catch (Exception e) {
+            LOGGER.warn("Couldn't generate map fot tenant: {}, namespace: {}, key: {}", tenantId, namespace, key, e);
+        }
+        return parentMap;
+    }
+
     private void parseConfigSubKeys(String subKey, String keyPrefix, String tenantId, String namespace, Map<Object, Object> targetMap) {
         String value = getAsString(tenantId, namespace, subKey);
         if (!isBlank(keyPrefix) && subKey.startsWith(keyPrefix + ".")) {
@@ -318,18 +298,14 @@ public class ConfigurationImpl implements org.onap.config.api.Configuration {
                 processingHints = processingHints | hint.value();
             }
         }
-
         tenant = calculateTenant(tenant);
         namespace = calculateNamespace(namespace);
-
         if (isBlank(key) && !clazz.isAnnotationPresent(Config.class)) {
             throw new IllegalArgumentException(KEY_CANNOT_BE_NULL);
         }
-
         if (clazz == null) {
             throw new IllegalArgumentException("clazz is null.");
         }
-
         if (ConfigurationUtils.isAPrimitive(clazz)) {
             clazz = getWrapperClass(clazz);
         }
@@ -341,43 +317,31 @@ public class ConfigurationImpl implements org.onap.config.api.Configuration {
             } else if (clazz.isAnnotationPresent(Config.class)) {
                 return getAnnotatedTypeValue(tenant, namespace, clazz, isBlank(key) ? "" : (key + "."), hints);
             } else {
-                throw new IllegalArgumentException(
-                        "Only primitive classes, wrapper classes, corresponding array classes and any "
-                                + "class decorated with @org.openecomp.config.api.Config are allowed as argument.");
+                throw new IllegalArgumentException("Only primitive classes, wrapper classes, corresponding array classes and any "
+                    + "class decorated with @org.openecomp.config.api.Config are allowed as argument.");
             }
         } catch (Exception exception) {
-            LOGGER.warn(
-                    "Failed to get internal value fot tenant: {}, namespace: {}, key: {}, type: {}",
-                    tenant,
-                    namespace,
-                    key,
-                    clazz.getSimpleName(),
-                    exception
-            );
+            LOGGER
+                .warn("Failed to get internal value fot tenant: {}, namespace: {}, key: {}, type: {}", tenant, namespace, key, clazz.getSimpleName(),
+                    exception);
         }
         return null;
     }
 
     private <T> T getWrapperTypeValue(String tenant, String namespace, String key, Class<T> clazz, int processingHints) throws Exception {
-        Object obj = ConfigurationUtils.getProperty(
-                ConfigurationRepository.lookup().getConfigurationFor(tenant, namespace), key, processingHints);
+        Object obj = ConfigurationUtils.getProperty(ConfigurationRepository.lookup().getConfigurationFor(tenant, namespace), key, processingHints);
         if (obj != null) {
             if (ConfigurationUtils.isCollection(obj.toString())) {
                 obj = ConfigurationUtils.getCollectionString(obj.toString());
             }
-            String value = ConfigurationUtils.processVariablesIfPresent(
-                    tenant,
-                    namespace,
-                    obj.toString().split(",")[0]
-            );
+            String value = ConfigurationUtils.processVariablesIfPresent(tenant, namespace, obj.toString().split(",")[0]);
             return (T) getTypeValue(value, clazz, processingHints);
         }
         return null;
     }
 
     private <T> T getArrayTypeValue(String tenant, String namespace, String key, Class<T> clazz, int processingHints) throws Exception {
-        Object obj = ConfigurationUtils.getProperty(
-                ConfigurationRepository.lookup().getConfigurationFor(tenant, namespace), key, processingHints);
+        Object obj = ConfigurationUtils.getProperty(ConfigurationRepository.lookup().getConfigurationFor(tenant, namespace), key, processingHints);
         if (obj != null) {
             Class componentType = clazz.getComponentType();
             if (ConfigurationUtils.isAPrimitivesArray(clazz)) {
@@ -388,11 +352,8 @@ public class ConfigurationImpl implements org.onap.config.api.Configuration {
             for (String itemValue : collString.split(",")) {
                 tempCollection.add(ConfigurationUtils.processVariablesIfPresent(tenant, namespace, itemValue));
             }
-            Collection<T> collection = convert(
-                    ConfigurationUtils.getCollectionString(Arrays.toString(tempCollection.toArray())),
-                    (Class<T>) componentType,
-                    processingHints
-            );
+            Collection<T> collection = convert(ConfigurationUtils.getCollectionString(Arrays.toString(tempCollection.toArray())),
+                (Class<T>) componentType, processingHints);
             if (ConfigurationUtils.isAPrimitivesArray(clazz)) {
                 return (T) ConfigurationUtils.getPrimitiveArray(collection, componentType);
             } else {
@@ -403,27 +364,8 @@ public class ConfigurationImpl implements org.onap.config.api.Configuration {
         }
     }
 
-    private static String calculateNamespace(String namespace) {
-
-        if (isBlank(namespace)) {
-            return Constants.DEFAULT_NAMESPACE;
-        }
-
-        return namespace.toUpperCase();
-    }
-
-    private static String calculateTenant(String tenant) {
-
-        if (isBlank(tenant)) {
-            return Constants.DEFAULT_TENANT;
-        }
-
-        return tenant.toUpperCase();
-    }
-
     private <T> T getAnnotatedTypeValue(String tenant, String namespace, Class<T> clazz, String keyPrefix, Hint... hints)
-            throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
-
+        throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
         Config confAnnotation = clazz.getAnnotation(Config.class);
         if (confAnnotation != null && confAnnotation.key().length() > 0 && !keyPrefix.endsWith(".")) {
             keyPrefix += (confAnnotation.key() + ".");
@@ -438,8 +380,7 @@ public class ConfigurationImpl implements org.onap.config.api.Configuration {
             if (fieldConfAnnotation == null) {
                 continue;
             }
-            if (ConfigurationUtils.isAPrimitiveOrWrapper(fieldType) ||
-                ConfigurationUtils.isAPrimitivesOrWrappersArray(fieldType)) {
+            if (ConfigurationUtils.isAPrimitiveOrWrapper(fieldType) || ConfigurationUtils.isAPrimitivesOrWrappersArray(fieldType)) {
                 setPrimitiveField(field, objToReturn, tenant, namespace, keyPrefix, hints);
             }
             if (ConfigurationUtils.isACollection(fieldType)) {
@@ -453,25 +394,23 @@ public class ConfigurationImpl implements org.onap.config.api.Configuration {
     }
 
     private void setPrimitiveField(Field field, Object objToReturn, String tenant, String namespace, String keyPrefix, Hint[] hints)
-            throws IllegalAccessException {
+        throws IllegalAccessException {
         String fieldConfAnnotationKey = field.getAnnotation(Config.class).key();
         Class<?> fieldType = field.getType();
         field.set(objToReturn, get(tenant, namespace, keyPrefix + fieldConfAnnotationKey, fieldType, hints));
     }
 
-    private void setMapField(Field field, Object objToReturn, String tenant, String namespace, String keyPrefix)
-            throws IllegalAccessException {
+    private void setMapField(Field field, Object objToReturn, String tenant, String namespace, String keyPrefix) throws IllegalAccessException {
         String fieldConfAnnotationKey = field.getAnnotation(Config.class).key();
         field.set(objToReturn, generateMap(tenant, namespace, keyPrefix + fieldConfAnnotationKey));
     }
 
     private void setCollectionField(Field field, Object objToReturn, String tenant, String namespace, String keyPrefix, Hint[] hints)
-            throws IllegalAccessException, InvocationTargetException, InstantiationException {
+        throws IllegalAccessException, InvocationTargetException, InstantiationException {
         String fieldConfAnnotationKey = field.getAnnotation(Config.class).key();
         Class<?> fieldType = field.getType();
         Object obj = get(tenant, namespace, keyPrefix + fieldConfAnnotationKey,
-                ConfigurationUtils.getArrayClass(ConfigurationUtils.getCollectionGenericType(field)),
-                hints);
+            ConfigurationUtils.getArrayClass(ConfigurationUtils.getCollectionGenericType(field)), hints);
         if (obj == null) {
             return;
         }
@@ -480,20 +419,16 @@ public class ConfigurationImpl implements org.onap.config.api.Configuration {
         if (fieldType.isInterface()) {
             clazzToInstantiate = ConfigurationUtils.getConcreteCollection(fieldType).getClass();
         } else if (Modifier.isAbstract(fieldType.getModifiers())) {
-            clazzToInstantiate =
-                    ConfigurationUtils.getCompatibleCollectionForAbstractDef(fieldType)
-                            .getClass();
+            clazzToInstantiate = ConfigurationUtils.getCompatibleCollectionForAbstractDef(fieldType).getClass();
         } else {
             clazzToInstantiate = fieldType;
         }
         Constructor construct = getConstructorWithArguments(clazzToInstantiate, Collection.class);
-
         if (construct != null) {
             construct.setAccessible(true);
             field.set(objToReturn, construct.newInstance(list));
         } else {
-            construct = getConstructorWithArguments(clazzToInstantiate, Integer.class,
-                   Boolean.class, Collection.class);
+            construct = getConstructorWithArguments(clazzToInstantiate, Integer.class, Boolean.class, Collection.class);
             if (construct != null) {
                 construct.setAccessible(true);
                 field.set(objToReturn, construct.newInstance(list.size(), true, list));
@@ -555,8 +490,7 @@ public class ConfigurationImpl implements org.onap.config.api.Configuration {
     private <T> T getValueForStringType(Object obj, int processingHint) {
         if (obj.toString().startsWith("@") && ConfigurationUtils.isExternalLookup(processingHint)) {
             String subString = obj.toString().substring(1).trim();
-            String contents = ConfigurationUtils.getFileContents(
-                    NON_CONFIG_RESOURCE.locate(subString));
+            String contents = ConfigurationUtils.getFileContents(NON_CONFIG_RESOURCE.locate(subString));
             if (contents == null) {
                 contents = ConfigurationUtils.getFileContents(subString);
             }
index 7b2e267..9be4c26 100644 (file)
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onap.config.impl;
 
 import java.io.File;
@@ -40,26 +39,20 @@ public final class ConfigurationRepository {
 
     private static final Logger logger = LoggerFactory.getLogger(ConfigurationRepository.class);
     private static final ConfigurationRepository REPO = new ConfigurationRepository();
-
     private final Set<String> tenants = Collections.synchronizedSet(new HashSet<>());
-
     private final Set<String> namespaces = Collections.synchronizedSet(new HashSet<>());
-
-    private final Map<String, ConfigurationHolder> store = Collections.synchronizedMap(
-
-            new LinkedHashMap<String, ConfigurationHolder>(16, 0.75f, true) {
-
-                @Override
-                protected boolean removeEldestEntry(Map.Entry eldest) {
-                    try {
-                        return size() > getConfigurationFor(Constants.DEFAULT_TENANT, Constants.DB_NAMESPACE)
-                                .getInt("config.size.max");
-                    } catch (Exception exception) {
-                        logger.info("ConfigurationException", exception);
-                        return false;
-                    }
+    private final Map<String, ConfigurationHolder> store = Collections
+        .synchronizedMap(new LinkedHashMap<String, ConfigurationHolder>(16, 0.75f, true) {
+            @Override
+            protected boolean removeEldestEntry(Map.Entry eldest) {
+                try {
+                    return size() > getConfigurationFor(Constants.DEFAULT_TENANT, Constants.DB_NAMESPACE).getInt("config.size.max");
+                } catch (Exception exception) {
+                    logger.info("ConfigurationException", exception);
+                    return false;
                 }
-            });
+            }
+        });
 
     private ConfigurationRepository() {
         tenants.add(Constants.DEFAULT_TENANT);
@@ -106,22 +99,18 @@ public final class ConfigurationRepository {
     }
 
     public void populateOverrideConfiguration(String key, File file) {
-
         ConfigurationHolder holder = store.get(key);
-
         if (holder == null) {
             holder = new ConfigurationHolder(new CombinedConfiguration());
             store.put(key, holder);
         }
-
         holder.addOverrideConfiguration(file.getAbsolutePath(), ConfigurationUtils.getConfigurationBuilder(file));
         populateTenantsNamespace(key);
     }
 
     private class ConfigurationHolder {
 
-        private final Map<String, FileBasedConfigurationBuilder<FileBasedConfiguration>> overrideConfiguration =
-                new LinkedHashMap<>();
+        private final Map<String, FileBasedConfigurationBuilder<FileBasedConfiguration>> overrideConfiguration = new LinkedHashMap<>();
         private BasicConfigurationBuilder<Configuration> builder;
         private Timestamp lastConfigurationBuildTime;
         private Configuration config;
@@ -160,17 +149,13 @@ public final class ConfigurationRepository {
             if (config == null) {
                 config = builder.getConfiguration();
                 lastConfigurationBuildTime = new Timestamp(System.currentTimeMillis());
-            } else if (lastConfigurationBuildTime != null
-                    && System.currentTimeMillis() - lastConfigurationBuildTime.getTime()
-                    > getConfigurationFor(Constants.DEFAULT_TENANT, Constants.DB_NAMESPACE)
-                    .getInt("config.refresh.interval")) {
+            } else if (lastConfigurationBuildTime != null && System.currentTimeMillis() - lastConfigurationBuildTime.getTime() > getConfigurationFor(
+                Constants.DEFAULT_TENANT, Constants.DB_NAMESPACE).getInt("config.refresh.interval")) {
                 lastConfigurationBuildTime = new Timestamp(System.currentTimeMillis());
             }
-
             if (composite == null && overrideConfiguration.size() != 0) {
                 composite = getEffectiveConfiguration(config, overrideConfiguration.values());
             }
-
             return overrideConfiguration.size() == 0 ? config : composite;
         }
     }
index bdaf219..d7b8df1 100644 (file)
@@ -13,7 +13,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onap.config.impl;
 
 import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
@@ -30,5 +29,4 @@ public class YamlConfiguration extends JacksonConfiguration {
     public YamlConfiguration() {
         super(new YAMLFactory());
     }
-
 }
index e054236..e9fc843 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onap.config.type;
 
-import org.onap.config.Constants;
 import lombok.Getter;
 import lombok.ToString;
+import org.onap.config.Constants;
 
 @ToString
 @Getter
@@ -59,7 +58,6 @@ public class ConfigurationQuery {
         return this;
     }
 
-
     public ConfigurationQuery namespace(String id) {
         if (id != null) {
             namespace = id;
index 0ac976a..5a3a36c 100644 (file)
@@ -17,7 +17,6 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.onap.sdc.gab;
 
 import java.io.IOException;
@@ -28,9 +27,9 @@ import org.onap.sdc.gab.model.GABResults;
  * <pre>
  *     SDC/DCAE-DS FM/PM artifact browser service.
  * </pre>
- *
- * Currently the artifact browser is able to parse VES_EVENT_REGISTRATION action (registering of all VES events -
- * including alarms/faults) to serve required data from the given document.
+ * <p>
+ * Currently the artifact browser is able to parse VES_EVENT_REGISTRATION action (registering of all VES events - including alarms/faults) to serve
+ * required data from the given document.
  *
  * @version %I%, %G%
  * @since 1.4.0-SNAPSHOT
@@ -41,17 +40,13 @@ public interface GABService {
      * Extracting event data based on given YAML paths. As an output, a list of results is returned.
      *
      * @param gabQuery the parameter should contain three entries:
-     * <br>* JSON paths for querying specific data
-     * <br>* path/content of YAML document containing faults/measurements data
-     * <br>* type of the query - can be defined as a PATH or CONTENT depends of document-parameter type
-     *
-     * @exception IOException thrown in case of file/content problem.
+     *                 <br>* JSON paths for querying specific data
+     *                 <br>* path/content of YAML document containing faults/measurements data
+     *                 <br>* type of the query - can be defined as a PATH or CONTENT depends of document-parameter type
      * @return Result of search the query inside the given document.
-     *
+     * @throws IOException thrown in case of file/content problem.
      * @see GABResults
      * @see GABQuery
      */
     GABResults searchFor(GABQuery gabQuery) throws IOException;
-
 }
-
index 0a8a206..900c71a 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.onap.sdc.gab;
 
 import java.io.IOException;
-
 import org.onap.sdc.gab.model.GABQuery;
 import org.onap.sdc.gab.model.GABQuery.GABQueryType;
 import org.onap.sdc.gab.model.GABResults;
@@ -37,7 +35,7 @@ public class GABServiceImpl implements GABService {
     }
 
     private GABYamlParser parse(GABQuery gabQuery, GABYamlParser gabYamlParser) {
-        return gabQuery.getType() == GABQueryType.PATH
-                ? gabYamlParser.parseFile(gabQuery.getDocument()) : gabYamlParser.parseContent(gabQuery.getDocument());
+        return gabQuery.getType() == GABQueryType.PATH ? gabYamlParser.parseFile(gabQuery.getDocument())
+            : gabYamlParser.parseContent(gabQuery.getDocument());
     }
 }
index cbe7ef3..2015790 100644 (file)
@@ -17,7 +17,6 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.onap.sdc.gab.model;
 
 import java.util.Set;
@@ -31,30 +30,22 @@ import lombok.Getter;
 @Getter
 public class GABQuery {
 
-    /**
-     * PATH - when provided path to the yaml file
-     * CONTENT - when provided yaml file content
-     */
-    public enum GABQueryType {
-        PATH, CONTENT
-    }
-
     /**
      * JSON paths for querying specific data (this will be the definition of a "column").
      */
     private Set<String> fields;
-
     /**
      * An YAML document path/content
      */
     private String document;
-
     /**
      * Used for query type checking.
      *
      * @see GABQueryType
-     *
      */
     private GABQueryType type;
-
+    /**
+     * PATH - when provided path to the yaml file CONTENT - when provided yaml file content
+     */
+    public enum GABQueryType {PATH, CONTENT}
 }
index 3338024..13d713a 100644 (file)
@@ -17,7 +17,6 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.onap.sdc.gab.model;
 
 import com.google.common.base.MoreObjects;
@@ -44,5 +43,4 @@ public class GABResult {
     public String toString() {
         return MoreObjects.toStringHelper(this).add("entries", entries).toString();
     }
-
 }
index cc6abd5..f953577 100644 (file)
@@ -17,7 +17,6 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.onap.sdc.gab.model;
 
 import com.google.common.base.MoreObjects;
@@ -30,22 +29,20 @@ import lombok.Getter;
 @Getter
 @AllArgsConstructor
 public class GABResultEntry {
+
     /**
      * Path of queried data.
      */
     private String path;
-
     /**
      * Specific events-template data served by the GABService
+     *
      * @see GABService
      */
     private Object data;
 
     @Override
     public String toString() {
-        return MoreObjects.toStringHelper(this)
-            .add("path", path)
-            .add("data", data)
-            .toString();
+        return MoreObjects.toStringHelper(this).add("path", path).add("data", data).toString();
     }
 }
index fae9442..3b9ff09 100644 (file)
@@ -17,7 +17,6 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.onap.sdc.gab.yaml;
 
 import java.io.IOException;
@@ -94,21 +93,18 @@ public class GABYamlParser implements AutoCloseable {
     /**
      * Collects the results from parsed yaml file and applied filters.
      *
-     * @exception IOException Means that yaml file has invalid content.
      * @return {@link GABResults}
+     * @throws IOException Means that yaml file has invalid content.
      */
     public GABResults collect() throws IOException {
-        return new GABResults(yamlParser.collect().stream()
-            .map(results -> new GABResult(createGabResultEntryList(results)))
-            .collect(Collectors.toList()));
+        return new GABResults(
+            yamlParser.collect().stream().map(results -> new GABResult(createGabResultEntryList(results))).collect(Collectors.toList()));
     }
 
     private List<GABResultEntry> createGabResultEntryList(List<SimpleEntry<String, ? extends Collection<Object>>> parsedContent) {
         return Objects.isNull(parsedContent) ? Collections.emptyList() : parsedContent.stream()
-                .map(result -> result.getValue().stream()
-                    .map(entry -> new GABResultEntry(result.getKey(), entry))
-                    .collect(Collectors.toList())).flatMap(Collection::stream)
-                .collect(Collectors.toList());
+            .map(result -> result.getValue().stream().map(entry -> new GABResultEntry(result.getKey(), entry)).collect(Collectors.toList()))
+            .flatMap(Collection::stream).collect(Collectors.toList());
     }
 
     @Override
index 2dbb8ad..ab8bb9d 100644 (file)
@@ -17,7 +17,6 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.onap.sdc.gab.yaml;
 
 import com.google.gson.Gson;
@@ -54,7 +53,6 @@ import org.yaml.snakeyaml.Yaml;
 public class YamlParser implements AutoCloseable {
 
     private static final Logger LOGGER = Logger.getLogger(YamlParser.class.getName());
-
     private Stream<Object> parsedYamlContent;
     private InputStream inputStream;
     private Set<String> filters;
@@ -119,8 +117,8 @@ public class YamlParser implements AutoCloseable {
     /**
      * Collects the results from parsed yaml file and applied filters.
      *
-     * @exception IOException Means that yaml file has invalid content.
      * @return List of List of simple entry 'key: collection of data'
+     * @throws IOException Means that yaml file has invalid content.
      */
     List<List<SimpleEntry<String, ? extends Collection<Object>>>> collect() throws IOException {
         try {
@@ -145,12 +143,8 @@ public class YamlParser implements AutoCloseable {
         }
     }
 
-    private List<SimpleEntry<String, ? extends Collection<Object>>> findInJson(Set<String> keys,
-        JsonElement document) {
-        return keys.stream()
-            .map(getEntryForKeyFunction(document))
-            .filter(notEmptyEntryPredicate())
-            .collect(Collectors.toList());
+    private List<SimpleEntry<String, ? extends Collection<Object>>> findInJson(Set<String> keys, JsonElement document) {
+        return keys.stream().map(getEntryForKeyFunction(document)).filter(notEmptyEntryPredicate()).collect(Collectors.toList());
     }
 
     private Predicate<? super List<SimpleEntry<String, ? extends Collection<Object>>>> notEmptyListPredicate() {
@@ -161,8 +155,7 @@ public class YamlParser implements AutoCloseable {
         return entry -> !entry.getValue().isEmpty();
     }
 
-    private Function<String, SimpleEntry<String, ? extends Collection<Object>>> getEntryForKeyFunction(
-        JsonElement document) {
+    private Function<String, SimpleEntry<String, ? extends Collection<Object>>> getEntryForKeyFunction(JsonElement document) {
         return key -> {
             JsonSurfer surfer = JsonSurferGson.INSTANCE;
             try {
index 42d9d10..abcb8b5 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.
@@ -17,7 +17,6 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.onap.sdc.tosca.datatypes.model;
 
 import lombok.Getter;
@@ -27,9 +26,8 @@ import lombok.Setter;
 @Setter
 public class ActivityDefinition {
 
-  private String delegate;
-  private String set_state;
-  private String call_operation;
-  private String inline;
-
+    private String delegate;
+    private String set_state;
+    private String call_operation;
+    private String inline;
 }
index 11f5354..90809f0 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.onap.sdc.tosca.datatypes.model;
 
-
 import lombok.Getter;
 import lombok.Setter;
 
 @Getter
 @Setter
 public class ArtifactDefinition {
-  private String type;
-  private String file;
-  private String repository;
-  private String description;
-  private String deploy_path;
 
+    private String type;
+    private String file;
+    private String repository;
+    private String description;
+    private String deploy_path;
 }
index 54ca308..8b80a95 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.
@@ -17,7 +17,6 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.onap.sdc.tosca.datatypes.model;
 
 import java.util.List;
@@ -25,18 +24,15 @@ import java.util.Map;
 import lombok.Getter;
 import lombok.Setter;
 
-
 @Getter
 @Setter
 public class ArtifactType {
 
-  private String derived_from;
-  private String version;
-  private Map<String, String> metadata;
-  private String description;
-  private String mime_type;
-  private List<String> file_ext;
-  private Map<String, PropertyDefinition> properties;
-
-
+    private String derived_from;
+    private String version;
+    private Map<String, String> metadata;
+    private String description;
+    private String mime_type;
+    private List<String> file_ext;
+    private Map<String, PropertyDefinition> properties;
 }
index 9dfbc39..ab988fe 100644 (file)
@@ -17,7 +17,6 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.onap.sdc.tosca.datatypes.model;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
@@ -41,10 +40,7 @@ public class AttributeDefinition implements Cloneable {
         status = Status.SUPPORTED.getName();
     }
 
-    public AttributeDefinition(final String type,
-                               final String description,
-                               final Object _default,
-                               final String status,
+    public AttributeDefinition(final String type, final String description, final Object _default, final String status,
                                final EntrySchema entry_schema) {
         this.setType(type);
         this.setDescription(description);
@@ -60,8 +56,7 @@ public class AttributeDefinition implements Cloneable {
         attributeDefinition.setDescription(this.getDescription());
         attributeDefinition.set_default(this.get_default());
         attributeDefinition.setStatus(this.getStatus());
-        attributeDefinition.setEntry_schema(
-            Objects.isNull(this.getEntry_schema()) ? null : this.getEntry_schema().clone());
+        attributeDefinition.setEntry_schema(Objects.isNull(this.getEntry_schema()) ? null : this.getEntry_schema().clone());
         return attributeDefinition;
     }
 }
index bed4e8c..e16d5cf 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.onap.sdc.tosca.datatypes.model;
 
 import java.util.Map;
 
-
-
 public class CapabilityAssignment {
 
-  private Map<String, Object> properties;
-  private Map<String, Object> attributes;
+    private Map<String, Object> properties;
+    private Map<String, Object> attributes;
 
-  public Map<String, Object> getProperties() {
-    return properties;
-  }
+    public Map<String, Object> getProperties() {
+        return properties;
+    }
 
-  public void setProperties(Map<String, Object> properties) {
-    this.properties = properties;
-  }
+    public void setProperties(Map<String, Object> properties) {
+        this.properties = properties;
+    }
 
-  public Map<String, Object> getAttributes() {
-    return attributes;
-  }
+    public Map<String, Object> getAttributes() {
+        return attributes;
+    }
 
-  public void setAttributes(Map<String, Object> attributes) {
-    this.attributes = attributes;
-  }
+    public void setAttributes(Map<String, Object> attributes) {
+        this.attributes = attributes;
+    }
 }
index 4d0a38a..144822d 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.onap.sdc.tosca.datatypes.model;
 
-import org.onap.sdc.tosca.services.DataModelCloneUtil;
-
 import java.util.List;
 import java.util.Map;
+import org.onap.sdc.tosca.services.DataModelCloneUtil;
 
 public class CapabilityDefinition implements Cloneable {
 
-  private String type;
-  private String description;
-  private Map<String, PropertyDefinition> properties;
-  private Map<String, AttributeDefinition> attributes;
-  private List<String> valid_source_types;
-  private Object[] occurrences;
-
-
-  /**
-   * Constructor.
-   */
-  public CapabilityDefinition() {
-    occurrences = new Object[2];
-    occurrences[0] = 1;
-    occurrences[1] = "UNBOUNDED";
-  }
-
-  public String getType() {
-    return type;
-  }
-
-  public void setType(String type) {
-    this.type = type;
-  }
-
-  public String getDescription() {
-    return description;
-  }
-
-  public void setDescription(String description) {
-    this.description = description;
-  }
-
-  public Map<String, PropertyDefinition> getProperties() {
-    return properties;
-  }
-
-  public void setProperties(Map<String, PropertyDefinition> properties) {
-    this.properties = properties;
-  }
-
-  public Map<String, AttributeDefinition> getAttributes() {
-    return attributes;
-  }
-
-  public void setAttributes(Map<String, AttributeDefinition> attributes) {
-    this.attributes = attributes;
-  }
-
-  public List<String> getValid_source_types() {
-    return valid_source_types;
-  }
-
-  public void setValid_source_types(List<String> valid_source_types) {
-    this.valid_source_types = valid_source_types;
-  }
-
-  public Object[] getOccurrences() {
-    return occurrences;
-  }
-
-  public void setOccurrences(Object[] occurrences) {
-    this.occurrences = occurrences;
-  }
-
-  @Override
-  public CapabilityDefinition clone() {
-    CapabilityDefinition capabilityDefinition = new CapabilityDefinition();
-    capabilityDefinition
-        .setOccurrences(new Object[]{this.getOccurrences()[0], this.getOccurrences()[1]});
-    capabilityDefinition
-        .setProperties(DataModelCloneUtil.clonePropertyDefinitions(this.getProperties()));
-    capabilityDefinition.setType(this.getType());
-    capabilityDefinition
-        .setAttributes(DataModelCloneUtil.cloneAttributeDefinitions(this.getAttributes()));
-    capabilityDefinition.setDescription(this.getDescription());
-    capabilityDefinition
-        .setValid_source_types(DataModelCloneUtil.cloneListString(this.getValid_source_types()));
-    return capabilityDefinition;
-
-  }
-
+    private String type;
+    private String description;
+    private Map<String, PropertyDefinition> properties;
+    private Map<String, AttributeDefinition> attributes;
+    private List<String> valid_source_types;
+    private Object[] occurrences;
+
+    /**
+     * Constructor.
+     */
+    public CapabilityDefinition() {
+        occurrences = new Object[2];
+        occurrences[0] = 1;
+        occurrences[1] = "UNBOUNDED";
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public Map<String, PropertyDefinition> getProperties() {
+        return properties;
+    }
+
+    public void setProperties(Map<String, PropertyDefinition> properties) {
+        this.properties = properties;
+    }
+
+    public Map<String, AttributeDefinition> getAttributes() {
+        return attributes;
+    }
+
+    public void setAttributes(Map<String, AttributeDefinition> attributes) {
+        this.attributes = attributes;
+    }
+
+    public List<String> getValid_source_types() {
+        return valid_source_types;
+    }
+
+    public void setValid_source_types(List<String> valid_source_types) {
+        this.valid_source_types = valid_source_types;
+    }
+
+    public Object[] getOccurrences() {
+        return occurrences;
+    }
+
+    public void setOccurrences(Object[] occurrences) {
+        this.occurrences = occurrences;
+    }
+
+    @Override
+    public CapabilityDefinition clone() {
+        CapabilityDefinition capabilityDefinition = new CapabilityDefinition();
+        capabilityDefinition.setOccurrences(new Object[]{this.getOccurrences()[0], this.getOccurrences()[1]});
+        capabilityDefinition.setProperties(DataModelCloneUtil.clonePropertyDefinitions(this.getProperties()));
+        capabilityDefinition.setType(this.getType());
+        capabilityDefinition.setAttributes(DataModelCloneUtil.cloneAttributeDefinitions(this.getAttributes()));
+        capabilityDefinition.setDescription(this.getDescription());
+        capabilityDefinition.setValid_source_types(DataModelCloneUtil.cloneListString(this.getValid_source_types()));
+        return capabilityDefinition;
+    }
 }
index dc868c9..682a159 100644 (file)
@@ -13,7 +13,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onap.sdc.tosca.datatypes.model;
 
 import java.util.List;
@@ -23,7 +22,6 @@ import java.util.Map;
  * @author KATYR
  * @since May 13, 2018
  */
-
 public class CapabilityFilter {
 
     private List<Map<String, List<Constraint>>> properties;
@@ -40,5 +38,4 @@ public class CapabilityFilter {
     public String toString() {
         return "CapabilityFilter{" + "properties=" + properties + '}';
     }
-
 }
index a6368f8..403b48e 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.onap.sdc.tosca.datatypes.model;
 
 import java.util.List;
 import java.util.Map;
 
-
-
 public class CapabilityType {
 
-  private String derived_from;
-  private String version;
-  private String description;
-  private Map<String, PropertyDefinition> properties;
-  private Map<String, AttributeDefinition> attributes;
-  private List<String> valid_source_types;
+    private String derived_from;
+    private String version;
+    private String description;
+    private Map<String, PropertyDefinition> properties;
+    private Map<String, AttributeDefinition> attributes;
+    private List<String> valid_source_types;
 
-  public String getDerived_from() {
-    return derived_from;
-  }
+    public String getDerived_from() {
+        return derived_from;
+    }
 
-  public void setDerived_from(String derived_from) {
-    this.derived_from = derived_from;
-  }
+    public void setDerived_from(String derived_from) {
+        this.derived_from = derived_from;
+    }
 
-  public String getVersion() {
-    return version;
-  }
+    public String getVersion() {
+        return version;
+    }
 
-  public void setVersion(String version) {
-    this.version = version;
-  }
+    public void setVersion(String version) {
+        this.version = version;
+    }
 
-  public String getDescription() {
-    return description;
-  }
+    public String getDescription() {
+        return description;
+    }
 
-  public void setDescription(String description) {
-    this.description = description;
-  }
+    public void setDescription(String description) {
+        this.description = description;
+    }
 
-  public Map<String, PropertyDefinition> getProperties() {
-    return properties;
-  }
+    public Map<String, PropertyDefinition> getProperties() {
+        return properties;
+    }
 
-  public void setProperties(Map<String, PropertyDefinition> properties) {
-    this.properties = properties;
-  }
+    public void setProperties(Map<String, PropertyDefinition> properties) {
+        this.properties = properties;
+    }
 
-  public Map<String, AttributeDefinition> getAttributes() {
-    return attributes;
-  }
+    public Map<String, AttributeDefinition> getAttributes() {
+        return attributes;
+    }
 
-  public void setAttributes(Map<String, AttributeDefinition> attributes) {
-    this.attributes = attributes;
-  }
+    public void setAttributes(Map<String, AttributeDefinition> attributes) {
+        this.attributes = attributes;
+    }
 
-  public List<String> getValid_source_types() {
-    return valid_source_types;
-  }
+    public List<String> getValid_source_types() {
+        return valid_source_types;
+    }
 
-  public void setValid_source_types(List<String> valid_source_types) {
-    this.valid_source_types = valid_source_types;
-  }
+    public void setValid_source_types(List<String> valid_source_types) {
+        this.valid_source_types = valid_source_types;
+    }
 }
index f85ea5c..628e094 100644 (file)
@@ -13,7 +13,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onap.sdc.tosca.datatypes.model;
 
 import java.util.Map;
@@ -26,5 +25,4 @@ public class Condition {
     private String period;
     private Integer evaluations;
     private String method;
-
 }
index 5b62af0..b0bf137 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.onap.sdc.tosca.datatypes.model;
 
 import java.util.ArrayList;
 import java.util.List;
-
 import lombok.Getter;
 import lombok.NoArgsConstructor;
 import lombok.Setter;
@@ -32,58 +30,58 @@ import lombok.Setter;
 @NoArgsConstructor
 public class Constraint implements Cloneable {
 
-  private Object equal;
-  private Object greater_or_equal;
-  private Object greater_than;
-  private Object less_than;
-  private Object less_or_equal;
-  private Object[] in_range;
-  private List<Object> valid_values;
-  private Integer length;
-  private Integer min_length;
-  private Integer max_length;
-  private Object pattern;
-
-  /**
-   * Sets in_range attribute.
-   * @param in_range.
-   */
-  public void setIn_range(Object[] in_range) {
-    this.in_range = new Object[2];
-    this.in_range[0] = in_range[0];
-    this.in_range[1] = in_range[1];
-  }
+    private Object equal;
+    private Object greater_or_equal;
+    private Object greater_than;
+    private Object less_than;
+    private Object less_or_equal;
+    private Object[] in_range;
+    private List<Object> valid_values;
+    private Integer length;
+    private Integer min_length;
+    private Integer max_length;
+    private Object pattern;
 
-  @Override
-  public Constraint clone() {
-    Constraint constraint = new Constraint();
-    constraint.setEqual(this.getEqual());
-    constraint.setGreater_or_equal(this.getGreater_or_equal());
-    constraint.setGreater_than(this.getGreater_than());
-    cloneInRange(constraint);
-    constraint.setLength(this.getLength());
-    constraint.setLess_or_equal(this.getLess_or_equal());
-    constraint.setLess_than(this.getLess_than());
-    constraint.setMax_length(this.getMax_length());
-    constraint.setMin_length(this.getMin_length());
-    constraint.setPattern(this.getPattern());
-    cloneValidValues(constraint);
+    /**
+     * Sets in_range attribute.
+     *
+     * @param in_range.
+     */
+    public void setIn_range(Object[] in_range) {
+        this.in_range = new Object[2];
+        this.in_range[0] = in_range[0];
+        this.in_range[1] = in_range[1];
+    }
 
-    return constraint;
-  }
+    @Override
+    public Constraint clone() {
+        Constraint constraint = new Constraint();
+        constraint.setEqual(this.getEqual());
+        constraint.setGreater_or_equal(this.getGreater_or_equal());
+        constraint.setGreater_than(this.getGreater_than());
+        cloneInRange(constraint);
+        constraint.setLength(this.getLength());
+        constraint.setLess_or_equal(this.getLess_or_equal());
+        constraint.setLess_than(this.getLess_than());
+        constraint.setMax_length(this.getMax_length());
+        constraint.setMin_length(this.getMin_length());
+        constraint.setPattern(this.getPattern());
+        cloneValidValues(constraint);
+        return constraint;
+    }
 
-  private void cloneInRange(Constraint constraint) {
-    if (this.getIn_range() != null) {
-      constraint.setIn_range(new Object[]{this.getIn_range()[0], this.getIn_range()[1]});
+    private void cloneInRange(Constraint constraint) {
+        if (this.getIn_range() != null) {
+            constraint.setIn_range(new Object[]{this.getIn_range()[0], this.getIn_range()[1]});
+        }
     }
-  }
 
-  private void cloneValidValues(Constraint constraint) {
-    if (this.getValid_values() != null) {
-      constraint.setValid_values(new ArrayList<>());
-      for (Object entry : this.getValid_values()) {
-        constraint.getValid_values().add(entry);
-      }
+    private void cloneValidValues(Constraint constraint) {
+        if (this.getValid_values() != null) {
+            constraint.setValid_values(new ArrayList<>());
+            for (Object entry : this.getValid_values()) {
+                constraint.getValid_values().add(entry);
+            }
+        }
     }
-  }
 }
index 217af07..b843c62 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.onap.sdc.tosca.datatypes.model;
 
 import java.util.Map;
 
 public class Credential {
-  private String protocol;
-  private String token_type;
-  private String token;
-  private Map<String, String> keys;
-  private String user;
 
-  public Credential() {
-    this.token_type = "password";
-  }
+    private String protocol;
+    private String token_type;
+    private String token;
+    private Map<String, String> keys;
+    private String user;
+
+    public Credential() {
+        this.token_type = "password";
+    }
 
-  public String getProtocol() {
-    return protocol;
-  }
+    public String getProtocol() {
+        return protocol;
+    }
 
-  public void setProtocol(String protocol) {
-    this.protocol = protocol;
-  }
+    public void setProtocol(String protocol) {
+        this.protocol = protocol;
+    }
 
-  public String getToken_type() {
-    return token_type;
-  }
+    public String getToken_type() {
+        return token_type;
+    }
 
-  public void setToken_type(String token_type) {
-    this.token_type = token_type;
-  }
+    public void setToken_type(String token_type) {
+        this.token_type = token_type;
+    }
 
-  public String getToken() {
-    return token;
-  }
+    public String getToken() {
+        return token;
+    }
 
-  public void setToken(String token) {
-    this.token = token;
-  }
+    public void setToken(String token) {
+        this.token = token;
+    }
 
-  public Map<String, String> getKeys() {
-    return keys;
-  }
+    public Map<String, String> getKeys() {
+        return keys;
+    }
 
-  public void setKeys(Map<String, String> keys) {
-    this.keys = keys;
-  }
+    public void setKeys(Map<String, String> keys) {
+        this.keys = keys;
+    }
 
-  public String getUser() {
-    return user;
-  }
+    public String getUser() {
+        return user;
+    }
 
-  public void setUser(String user) {
-    this.user = user;
-  }
+    public void setUser(String user) {
+        this.user = user;
+    }
 }
index acf11c2..6ea83ce 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.
@@ -17,7 +17,6 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.onap.sdc.tosca.datatypes.model;
 
 import java.util.List;
@@ -25,108 +24,108 @@ import java.util.Map;
 
 public class DataType {
 
-  private String derived_from;
-  private String version;
-  private Map<String, String> metadata;
-  private String description;
-  private List<Constraint> constraints;
-  private Map<String, PropertyDefinition> properties;
-
-  /**
-   * Gets derived from.
-   *
-   * @return the derived from
-   */
-  public String getDerived_from() {
-    return derived_from;
-  }
-
-  /**
-   * Sets derived from.
-   *
-   * @param derived_from the derived from
-   */
-  public void setDerived_from(String derived_from) {
-    this.derived_from = derived_from;
-  }
-
-  /**
-   * Gets version.
-   *
-   * @return the version
-   */
-  public String getVersion() {
-    return version;
-  }
-
-  /**
-   * Sets version.
-   *
-   * @param version the version
-   */
-  public void setVersion(String version) {
-    this.version = version;
-  }
-
-  public Map<String, String> getMetadata() {
-    return metadata;
-  }
-
-  public void setMetadata(Map<String, String> metadata) {
-    this.metadata = metadata;
-  }
-
-  /**
-   * Gets description.
-   *
-   * @return the description
-   */
-  public String getDescription() {
-    return description;
-  }
-
-  /**
-   * Sets description.
-   *
-   * @param description the description
-   */
-  public void setDescription(String description) {
-    this.description = description;
-  }
-
-  /**
-   * Gets constraints.
-   *
-   * @return the constraints
-   */
-  public List<Constraint> getConstraints() {
-    return constraints;
-  }
-
-  /**
-   * Sets constraints.
-   *
-   * @param constraints the constraints
-   */
-  public void setConstraints(List<Constraint> constraints) {
-    this.constraints = constraints;
-  }
-
-  /**
-   * Gets properties.
-   *
-   * @return the properties
-   */
-  public Map<String, PropertyDefinition> getProperties() {
-    return properties;
-  }
-
-  /**
-   * Sets properties.
-   *
-   * @param properties the properties
-   */
-  public void setProperties(Map<String, PropertyDefinition> properties) {
-    this.properties = properties;
-  }
+    private String derived_from;
+    private String version;
+    private Map<String, String> metadata;
+    private String description;
+    private List<Constraint> constraints;
+    private Map<String, PropertyDefinition> properties;
+
+    /**
+     * Gets derived from.
+     *
+     * @return the derived from
+     */
+    public String getDerived_from() {
+        return derived_from;
+    }
+
+    /**
+     * Sets derived from.
+     *
+     * @param derived_from the derived from
+     */
+    public void setDerived_from(String derived_from) {
+        this.derived_from = derived_from;
+    }
+
+    /**
+     * Gets version.
+     *
+     * @return the version
+     */
+    public String getVersion() {
+        return version;
+    }
+
+    /**
+     * Sets version.
+     *
+     * @param version the version
+     */
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+    public Map<String, String> getMetadata() {
+        return metadata;
+    }
+
+    public void setMetadata(Map<String, String> metadata) {
+        this.metadata = metadata;
+    }
+
+    /**
+     * Gets description.
+     *
+     * @return the description
+     */
+    public String getDescription() {
+        return description;
+    }
+
+    /**
+     * Sets description.
+     *
+     * @param description the description
+     */
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    /**
+     * Gets constraints.
+     *
+     * @return the constraints
+     */
+    public List<Constraint> getConstraints() {
+        return constraints;
+    }
+
+    /**
+     * Sets constraints.
+     *
+     * @param constraints the constraints
+     */
+    public void setConstraints(List<Constraint> constraints) {
+        this.constraints = constraints;
+    }
+
+    /**
+     * Gets properties.
+     *
+     * @return the properties
+     */
+    public Map<String, PropertyDefinition> getProperties() {
+        return properties;
+    }
+
+    /**
+     * Sets properties.
+     *
+     * @param properties the properties
+     */
+    public void setProperties(Map<String, PropertyDefinition> properties) {
+        this.properties = properties;
+    }
 }
index 310f900..73b5d77 100644 (file)
@@ -13,7 +13,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onap.sdc.tosca.datatypes.model;
 
 import java.util.List;
@@ -22,91 +21,89 @@ import org.onap.sdc.tosca.services.DataModelCloneUtil;
 
 public class DefinitionOfDataType implements Cloneable {
 
-  private String type;
-  private String description;
-  private Object value;
-  private Boolean required;
-  private Object _default;
-  private String status;
-  private List<Constraint> constraints;
-  private EntrySchema entry_schema;
-
-  public String getType() {
-    return type;
-  }
-
-  public void setType(String type) {
-    this.type = type;
-  }
-
-  public String getDescription() {
-    return description;
-  }
-
-  public void setDescription(String description) {
-    this.description = description;
-  }
-
-  public Object getValue() {
-    return value;
-  }
-
-  public void setValue(Object value) {
-    this.value = value;
-  }
-
-  public Boolean getRequired() {
-    return required;
-  }
-
-  public void setRequired(Boolean required) {
-    this.required = required;
-  }
-
-  public Object get_default() {
-    return _default;
-  }
-
-  public void set_default(Object _default) {
-    this._default = _default;
-  }
-
-  public String getStatus() {
-    return status;
-  }
-
-  public void setStatus(String status) {
-    this.status = status;
-  }
-
-  public List<Constraint> getConstraints() {
-    return constraints;
-  }
-
-  public void setConstraints(List<Constraint> constraints) {
-    this.constraints = constraints;
-  }
-
-  public EntrySchema getEntry_schema() {
-    return entry_schema;
-  }
-
-  public void setEntry_schema(EntrySchema entry_schema) {
-    this.entry_schema = entry_schema;
-  }
-
-  @Override
-  public DefinitionOfDataType clone() {
-    DefinitionOfDataType definitionOfDataType = new DefinitionOfDataType();
-    definitionOfDataType.setType(this.getType());
-    definitionOfDataType.setDescription(this.getDescription());
-    definitionOfDataType.setRequired(this.getRequired());
-    definitionOfDataType.set_default(this.get_default());
-    definitionOfDataType.setStatus(this.getStatus());
-    definitionOfDataType.setEntry_schema(
-            Objects.isNull(this.getEntry_schema()) ? null : this.getEntry_schema().clone());
-    definitionOfDataType.setConstraints(DataModelCloneUtil.cloneConstraints(this.getConstraints()));
-    return definitionOfDataType;
-  }
-
+    private String type;
+    private String description;
+    private Object value;
+    private Boolean required;
+    private Object _default;
+    private String status;
+    private List<Constraint> constraints;
+    private EntrySchema entry_schema;
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public Object getValue() {
+        return value;
+    }
+
+    public void setValue(Object value) {
+        this.value = value;
+    }
+
+    public Boolean getRequired() {
+        return required;
+    }
+
+    public void setRequired(Boolean required) {
+        this.required = required;
+    }
+
+    public Object get_default() {
+        return _default;
+    }
+
+    public void set_default(Object _default) {
+        this._default = _default;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public List<Constraint> getConstraints() {
+        return constraints;
+    }
+
+    public void setConstraints(List<Constraint> constraints) {
+        this.constraints = constraints;
+    }
+
+    public EntrySchema getEntry_schema() {
+        return entry_schema;
+    }
+
+    public void setEntry_schema(EntrySchema entry_schema) {
+        this.entry_schema = entry_schema;
+    }
+
+    @Override
+    public DefinitionOfDataType clone() {
+        DefinitionOfDataType definitionOfDataType = new DefinitionOfDataType();
+        definitionOfDataType.setType(this.getType());
+        definitionOfDataType.setDescription(this.getDescription());
+        definitionOfDataType.setRequired(this.getRequired());
+        definitionOfDataType.set_default(this.get_default());
+        definitionOfDataType.setStatus(this.getStatus());
+        definitionOfDataType.setEntry_schema(Objects.isNull(this.getEntry_schema()) ? null : this.getEntry_schema().clone());
+        definitionOfDataType.setConstraints(DataModelCloneUtil.cloneConstraints(this.getConstraints()));
+        return definitionOfDataType;
+    }
 }
index e072a73..1b4e1ee 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.onap.sdc.tosca.datatypes.model;
 
-
 import lombok.AllArgsConstructor;
 import lombok.Getter;
 
 @Getter
 @AllArgsConstructor
 public enum Directive {
-
-
-  SELECTABLE("selectable"),
-  SUBSTITUTABLE("substitutable");
-
-  private final String displayName;
-
+    SELECTABLE("selectable"), SUBSTITUTABLE("substitutable");
+    private final String displayName;
 }
index b83e7dd..932e3c7 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.onap.sdc.tosca.datatypes.model;
 
-import org.onap.sdc.tosca.services.DataModelCloneUtil;
-
 import java.util.List;
+import org.onap.sdc.tosca.services.DataModelCloneUtil;
 
 public class EntrySchema implements Cloneable {
 
-  private String description;
-  private String type;
-  private List<Constraint> constraints;
-
-  public String getDescription() {
-    return description;
-  }
-
-  public void setDescription(String description) {
-    this.description = description;
-  }
-
-  public String getType() {
-    return type;
-  }
-
-  public void setType(String type) {
-    this.type = type;
-  }
-
-  public List<Constraint> getConstraints() {
-    return constraints;
-  }
-
-  public void setConstraints(List<Constraint> constraints) {
-    this.constraints = constraints;
-  }
-
-  @Override
-  public EntrySchema clone() {
-    EntrySchema entrySchema = new EntrySchema();
-    entrySchema.setDescription(this.getDescription());
-    entrySchema.setType(this.getType());
-    entrySchema.setConstraints(DataModelCloneUtil.cloneConstraints(this.getConstraints()));
-    return entrySchema;
-  }
+    private String description;
+    private String type;
+    private List<Constraint> constraints;
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public List<Constraint> getConstraints() {
+        return constraints;
+    }
+
+    public void setConstraints(List<Constraint> constraints) {
+        this.constraints = constraints;
+    }
+
+    @Override
+    public EntrySchema clone() {
+        EntrySchema entrySchema = new EntrySchema();
+        entrySchema.setDescription(this.getDescription());
+        entrySchema.setType(this.getType());
+        entrySchema.setConstraints(DataModelCloneUtil.cloneConstraints(this.getConstraints()));
+        return entrySchema;
+    }
 }
index 30516aa..53deafc 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.onap.sdc.tosca.datatypes.model;
 
 public class EventFilter {
 
-  private String node;
-  private String requirement;
-  private String capability;
+    private String node;
+    private String requirement;
+    private String capability;
 
-  public String getNode() {
-    return node;
-  }
+    public String getNode() {
+        return node;
+    }
 
-  public void setNode(String node) {
-    this.node = node;
-  }
+    public void setNode(String node) {
+        this.node = node;
+    }
 
-  public String getRequirement() {
-    return requirement;
-  }
+    public String getRequirement() {
+        return requirement;
+    }
 
-  public void setRequirement(String requirement) {
-    this.requirement = requirement;
-  }
+    public void setRequirement(String requirement) {
+        this.requirement = requirement;
+    }
 
-  public String getCapability() {
-    return capability;
-  }
+    public String getCapability() {
+        return capability;
+    }
 
-  public void setCapability(String capability) {
-    this.capability = capability;
-  }
+    public void setCapability(String capability) {
+        this.capability = capability;
+    }
 }
index e2002bf..599c5e3 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.onap.sdc.tosca.datatypes.model;
 
 import java.util.List;
 import java.util.Map;
 
-
-
 public class GroupDefinition {
 
-  private String type;
-  private String description;
-  private Map<String, String> metadata;
-  private Map<String, Object> properties;
-  private List<String> members;
-  private Map<String, Object> interfaces;
+    private String type;
+    private String description;
+    private Map<String, String> metadata;
+    private Map<String, Object> properties;
+    private List<String> members;
+    private Map<String, Object> interfaces;
 
-  public String getType() {
-    return type;
-  }
+    public String getType() {
+        return type;
+    }
 
-  public void setType(String type) {
-    this.type = type;
-  }
+    public void setType(String type) {
+        this.type = type;
+    }
 
-  public String getDescription() {
-    return description;
-  }
+    public String getDescription() {
+        return description;
+    }
 
-  public void setDescription(String description) {
-    this.description = description;
-  }
+    public void setDescription(String description) {
+        this.description = description;
+    }
 
-  public Map<String, Object> getProperties() {
-    return properties;
-  }
+    public Map<String, Object> getProperties() {
+        return properties;
+    }
 
-  public void setProperties(Map<String, Object> properties) {
-    this.properties = properties;
-  }
+    public void setProperties(Map<String, Object> properties) {
+        this.properties = properties;
+    }
 
-  public List<String> getMembers() {
-    return members;
-  }
+    public List<String> getMembers() {
+        return members;
+    }
 
-  public void setMembers(List<String> members) {
-    this.members = members;
-  }
+    public void setMembers(List<String> members) {
+        this.members = members;
+    }
 
-  public Map<String, String> getMetadata() {
-    return metadata;
-  }
+    public Map<String, String> getMetadata() {
+        return metadata;
+    }
 
-  public void setMetadata(Map<String, String> metadata) {
-    this.metadata = metadata;
-  }
+    public void setMetadata(Map<String, String> metadata) {
+        this.metadata = metadata;
+    }
 
-  public Map<String, Object> getInterfaces() {
-    return interfaces;
-  }
+    public Map<String, Object> getInterfaces() {
+        return interfaces;
+    }
 
-  public void setInterfaces(
-      Map<String, Object> interfaces) {
-    this.interfaces = interfaces;
-  }
+    public void setInterfaces(Map<String, Object> interfaces) {
+        this.interfaces = interfaces;
+    }
 }
index 611b1bf..751a829 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.onap.sdc.tosca.datatypes.model;
 
 import java.util.List;
 import java.util.Map;
 
-
-
 public class GroupType {
 
-  private String derived_from;
-  private String version;
-  private Map<String, String> metadata;
-  private String description;
-  private Map<String, PropertyDefinition> properties;
-  private List<String> members;
-  private List<Map<String, RequirementDefinition>> requirements;
-  private Map<String, CapabilityDefinition> capabilities;
-  private Map<String, Object> interfaces;
-
-  public String getDerived_from() {
-    return derived_from;
-  }
-
-  public void setDerived_from(String derived_from) {
-    this.derived_from = derived_from;
-  }
-
-  public String getVersion() {
-    return version;
-  }
-
-  public void setVersion(String version) {
-    this.version = version;
-  }
-
-  public Map<String, String> getMetadata() {
-    return metadata;
-  }
-
-  public void setMetadata(Map<String, String> metadata) {
-    this.metadata = metadata;
-  }
-
-  public List<Map<String, RequirementDefinition>> getRequirements() {
-    return requirements;
-  }
-
-  public void setRequirements(
-      List<Map<String, RequirementDefinition>> requirements) {
-    this.requirements = requirements;
-  }
-
-  public Map<String, CapabilityDefinition> getCapabilities() {
-    return capabilities;
-  }
-
-  public void setCapabilities(
-      Map<String, CapabilityDefinition> capabilities) {
-    this.capabilities = capabilities;
-  }
-
-  public String getDescription() {
-    return description;
-  }
-
-  public void setDescription(String description) {
-    this.description = description;
-  }
-
-  public Map<String, PropertyDefinition> getProperties() {
-    return properties;
-  }
-
-  public void setProperties(Map<String, PropertyDefinition> properties) {
-    this.properties = properties;
-  }
-
-  public List<String> getMembers() {
-    return members;
-  }
-
-  public void setMembers(List<String> members) {
-    this.members = members;
-  }
-
-  public Map<String, Object> getInterfaces() {
-    return interfaces;
-  }
-
-  public void setInterfaces(Map<String, Object> interfaces) {
-    this.interfaces = interfaces;
-  }
+    private String derived_from;
+    private String version;
+    private Map<String, String> metadata;
+    private String description;
+    private Map<String, PropertyDefinition> properties;
+    private List<String> members;
+    private List<Map<String, RequirementDefinition>> requirements;
+    private Map<String, CapabilityDefinition> capabilities;
+    private Map<String, Object> interfaces;
+
+    public String getDerived_from() {
+        return derived_from;
+    }
+
+    public void setDerived_from(String derived_from) {
+        this.derived_from = derived_from;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+    public Map<String, String> getMetadata() {
+        return metadata;
+    }
+
+    public void setMetadata(Map<String, String> metadata) {
+        this.metadata = metadata;
+    }
+
+    public List<Map<String, RequirementDefinition>> getRequirements() {
+        return requirements;
+    }
+
+    public void setRequirements(List<Map<String, RequirementDefinition>> requirements) {
+        this.requirements = requirements;
+    }
+
+    public Map<String, CapabilityDefinition> getCapabilities() {
+        return capabilities;
+    }
+
+    public void setCapabilities(Map<String, CapabilityDefinition> capabilities) {
+        this.capabilities = capabilities;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public Map<String, PropertyDefinition> getProperties() {
+        return properties;
+    }
+
+    public void setProperties(Map<String, PropertyDefinition> properties) {
+        this.properties = properties;
+    }
+
+    public List<String> getMembers() {
+        return members;
+    }
+
+    public void setMembers(List<String> members) {
+        this.members = members;
+    }
+
+    public Map<String, Object> getInterfaces() {
+        return interfaces;
+    }
+
+    public void setInterfaces(Map<String, Object> interfaces) {
+        this.interfaces = interfaces;
+    }
 }
index e771f4e..6e05e39 100644 (file)
  * limitations under the License.
  * Modifications copyright (c) 2019 Nokia
  */
-
 package org.onap.sdc.tosca.datatypes.model;
 
 import java.util.List;
 import java.util.Objects;
-
 import org.onap.sdc.tosca.services.DataModelCloneUtil;
 
-
 public class Implementation implements Cloneable {
 
     private String primary;
@@ -53,8 +50,7 @@ public class Implementation implements Cloneable {
             return false;
         }
         Implementation that = (Implementation) o;
-        return Objects.equals(primary, that.primary)
-                && Objects.equals(dependencies, that.dependencies);
+        return Objects.equals(primary, that.primary) && Objects.equals(dependencies, that.dependencies);
     }
 
     @Override
index 604607c..436c066 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.onap.sdc.tosca.datatypes.model;
 
-
-
 public class Import {
 
-  private String file;
-  private String repository;
-  private String namespace_uri;
-  private String namespace_prefix;
+    private String file;
+    private String repository;
+    private String namespace_uri;
+    private String namespace_prefix;
 
-  public String getFile() {
-    return file;
-  }
+    public String getFile() {
+        return file;
+    }
 
-  public void setFile(String file) {
-    this.file = file;
-  }
+    public void setFile(String file) {
+        this.file = file;
+    }
 
-  public String getRepository() {
-    return repository;
-  }
+    public String getRepository() {
+        return repository;
+    }
 
-  public void setRepository(String repository) {
-    this.repository = repository;
-  }
+    public void setRepository(String repository) {
+        this.repository = repository;
+    }
 
-  public String getNamespace_uri() {
-    return namespace_uri;
-  }
+    public String getNamespace_uri() {
+        return namespace_uri;
+    }
 
-  public void setNamespace_uri(String namespace_uri) {
-    this.namespace_uri = namespace_uri;
-  }
+    public void setNamespace_uri(String namespace_uri) {
+        this.namespace_uri = namespace_uri;
+    }
 
-  public String getNamespace_prefix() {
-    return namespace_prefix;
-  }
+    public String getNamespace_prefix() {
+        return namespace_prefix;
+    }
 
-  public void setNamespace_prefix(String namespace_prefix) {
-    this.namespace_prefix = namespace_prefix;
-  }
+    public void setNamespace_prefix(String namespace_prefix) {
+        this.namespace_prefix = namespace_prefix;
+    }
 }
index 2b23056..72303e3 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onap.sdc.tosca.datatypes.model;
 
-
 import com.fasterxml.jackson.databind.ObjectMapper;
-
 import com.fasterxml.jackson.databind.SerializationFeature;
 import java.util.Map;
 import java.util.Objects;
@@ -33,34 +30,31 @@ class Interface {
     private static final String COULD_NOT_CREATE_OPERATION = "Could not create Operation from [";
     private static final String OPER = "operations";
 
-    Optional<Map.Entry<String, ? extends OperationDefinition>> createOperation(String propertyName,
-            Object operationCandidate, Set<String> fieldNames, Class<? extends OperationDefinition> operationClass) {
+    Optional<Map.Entry<String, ? extends OperationDefinition>> createOperation(String propertyName, Object operationCandidate, Set<String> fieldNames,
+                                                                               Class<? extends OperationDefinition> operationClass) {
         if (!fieldNames.contains(propertyName)) {
             try {
-                Optional<? extends OperationDefinition> operationDefinition =
-                        CommonUtil.createObjectUsingSetters(operationCandidate, operationClass);
-                Map.Entry<String, ? extends OperationDefinition> operation =
-                        new Map.Entry<String, OperationDefinition>() {
-                            @Override
-                            public String getKey() {
-                                return propertyName;
-                            }
+                Optional<? extends OperationDefinition> operationDefinition = CommonUtil.createObjectUsingSetters(operationCandidate, operationClass);
+                Map.Entry<String, ? extends OperationDefinition> operation = new Map.Entry<String, OperationDefinition>() {
+                    @Override
+                    public String getKey() {
+                        return propertyName;
+                    }
 
-                            @Override
-                            public OperationDefinition getValue() {
-                                if (operationDefinition.isPresent()) {
-                                    return operationDefinition.get();
-                                }
-                                return null;
-                            }
+                    @Override
+                    public OperationDefinition getValue() {
+                        if (operationDefinition.isPresent()) {
+                            return operationDefinition.get();
+                        }
+                        return null;
+                    }
 
-                            @Override
-                            public OperationDefinition setValue(OperationDefinition value) {
-                                return null;
-                            }
-                        };
+                    @Override
+                    public OperationDefinition setValue(OperationDefinition value) {
+                        return null;
+                    }
+                };
                 return Optional.of(operation);
-
             } catch (Exception exc) {
                 throw new ToscaRuntimeException(COULD_NOT_CREATE_OPERATION + propertyName + "]", exc);
             }
@@ -72,17 +66,14 @@ class Interface {
         if (Objects.isNull(interfaceEntity)) {
             return Optional.empty();
         }
-
         Map<String, Object> interfaceAsMap = CommonUtil.getObjectAsMap(interfaceEntity);
         Map<String, Object> operations = (Map<String, Object>) interfaceAsMap.get(OPER);
         if (MapUtils.isNotEmpty(operations)) {
             interfaceAsMap.remove(OPER);
             interfaceAsMap.putAll(operations);
         }
-
         ObjectMapper objectMapper = new ObjectMapper();
         objectMapper.configure(SerializationFeature.WRITE_NULL_MAP_VALUES, false);
         return Optional.of(objectMapper.convertValue(interfaceAsMap, Object.class));
     }
-
 }
index 9bb35d8..0936b75 100644 (file)
@@ -13,7 +13,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onap.sdc.tosca.datatypes.model;
 
 import java.util.Map;
@@ -24,38 +23,30 @@ import org.onap.sdc.tosca.services.CommonUtil;
 
 public abstract class InterfaceDefinition extends Interface {
 
-    protected static final String CONVERT_INTERFACE_DEFINITION_OBJECT_ERROR =
-            "Could not create InterfaceDefinition from input object, input object -  ";
+    protected static final String CONVERT_INTERFACE_DEFINITION_OBJECT_ERROR = "Could not create InterfaceDefinition from input object, input object -  ";
 
     protected InterfaceDefinition convertObjToInterfaceDefinition(Object toscaInterfaceObj) {
         try {
-            Optional<? extends InterfaceDefinition> interfaceDefinition =
-                    CommonUtil.createObjectUsingSetters(toscaInterfaceObj, this.getClass());
+            Optional<? extends InterfaceDefinition> interfaceDefinition = CommonUtil.createObjectUsingSetters(toscaInterfaceObj, this.getClass());
             if (interfaceDefinition.isPresent()) {
-                updateInterfaceDefinitionOperations(CommonUtil.getObjectAsMap(toscaInterfaceObj),
-                        interfaceDefinition.get());
+                updateInterfaceDefinitionOperations(CommonUtil.getObjectAsMap(toscaInterfaceObj), interfaceDefinition.get());
                 return interfaceDefinition.get();
             } else {
-                throw new ToscaRuntimeException(
-                        CONVERT_INTERFACE_DEFINITION_OBJECT_ERROR + toscaInterfaceObj.toString());
+                throw new ToscaRuntimeException(CONVERT_INTERFACE_DEFINITION_OBJECT_ERROR + toscaInterfaceObj.toString());
             }
         } catch (Exception exc) {
-            throw new ToscaRuntimeException(CONVERT_INTERFACE_DEFINITION_OBJECT_ERROR
-                                                    + toscaInterfaceObj.toString(), exc);
+            throw new ToscaRuntimeException(CONVERT_INTERFACE_DEFINITION_OBJECT_ERROR + toscaInterfaceObj.toString(), exc);
         }
-
     }
 
     private <T extends OperationDefinition> void updateInterfaceDefinitionOperations(Map<String, Object> interfaceAsMap,
-            InterfaceDefinition interfaceDefinition) {
+                                                                                     InterfaceDefinition interfaceDefinition) {
         Set<String> fieldNames = CommonUtil.getClassFieldNames(interfaceDefinition.getClass());
         for (Map.Entry<String, Object> entry : interfaceAsMap.entrySet()) {
-            Optional<Map.Entry<String, ? extends OperationDefinition>> operationDefinition =
-                    createOperation(entry.getKey(), entry.getValue(), fieldNames,
-                            interfaceDefinition instanceof InterfaceDefinitionType ? OperationDefinitionType.class
-                                    : OperationDefinitionTemplate.class);
-            operationDefinition
-                    .ifPresent(operation -> interfaceDefinition.addOperation(operation.getKey(), operation.getValue()));
+            Optional<Map.Entry<String, ? extends OperationDefinition>> operationDefinition = createOperation(entry.getKey(), entry.getValue(),
+                fieldNames,
+                interfaceDefinition instanceof InterfaceDefinitionType ? OperationDefinitionType.class : OperationDefinitionTemplate.class);
+            operationDefinition.ifPresent(operation -> interfaceDefinition.addOperation(operation.getKey(), operation.getValue()));
         }
     }
 
index 954fc63..5e86c29 100644 (file)
@@ -13,7 +13,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onap.sdc.tosca.datatypes.model;
 
 import java.util.HashMap;
@@ -32,12 +31,10 @@ public class InterfaceDefinitionTemplate extends InterfaceDefinition {
     }
 
     public InterfaceDefinitionTemplate(Object toscaInterfaceDefTemplateObj) {
-        InterfaceDefinitionTemplate interfaceDefinitionTemplate =
-                (InterfaceDefinitionTemplate) convertObjToInterfaceDefinition(toscaInterfaceDefTemplateObj);
+        InterfaceDefinitionTemplate interfaceDefinitionTemplate = (InterfaceDefinitionTemplate) convertObjToInterfaceDefinition(
+            toscaInterfaceDefTemplateObj);
         this.setInputs(DataModelCloneUtil.cloneStringObjectMap(interfaceDefinitionTemplate.getInputs()));
-        this.setOperations(
-                DataModelCloneUtil.cloneStringOperationDefinitionMap(interfaceDefinitionTemplate.getOperations()));
-
+        this.setOperations(DataModelCloneUtil.cloneStringOperationDefinitionMap(interfaceDefinitionTemplate.getOperations()));
     }
 
     public Map<String, Object> getInputs() {
index 3d691be..b0fb069 100644 (file)
@@ -13,8 +13,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-
 package org.onap.sdc.tosca.datatypes.model;
 
 import java.util.HashMap;
@@ -34,12 +32,10 @@ public class InterfaceDefinitionType extends InterfaceDefinition {
     }
 
     public InterfaceDefinitionType(Object toscaInterfaceDefinitionType) {
-        InterfaceDefinitionType interfaceDefinitionType =
-                (InterfaceDefinitionType) convertObjToInterfaceDefinition(toscaInterfaceDefinitionType);
+        InterfaceDefinitionType interfaceDefinitionType = (InterfaceDefinitionType) convertObjToInterfaceDefinition(toscaInterfaceDefinitionType);
         this.setType(interfaceDefinitionType.getType());
         this.setInputs(DataModelCloneUtil.cloneStringPropertyDefinitionMap(interfaceDefinitionType.getInputs()));
-        this.setOperations(
-                DataModelCloneUtil.cloneStringOperationDefinitionMap(interfaceDefinitionType.getOperations()));
+        this.setOperations(DataModelCloneUtil.cloneStringOperationDefinitionMap(interfaceDefinitionType.getOperations()));
     }
 
     public String getType() {
@@ -75,9 +71,7 @@ public class InterfaceDefinitionType extends InterfaceDefinition {
             return false;
         }
         InterfaceDefinitionType that = (InterfaceDefinitionType) o;
-        return Objects.equals(type, that.type)
-                && Objects.equals(inputs, that.inputs)
-                && Objects.equals(operations, that.operations);
+        return Objects.equals(type, that.type) && Objects.equals(inputs, that.inputs) && Objects.equals(operations, that.operations);
     }
 
     @Override
@@ -100,5 +94,4 @@ public class InterfaceDefinitionType extends InterfaceDefinition {
     public Optional<Object> convertInterfaceDefinitionTypeToToscaObj() {
         return convertInterfaceToToscaInterfaceObj(this);
     }
-
 }
index 07c4031..ffd9212 100644 (file)
@@ -17,7 +17,6 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.onap.sdc.tosca.datatypes.model;
 
 import java.util.HashMap;
@@ -32,8 +31,7 @@ import org.onap.sdc.tosca.services.DataModelCloneUtil;
 
 public class InterfaceType extends Interface {
 
-    protected static final String CONVERT_INTERFACE_TYPE_OBJECT_ERROR =
-            "Could not create InterfaceType from input object, input object -  ";
+    protected static final String CONVERT_INTERFACE_TYPE_OBJECT_ERROR = "Could not create InterfaceType from input object, input object -  ";
     private String derived_from;
     private String version;
     private Map<String, String> metadata;
@@ -56,8 +54,7 @@ public class InterfaceType extends Interface {
 
     protected InterfaceType convertObjToInterfaceType(Object toscaInterfaceTypeObj) {
         try {
-            Optional<InterfaceType> interfaceType =
-                    CommonUtil.createObjectUsingSetters(toscaInterfaceTypeObj, this.getClass());
+            Optional<InterfaceType> interfaceType = CommonUtil.createObjectUsingSetters(toscaInterfaceTypeObj, this.getClass());
             if (interfaceType.isPresent()) {
                 updateInterfaceTypeOperations(CommonUtil.getObjectAsMap(toscaInterfaceTypeObj), interfaceType.get());
                 return interfaceType.get();
@@ -67,17 +64,14 @@ public class InterfaceType extends Interface {
         } catch (Exception exc) {
             throw new ToscaRuntimeException(CONVERT_INTERFACE_TYPE_OBJECT_ERROR + toscaInterfaceTypeObj.toString(), exc);
         }
-
     }
 
     private void updateInterfaceTypeOperations(Map<String, Object> interfaceAsMap, InterfaceType interfaceType) {
-
         Set<String> fieldNames = CommonUtil.getClassFieldNames(interfaceType.getClass());
         for (Map.Entry<String, Object> entry : interfaceAsMap.entrySet()) {
-            Optional<Map.Entry<String, ? extends OperationDefinition>> operationDefinition =
-                    createOperation(entry.getKey(), entry.getValue(), fieldNames, OperationDefinitionType.class);
-            operationDefinition
-                    .ifPresent(operation -> interfaceType.addOperation(operation.getKey(), operation.getValue()));
+            Optional<Map.Entry<String, ? extends OperationDefinition>> operationDefinition = createOperation(entry.getKey(), entry.getValue(),
+                fieldNames, OperationDefinitionType.class);
+            operationDefinition.ifPresent(operation -> interfaceType.addOperation(operation.getKey(), operation.getValue()));
         }
     }
 
@@ -101,10 +95,18 @@ public class InterfaceType extends Interface {
         return description;
     }
 
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
     public Map<String, String> getMetadata() {
         return metadata;
     }
 
+    public void setMetadata(Map<String, String> metadata) {
+        this.metadata = metadata;
+    }
+
     public Map<String, PropertyDefinition> getInputs() {
         return inputs;
     }
@@ -128,17 +130,8 @@ public class InterfaceType extends Interface {
         this.operations.put(operationName, operationDefinition);
     }
 
-    public void setMetadata(Map<String, String> metadata) {
-        this.metadata = metadata;
-    }
-
-    public void setDescription(String description) {
-        this.description = description;
-    }
-
     @Override
     public int hashCode() {
-
         return Objects.hash(derived_from, version, metadata, description, inputs, operations);
     }
 
@@ -151,14 +144,11 @@ public class InterfaceType extends Interface {
             return false;
         }
         InterfaceType that = (InterfaceType) o;
-        return Objects.equals(derived_from, that.derived_from) && Objects.equals(version, that.version)
-                       && Objects.equals(metadata, that.metadata) && Objects.equals(description, that.description)
-                       && Objects.equals(inputs, that.inputs) && Objects.equals(operations, that.operations);
+        return Objects.equals(derived_from, that.derived_from) && Objects.equals(version, that.version) && Objects.equals(metadata, that.metadata)
+            && Objects.equals(description, that.description) && Objects.equals(inputs, that.inputs) && Objects.equals(operations, that.operations);
     }
 
     public Optional<Object> convertInterfaceTypeToToscaObj() {
         return convertInterfaceToToscaInterfaceObj(this);
     }
-
-
 }
index be34394..014eb62 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onap.sdc.tosca.datatypes.model;
 
 import java.util.List;
 import java.util.Map;
 import org.onap.sdc.tosca.services.DataModelNormalizeUtil;
 
-
 public class NodeFilter {
 
     private List<Map<String, List<Constraint>>> properties;
@@ -34,13 +32,11 @@ public class NodeFilter {
         this.capabilities = DataModelNormalizeUtil.getNormalizeCapabilitiesFilter(capabilities);
     }
 
-    public void setProperties(List<Map<String, List<Constraint>>> properties) {
-        this.properties = DataModelNormalizeUtil.getNormalizePropertiesFilter(properties);
-    }
-
     public List<Map<String, List<Constraint>>> getProperties() {
         return properties;
     }
 
-
+    public void setProperties(List<Map<String, List<Constraint>>> properties) {
+        this.properties = DataModelNormalizeUtil.getNormalizePropertiesFilter(properties);
+    }
 }
index ae1ca01..8e9b54c 100644 (file)
@@ -17,7 +17,6 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.onap.sdc.tosca.datatypes.model;
 
 import java.util.ArrayList;
@@ -26,11 +25,9 @@ import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 import java.util.Set;
-
 import lombok.EqualsAndHashCode;
 import lombok.Getter;
 import lombok.Setter;
-
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.MapUtils;
 import org.onap.sdc.tosca.error.ToscaRuntimeException;
@@ -38,7 +35,6 @@ import org.onap.sdc.tosca.services.ToscaExtensionYamlUtil;
 import org.onap.sdc.tosca.services.YamlUtil;
 import org.yaml.snakeyaml.constructor.ConstructorException;
 
-
 @Getter
 @Setter
 @EqualsAndHashCode
@@ -58,12 +54,7 @@ public class NodeTemplate implements Template, Cloneable {
     private NodeFilter node_filter;
     private String copy;
 
-    public void setRequirements(List requirementAssignmentObj) {
-        this.requirements = convertToscaRequirementAssignment(requirementAssignmentObj); 
-    }
-
     public static List<Map<String, RequirementAssignment>> convertToscaRequirementAssignment(List<?> requirementAssignmentObj) {
-
         List<Map<String, RequirementAssignment>> convertedRequirements = new ArrayList<>();
         if (CollectionUtils.isEmpty(requirementAssignmentObj)) {
             return null;
@@ -74,10 +65,11 @@ public class NodeTemplate implements Template, Cloneable {
         return convertedRequirements;
     }
 
-    private static void convertToscaRequirementAssignmentEntry(List<Map<String, RequirementAssignment>> convertedRequirements, Object requirementEntry) {
+    private static void convertToscaRequirementAssignmentEntry(List<Map<String, RequirementAssignment>> convertedRequirements,
+                                                               Object requirementEntry) {
         if (requirementEntry instanceof Map) {
             try {
-                Set<Map.Entry<String, RequirementAssignment>> requirementEntries = ((Map)requirementEntry).entrySet();
+                Set<Map.Entry<String, RequirementAssignment>> requirementEntries = ((Map) requirementEntry).entrySet();
                 for (Map.Entry<String, RequirementAssignment> toscaRequirements : requirementEntries) {
                     String key = toscaRequirements.getKey();
                     Object requirementValue = toscaRequirements.getValue();
@@ -85,20 +77,19 @@ public class NodeTemplate implements Template, Cloneable {
                         RequirementAssignment requirementObject;
                         try {
                             YamlUtil yamlUtil = new YamlUtil();
-                            requirementObject = yamlUtil
-                                .yamlToObject(yamlUtil.objectToYaml(requirementValue), RequirementAssignment.class);
+                            requirementObject = yamlUtil.yamlToObject(yamlUtil.objectToYaml(requirementValue), RequirementAssignment.class);
                         } catch (ConstructorException ex) {
                             // The requirement might contains extended attribute, so try to parse it into RequirementAssignmentExt as well
                             ToscaExtensionYamlUtil toscaExtensionYamlUtil = new ToscaExtensionYamlUtil();
                             requirementObject = toscaExtensionYamlUtil
-                                    .yamlToObject(toscaExtensionYamlUtil.objectToYaml(requirementValue), RequirementAssignment.class);
+                                .yamlToObject(toscaExtensionYamlUtil.objectToYaml(requirementValue), RequirementAssignment.class);
                         }
                         Map<String, RequirementAssignment> convertedToscaRequirement = new HashMap<>();
                         convertedToscaRequirement.put(key, requirementObject);
                         convertedRequirements.add(convertedToscaRequirement);
-                    } else  if (requirementValue instanceof RequirementAssignment) {
+                    } else if (requirementValue instanceof RequirementAssignment) {
                         Map<String, RequirementAssignment> convertedToscaRequirement = new HashMap<>();
-                        convertedToscaRequirement.put(key, (RequirementAssignment)requirementValue);
+                        convertedToscaRequirement.put(key, (RequirementAssignment) requirementValue);
                         convertedRequirements.add(convertedToscaRequirement);
                     }
                 }
@@ -108,6 +99,10 @@ public class NodeTemplate implements Template, Cloneable {
         }
     }
 
+    public void setRequirements(List requirementAssignmentObj) {
+        this.requirements = convertToscaRequirementAssignment(requirementAssignmentObj);
+    }
+
     public void addRequirements(Map<String, RequirementAssignment> newRequirement) {
         if (CollectionUtils.isEmpty(this.requirements)) {
             this.requirements = new ArrayList<Map<String, RequirementAssignment>>();
@@ -121,8 +116,7 @@ public class NodeTemplate implements Template, Cloneable {
         }
         Map<String, InterfaceDefinitionTemplate> normativeInterfaceDefinition = new HashMap<>();
         for (Map.Entry<String, Object> interfaceEntry : interfaces.entrySet()) {
-            InterfaceDefinitionTemplate interfaceDefinitionTemplate =
-                    new InterfaceDefinitionTemplate(interfaceEntry.getValue());
+            InterfaceDefinitionTemplate interfaceDefinitionTemplate = new InterfaceDefinitionTemplate(interfaceEntry.getValue());
             normativeInterfaceDefinition.put(interfaceEntry.getKey(), interfaceDefinitionTemplate);
         }
         return normativeInterfaceDefinition;
@@ -132,7 +126,6 @@ public class NodeTemplate implements Template, Cloneable {
         if (MapUtils.isEmpty(this.interfaces)) {
             this.interfaces = new HashMap<>();
         }
-
         Optional<Object> toscaInterfaceObj = interfaceDefinitionTemplate.convertInterfaceDefTemplateToToscaObj();
         if (!toscaInterfaceObj.isPresent()) {
             throw new ToscaRuntimeException("Illegal Statement");
@@ -141,15 +134,11 @@ public class NodeTemplate implements Template, Cloneable {
             this.interfaces.remove(interfaceKey);
         }
         this.interfaces.put(interfaceKey, toscaInterfaceObj.get());
-
     }
 
-
     @Override
     public NodeTemplate clone() {
         YamlUtil yamlUtil = new YamlUtil();
         return yamlUtil.yamlToObject(yamlUtil.objectToYaml(this), NodeTemplate.class);
     }
-
-
 }
index 868a6f4..eca056f 100644 (file)
@@ -17,7 +17,6 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.onap.sdc.tosca.datatypes.model;
 
 import java.util.HashMap;
@@ -50,6 +49,10 @@ public class NodeType implements Cloneable {
         return capabilities;
     }
 
+    public void setCapabilities(Map<String, CapabilityDefinition> capabilities) {
+        this.capabilities = capabilities;
+    }
+
     public String getDerived_from() {
         return derived_from;
     }
@@ -70,6 +73,10 @@ public class NodeType implements Cloneable {
         return requirements;
     }
 
+    public void setRequirements(List<Map<String, RequirementDefinition>> requirements) {
+        this.requirements = requirements;
+    }
+
     public String getDescription() {
         return description;
     }
@@ -90,6 +97,10 @@ public class NodeType implements Cloneable {
         return interfaces;
     }
 
+    public void setInterfaces(Map<String, Object> interfaces) {
+        this.interfaces = interfaces;
+    }
+
     public Map<String, InterfaceDefinitionType> getNormalizeInterfaces() {
         if (MapUtils.isEmpty(interfaces)) {
             return new HashMap<>();
@@ -118,18 +129,6 @@ public class NodeType implements Cloneable {
         this.artifacts = artifacts;
     }
 
-    public void setInterfaces(Map<String, Object> interfaces) {
-        this.interfaces = interfaces;
-    }
-
-    public void setRequirements(List<Map<String, RequirementDefinition>> requirements) {
-        this.requirements = requirements;
-    }
-
-    public void setCapabilities(Map<String, CapabilityDefinition> capabilities) {
-        this.capabilities = capabilities;
-    }
-
     @Override
     public NodeType clone() {
         NodeType clone = new NodeType();
index 8114686..d8b5bd0 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.
@@ -17,7 +17,6 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.onap.sdc.tosca.datatypes.model;
 
 import java.util.Objects;
@@ -48,7 +47,6 @@ public class OperationDefinition implements Cloneable {
 
     @Override
     public int hashCode() {
-
         return Objects.hash(description);
     }
 
index 62f6a20..22f1151 100644 (file)
@@ -13,7 +13,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onap.sdc.tosca.datatypes.model;
 
 import java.util.Map;
@@ -55,12 +54,11 @@ public class OperationDefinitionTemplate extends OperationDefinition {
 
     @Override
     public int hashCode() {
-
         return Objects.hash(implementation, inputs);
     }
 
     @Override
-    public OperationDefinitionTemplate clone()  {
+    public OperationDefinitionTemplate clone() {
         OperationDefinition operationDefinition = super.clone();
         OperationDefinitionTemplate operationDefinitionTemplate = new OperationDefinitionTemplate();
         operationDefinitionTemplate.setDescription(operationDefinition.getDescription());
index a40c91f..0c46516 100644 (file)
@@ -13,7 +13,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onap.sdc.tosca.datatypes.model;
 
 import java.util.Map;
@@ -55,7 +54,6 @@ public class OperationDefinitionType extends OperationDefinition {
 
     @Override
     public int hashCode() {
-
         return Objects.hash(implementation, inputs);
     }
 
index f667e8a..841adc9 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onap.sdc.tosca.datatypes.model;
 
-
 public class ParameterDefinition extends DefinitionOfDataType {
 
     @Override
@@ -33,5 +31,4 @@ public class ParameterDefinition extends DefinitionOfDataType {
         parameterDefinition.setValue(definitionOfDataType.getValue());
         return parameterDefinition;
     }
-
 }
index a9a45c4..3d4311c 100644 (file)
@@ -17,7 +17,6 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.onap.sdc.tosca.datatypes.model;
 
 import java.util.List;
@@ -33,5 +32,4 @@ public class PolicyDefinition implements Template {
     private Map<String, Object> properties;
     private List<String> targets;
     private Map<String, Trigger> triggers;
-
 }
index cd7da86..51680df 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.onap.sdc.tosca.datatypes.model;
 
 import java.util.List;
 import java.util.Map;
 import lombok.Data;
 
-
 @Data
 public class PolicyType {
 
@@ -35,5 +33,4 @@ public class PolicyType {
     private Map<String, PropertyDefinition> properties;
     private List<String> targets;
     private Map<String, Trigger> triggers;
-
 }
index aaff76d..efc2480 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.onap.sdc.tosca.datatypes.model;
+
 import lombok.Data;
 
 @Data
 public class PreconditionDefinition {
 
-  private String target;
-  private String target_relationship;
-  private Constraint condition;
-
+    private String target;
+    private String target_relationship;
+    private Constraint condition;
 }
index 331b7b0..a3ab24d 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.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onap.sdc.tosca.datatypes.model;
 
 public class PropertyDefinition extends DefinitionOfDataType {
 
-  public PropertyDefinition() {
-    setStatus(Status.SUPPORTED.getName());
-    setRequired(true);
-  }
-
-  @Override
-  public PropertyDefinition clone() {
-    DefinitionOfDataType definitionOfDataType = super.clone();
-    PropertyDefinition propertyDefinition = new PropertyDefinition();
-    propertyDefinition.set_default(definitionOfDataType.get_default());
-    propertyDefinition.setConstraints(definitionOfDataType.getConstraints());
-    propertyDefinition.setDescription(definitionOfDataType.getDescription());
-    propertyDefinition.setEntry_schema(definitionOfDataType.getEntry_schema());
-    propertyDefinition.setRequired(definitionOfDataType.getRequired());
-    propertyDefinition.setType(definitionOfDataType.getType());
-    propertyDefinition.setStatus(definitionOfDataType.getStatus());
-    propertyDefinition.setValue(definitionOfDataType.getValue());
-    return propertyDefinition;
-  }
-
+    public PropertyDefinition() {
+        setStatus(Status.SUPPORTED.getName());
+        setRequired(true);
+    }
 
+    @Override
+    public PropertyDefinition clone() {
+        DefinitionOfDataType definitionOfDataType = super.clone();
+        PropertyDefinition propertyDefinition = new PropertyDefinition();
+        propertyDefinition.set_default(definitionOfDataType.get_default());
+        propertyDefinition.setConstraints(definitionOfDataType.getConstraints());
+        propertyDefinition.setDescription(definitionOfDataType.getDescription());
+        propertyDefinition.setEntry_schema(definitionOfDataType.getEntry_schema());
+        propertyDefinition.setRequired(definitionOfDataType.getRequired());
+        propertyDefinition.setType(definitionOfDataType.getType());
+        propertyDefinition.setStatus(definitionOfDataType.getStatus());
+        propertyDefinition.setValue(definitionOfDataType.getValue());
+        return propertyDefinition;
+    }
 }
index 1b91ca9..3cec134 100644 (file)
@@ -13,7 +13,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onap.sdc.tosca.datatypes.model;
 
 import java.util.Collections;
@@ -27,61 +26,63 @@ import lombok.Getter;
 @AllArgsConstructor
 @Getter
 public enum PropertyType {
+    // @formatter:off
+    STRING("string"),
+    INTEGER("integer"),
+    FLOAT("float"),
+    BOOLEAN("boolean"),
+    TIMESTAMP("timestamp"),
+    NULL("null"),
+    MAP("map"),
+    LIST("list"),
+    SCALAR_UNIT_SIZE("scalar-unit.size"),
+    SCALAR_UNIT_TIME("scalar-unit.time"),
+    SCALAR_UNIT_FREQUENCY("scalar-unit.frequency");
+    // @formatter:on
 
-  STRING("string"),
-  INTEGER("integer"),
-  FLOAT("float"),
-  BOOLEAN("boolean"),
-  TIMESTAMP("timestamp"),
-  NULL("null"),
-  MAP("map"),
-  LIST("list"),
-  SCALAR_UNIT_SIZE("scalar-unit.size"),
-  SCALAR_UNIT_TIME("scalar-unit.time"),
-  SCALAR_UNIT_FREQUENCY("scalar-unit.frequency");
-
-  private static final Map<String, PropertyType> M_MAP = Collections.unmodifiableMap(initializeMapping());
-  private static final Set<String> SIMPLE_PROPERTY_TYPES = Collections.unmodifiableSet(initializeSimplePropertyTypes());
-  private String displayName;
+    private static final Map<String, PropertyType> M_MAP = Collections.unmodifiableMap(initializeMapping());
+    private static final Set<String> SIMPLE_PROPERTY_TYPES = Collections.unmodifiableSet(initializeSimplePropertyTypes());
+    private String displayName;
 
-  /**
-   * Initilize property type display name mapping.
-   * @return Map
-   */
-  public static Map<String, PropertyType> initializeMapping() {
-    final Map<String, PropertyType> typeMap = new HashMap<>();
-    for (final PropertyType propertyType : PropertyType.values()) {
-      typeMap.put(propertyType.displayName, propertyType);
+    /**
+     * Initilize property type display name mapping.
+     *
+     * @return Map
+     */
+    public static Map<String, PropertyType> initializeMapping() {
+        final Map<String, PropertyType> typeMap = new HashMap<>();
+        for (final PropertyType propertyType : PropertyType.values()) {
+            typeMap.put(propertyType.displayName, propertyType);
+        }
+        return typeMap;
     }
-    return typeMap;
-  }
 
-  /**
-   * Get Property type by display name.
-   * @param displayName
-   * @return PropertyType
-   */
-  public static PropertyType getPropertyTypeByDisplayName(final String displayName) {
-    if (M_MAP.containsKey(displayName)) {
-      return M_MAP.get(displayName);
+    /**
+     * Get Property type by display name.
+     *
+     * @param displayName
+     * @return PropertyType
+     */
+    public static PropertyType getPropertyTypeByDisplayName(final String displayName) {
+        if (M_MAP.containsKey(displayName)) {
+            return M_MAP.get(displayName);
+        }
+        return null;
     }
-    return null;
-  }
-
-  private static Set<String> initializeSimplePropertyTypes() {
-    final Set<String> simplePropertyTypes = new HashSet<>();
-    simplePropertyTypes.add(STRING.getDisplayName().toLowerCase());
-    simplePropertyTypes.add(INTEGER.getDisplayName().toLowerCase());
-    simplePropertyTypes.add(FLOAT.getDisplayName().toLowerCase());
-    simplePropertyTypes.add(BOOLEAN.getDisplayName().toLowerCase());
-    simplePropertyTypes.add(SCALAR_UNIT_SIZE.getDisplayName().toLowerCase());
-    simplePropertyTypes.add(SCALAR_UNIT_TIME.getDisplayName().toLowerCase());
-    simplePropertyTypes.add(SCALAR_UNIT_FREQUENCY.getDisplayName().toLowerCase());
-    return simplePropertyTypes;
-  }
 
-  public static Set<String> getSimplePropertyTypes() {
-    return SIMPLE_PROPERTY_TYPES;
-  }
+    private static Set<String> initializeSimplePropertyTypes() {
+        final Set<String> simplePropertyTypes = new HashSet<>();
+        simplePropertyTypes.add(STRING.getDisplayName().toLowerCase());
+        simplePropertyTypes.add(INTEGER.getDisplayName().toLowerCase());
+        simplePropertyTypes.add(FLOAT.getDisplayName().toLowerCase());
+        simplePropertyTypes.add(BOOLEAN.getDisplayName().toLowerCase());
+        simplePropertyTypes.add(SCALAR_UNIT_SIZE.getDisplayName().toLowerCase());
+        simplePropertyTypes.add(SCALAR_UNIT_TIME.getDisplayName().toLowerCase());
+        simplePropertyTypes.add(SCALAR_UNIT_FREQUENCY.getDisplayName().toLowerCase());
+        return simplePropertyTypes;
+    }
 
+    public static Set<String> getSimplePropertyTypes() {
+        return SIMPLE_PROPERTY_TYPES;
+    }
 }
index 17a3ae3..4fa1f72 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.onap.sdc.tosca.datatypes.model;
 
 import java.util.Map;
-
 import lombok.Data;
 
 @Data
 public class RelationshipTemplate implements Template {
 
-  private String type;
-  private String description;
-  private Map<String, String> metadata;
-  private Map<String, Object> properties;
-  private Map<String, Object> attributes;
-  private Map<String, RequirementAssignment> requirements;
-  private Map<String, CapabilityAssignment> capabilities;
-  private Map<String, Object> interfaces;
-  private String copy;
-
+    private String type;
+    private String description;
+    private Map<String, String> metadata;
+    private Map<String, Object> properties;
+    private Map<String, Object> attributes;
+    private Map<String, RequirementAssignment> requirements;
+    private Map<String, CapabilityAssignment> capabilities;
+    private Map<String, Object> interfaces;
+    private String copy;
 }
index b2ff1a3..4ba5dee 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.onap.sdc.tosca.datatypes.model;
 
-import lombok.Data;
-
 import java.util.List;
 import java.util.Map;
+import lombok.Data;
 
 @Data
 public class RelationshipType {
@@ -37,6 +35,6 @@ public class RelationshipType {
     private Map<String, Object> interfaces;
     private List<String> valid_target_types;
     //An optional list of one or more names of Capability Types that are valid targets
-    // for this relationship
 
+    // for this relationship
 }
index d717317..1fad6b8 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.
@@ -17,7 +17,6 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.onap.sdc.tosca.datatypes.model;
 
 import lombok.Data;
index 177b8c4..6dd9866 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.
@@ -17,7 +17,6 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.onap.sdc.tosca.datatypes.model;
 
 import lombok.Data;
@@ -25,11 +24,9 @@ import lombok.Data;
 @Data
 public class RequirementAssignment {
 
-  private String capability;
-  private String node;
-  private String relationship;
-  private NodeFilter node_filter;
-  private Object[] occurrences;
-
-
+    private String capability;
+    private String node;
+    private String relationship;
+    private NodeFilter node_filter;
+    private Object[] occurrences;
 }
index 48c9faa..ae99f93 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.onap.sdc.tosca.datatypes.model;
 
-
 public class RequirementDefinition implements Cloneable {
 
-  private String capability;
-  private String node;
-  private String relationship;
-  private Object[] occurrences;
-
-  /**
-   * Instantiates a new Requirement definition.
-   */
-  public RequirementDefinition() {
-    occurrences = new Object[2];
-    occurrences[0] = 1;
-    occurrences[1] = 1;
-  }
+    private String capability;
+    private String node;
+    private String relationship;
+    private Object[] occurrences;
 
-  public String getCapability() {
-    return capability;
-  }
+    /**
+     * Instantiates a new Requirement definition.
+     */
+    public RequirementDefinition() {
+        occurrences = new Object[2];
+        occurrences[0] = 1;
+        occurrences[1] = 1;
+    }
 
-  public void setCapability(String capability) {
-    this.capability = capability;
-  }
+    public String getCapability() {
+        return capability;
+    }
 
-  public String getNode() {
-    return node;
-  }
+    public void setCapability(String capability) {
+        this.capability = capability;
+    }
 
-  public void setNode(String node) {
-    this.node = node;
-  }
+    public String getNode() {
+        return node;
+    }
 
-  public String getRelationship() {
-    return relationship;
-  }
+    public void setNode(String node) {
+        this.node = node;
+    }
 
-  public void setRelationship(String relationship) {
-    this.relationship = relationship;
-  }
+    public String getRelationship() {
+        return relationship;
+    }
 
-  public Object[] getOccurrences() {
-    return occurrences;
-  }
+    public void setRelationship(String relationship) {
+        this.relationship = relationship;
+    }
 
-  public void setOccurrences(Object[] occurrences) {
-    this.occurrences = occurrences;
-  }
+    public Object[] getOccurrences() {
+        return occurrences;
+    }
 
-  @Override
-  public RequirementDefinition clone() {
-    RequirementDefinition requirementDefinition = new RequirementDefinition();
-    requirementDefinition.setNode(this.getNode());
-    requirementDefinition.setRelationship(this.getRelationship());
-    requirementDefinition.setCapability(this.getCapability());
-    requirementDefinition
-        .setOccurrences(new Object[]{this.getOccurrences()[0], this.getOccurrences()[1]});
-    return requirementDefinition;
-  }
+    public void setOccurrences(Object[] occurrences) {
+        this.occurrences = occurrences;
+    }
 
+    @Override
+    public RequirementDefinition clone() {
+        RequirementDefinition requirementDefinition = new RequirementDefinition();
+        requirementDefinition.setNode(this.getNode());
+        requirementDefinition.setRelationship(this.getRelationship());
+        requirementDefinition.setCapability(this.getCapability());
+        requirementDefinition.setOccurrences(new Object[]{this.getOccurrences()[0], this.getOccurrences()[1]});
+        return requirementDefinition;
+    }
 }
index 302ba48..13d3fe8 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.onap.sdc.tosca.datatypes.model;
 
-
-
 public class Scalar {
 
-  private Float value;
+    private Float value;
 
-  public Float getValue() {
-    return value;
-  }
+    public Float getValue() {
+        return value;
+    }
 
-  public void setValue(Float value) {
-    this.value = value;
-  }
+    public void setValue(Float value) {
+        this.value = value;
+    }
 }
index 5e2e2e5..d5a9904 100644 (file)
@@ -16,7 +16,6 @@
  *  SPDX-License-Identifier: Apache-2.0
  *  ============LICENSE_END=========================================================
  */
-
 package org.onap.sdc.tosca.datatypes.model;
 
 import java.util.Arrays;
@@ -29,11 +28,10 @@ import org.apache.commons.lang3.StringUtils;
 public class ScalarUnitValidator {
 
     private static final ScalarUnitValidator scalarUnitValidator = new ScalarUnitValidator();
-
     /**
-     *  Tosca Scalar Unit Types structure.
-     *
-     *  At least positive integers, no single white space, 1 to 3 chars
+     * Tosca Scalar Unit Types structure.
+     * <p>
+     * At least positive integers, no single white space, 1 to 3 chars
      */
     private final Pattern pattern = Pattern.compile("\\d+\\s*[a-zA-Z]{1,3}");
 
@@ -54,23 +52,21 @@ public class ScalarUnitValidator {
         if (value == null || value.isEmpty()) {
             return true;
         }
-
         return pattern.matcher(value).matches();
     }
 
     /**
      * Validates if the given String has a Recognized Tosca unit.
      *
-     * @param value String to be validated
+     * @param value     String to be validated
      * @param enumClass Enum that represents a Tosca Scalar Unit Type.
      * @param <E>
      * @return an Enum that represents the Tosca Scalar Unit Type.
      */
     public <E extends Enum<E>> boolean isValueScalarUnit(final Object value, final Class<E> enumClass) {
         final String stringToValidate = String.valueOf(value);
-        return isScalarUnit(stringToValidate) && Arrays.stream(StringUtils.split(stringToValidate))
-            .anyMatch(strValue -> Arrays.stream(enumClass.getEnumConstants())
-                .anyMatch(scalarUnit ->
-                    scalarUnit.name().equalsIgnoreCase(strValue) || strValue.endsWith(scalarUnit.name())));
+        return isScalarUnit(stringToValidate) && Arrays.stream(StringUtils.split(stringToValidate)).anyMatch(
+            strValue -> Arrays.stream(enumClass.getEnumConstants())
+                .anyMatch(scalarUnit -> scalarUnit.name().equalsIgnoreCase(strValue) || strValue.endsWith(scalarUnit.name())));
     }
-}
\ No newline at end of file
+}
index becd34a..758786d 100644 (file)
@@ -13,7 +13,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onap.sdc.tosca.datatypes.model;
 
 import static org.onap.sdc.tosca.services.DataModelConvertUtil.convertToscaImports;
@@ -22,12 +21,10 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
-
 import org.apache.commons.collections4.MapUtils;
 import org.onap.sdc.tosca.datatypes.model.heatextend.AnnotationType;
 import org.onap.sdc.tosca.error.ToscaRuntimeException;
 
-
 public class ServiceTemplate implements Template {
 
     private String tosca_definitions_version;
@@ -167,7 +164,6 @@ public class ServiceTemplate implements Template {
         if (MapUtils.isEmpty(this.interface_types)) {
             this.interface_types = new HashMap<>();
         }
-
         Optional<Object> toscaInterfaceObj = interfaceType.convertInterfaceTypeToToscaObj();
         if (!toscaInterfaceObj.isPresent()) {
             throw new ToscaRuntimeException("Illegal Statement");
@@ -201,6 +197,4 @@ public class ServiceTemplate implements Template {
     public void setAnnotation_types(Map<String, AnnotationType> annotationTypes) {
         this.annotation_types = annotationTypes;
     }
-
-
 }
index c25a6ad..a52968a 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.
@@ -17,7 +17,6 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.onap.sdc.tosca.datatypes.model;
 
 import lombok.AllArgsConstructor;
@@ -26,11 +25,6 @@ import lombok.Getter;
 @Getter
 @AllArgsConstructor
 public enum Status {
-  SUPPORTED("supported"),
-  UNSUPPORTED("unsupported"),
-  EXPERIMENTAL("experimental"),
-  DEPRECATED("deprecated");
-
-  private final String name;
-
+    SUPPORTED("supported"), UNSUPPORTED("unsupported"), EXPERIMENTAL("experimental"), DEPRECATED("deprecated");
+    private final String name;
 }
index a20d398..eef2b8a 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.onap.sdc.tosca.datatypes.model;
 
 import java.util.List;
 
 public class StepDefinition {
 
-  private String target;
-  private String target_relationship;
-  private String operation_host;
-  private List<Constraint> filter;
-  private List<ActivityDefinition> activities;
-  private String on_success;
-  private String on_failure;
-
-
-  public String getTarget() {
-    return target;
-  }
-
-  public void setTarget(String target) {
-    this.target = target;
-  }
-
-  public String getTarget_relationship() {
-    return target_relationship;
-  }
-
-  public void setTarget_relationship(String target_relationship) {
-    this.target_relationship = target_relationship;
-  }
-
-  public String getOperation_host() {
-    return operation_host;
-  }
-
-  public void setOperation_host(String operation_host) {
-    this.operation_host = operation_host;
-  }
-
-  public List<Constraint> getFilter() {
-    return filter;
-  }
-
-  public void setFilter(List<Constraint> filter) {
-    this.filter = filter;
-  }
-
-  public List<ActivityDefinition> getActivities() {
-    return activities;
-  }
-
-  public void setActivities(List<ActivityDefinition> activities) {
-    this.activities = activities;
-  }
-
-  public String getOn_success() {
-    return on_success;
-  }
-
-  public void setOn_success(String on_success) {
-    this.on_success = on_success;
-  }
-
-  public String getOn_failure() {
-    return on_failure;
-  }
-
-  public void setOn_failure(String on_failure) {
-    this.on_failure = on_failure;
-  }
+    private String target;
+    private String target_relationship;
+    private String operation_host;
+    private List<Constraint> filter;
+    private List<ActivityDefinition> activities;
+    private String on_success;
+    private String on_failure;
+
+    public String getTarget() {
+        return target;
+    }
+
+    public void setTarget(String target) {
+        this.target = target;
+    }
+
+    public String getTarget_relationship() {
+        return target_relationship;
+    }
+
+    public void setTarget_relationship(String target_relationship) {
+        this.target_relationship = target_relationship;
+    }
+
+    public String getOperation_host() {
+        return operation_host;
+    }
+
+    public void setOperation_host(String operation_host) {
+        this.operation_host = operation_host;
+    }
+
+    public List<Constraint> getFilter() {
+        return filter;
+    }
+
+    public void setFilter(List<Constraint> filter) {
+        this.filter = filter;
+    }
+
+    public List<ActivityDefinition> getActivities() {
+        return activities;
+    }
+
+    public void setActivities(List<ActivityDefinition> activities) {
+        this.activities = activities;
+    }
+
+    public String getOn_success() {
+        return on_success;
+    }
+
+    public void setOn_success(String on_success) {
+        this.on_success = on_success;
+    }
+
+    public String getOn_failure() {
+        return on_failure;
+    }
+
+    public void setOn_failure(String on_failure) {
+        this.on_failure = on_failure;
+    }
 }
index 4908816..43abc0c 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.
@@ -17,8 +17,8 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.onap.sdc.tosca.datatypes.model;
 
 public interface Template {
+
 }
index 13332c9..3303672 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.
@@ -17,7 +17,6 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.onap.sdc.tosca.datatypes.model;
 
 import java.sql.Timestamp;
@@ -27,7 +26,7 @@ import lombok.Setter;
 @Getter
 @Setter
 public class TimeInterval {
-  private Timestamp start_time;
-  private Timestamp end_time;
 
+    private Timestamp start_time;
+    private Timestamp end_time;
 }
index fde5f41..b0e5e3e 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.
@@ -17,7 +17,6 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.onap.sdc.tosca.datatypes.model;
 
 import java.util.HashMap;
@@ -27,98 +26,98 @@ import java.util.Objects;
 
 public class TopologyTemplate {
 
-  private String description;
-  private Map<String, ParameterDefinition> inputs;
-  private Map<String, NodeTemplate> node_templates;
-  private Map<String, RelationshipTemplate> relationship_templates;
-  private Map<String, GroupDefinition> groups;
-  private Map<String, ParameterDefinition> outputs;
-  private SubstitutionMapping substitution_mappings;
-  private Map<String, PolicyDefinition> policies;
-  private List<WorkflowDefinition> workflows;
-
-  public String getDescription() {
-    return description;
-  }
-
-  public void setDescription(String description) {
-    this.description = description;
-  }
-
-  public Map<String, ParameterDefinition> getInputs() {
-    return inputs;
-  }
-
-  public void setInputs(Map<String, ParameterDefinition> inputs) {
-    this.inputs = inputs;
-  }
-
-  public Map<String, NodeTemplate> getNode_templates() {
-    return node_templates;
-  }
-
-  public void setNode_templates(Map<String, NodeTemplate> node_templates) {
-    this.node_templates = node_templates;
-  }
-
-  public Map<String, RelationshipTemplate> getRelationship_templates() {
-    return relationship_templates;
-  }
-
-  public void setRelationship_templates(Map<String, RelationshipTemplate> relationship_templates) {
-    this.relationship_templates = relationship_templates;
-  }
-
-  public Map<String, GroupDefinition> getGroups() {
-    return groups;
-  }
-
-  public void setGroups(Map<String, GroupDefinition> groups) {
-    this.groups = groups;
-  }
-
-  /**
-   * Add group.
-   *
-   * @param groupKey        the group key
-   * @param groupDefinition the group definition
-   */
-  public void addGroup(String groupKey, GroupDefinition groupDefinition) {
-    if (Objects.isNull(this.groups)) {
-      this.groups = new HashMap<>();
-    }
-    this.groups.put(groupKey, groupDefinition);
-  }
-
-  public Map<String, ParameterDefinition> getOutputs() {
-    return outputs;
-  }
-
-  public void setOutputs(Map<String, ParameterDefinition> outputs) {
-    this.outputs = outputs;
-  }
-
-  public SubstitutionMapping getSubstitution_mappings() {
-    return substitution_mappings;
-  }
-
-  public void setSubstitution_mappings(SubstitutionMapping substitution_mappings) {
-    this.substitution_mappings = substitution_mappings;
-  }
-
-  public Map<String, PolicyDefinition> getPolicies() {
-    return policies;
-  }
-
-  public void setPolicies(Map<String, PolicyDefinition> policies) {
-    this.policies = policies;
-  }
-
-  public List<WorkflowDefinition> getWorkflows() {
-    return workflows;
-  }
-
-  public void setWorkflows(List<WorkflowDefinition> workflows) {
-    this.workflows = workflows;
-  }
+    private String description;
+    private Map<String, ParameterDefinition> inputs;
+    private Map<String, NodeTemplate> node_templates;
+    private Map<String, RelationshipTemplate> relationship_templates;
+    private Map<String, GroupDefinition> groups;
+    private Map<String, ParameterDefinition> outputs;
+    private SubstitutionMapping substitution_mappings;
+    private Map<String, PolicyDefinition> policies;
+    private List<WorkflowDefinition> workflows;
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public Map<String, ParameterDefinition> getInputs() {
+        return inputs;
+    }
+
+    public void setInputs(Map<String, ParameterDefinition> inputs) {
+        this.inputs = inputs;
+    }
+
+    public Map<String, NodeTemplate> getNode_templates() {
+        return node_templates;
+    }
+
+    public void setNode_templates(Map<String, NodeTemplate> node_templates) {
+        this.node_templates = node_templates;
+    }
+
+    public Map<String, RelationshipTemplate> getRelationship_templates() {
+        return relationship_templates;
+    }
+
+    public void setRelationship_templates(Map<String, RelationshipTemplate> relationship_templates) {
+        this.relationship_templates = relationship_templates;
+    }
+
+    public Map<String, GroupDefinition> getGroups() {
+        return groups;
+    }
+
+    public void setGroups(Map<String, GroupDefinition> groups) {
+        this.groups = groups;
+    }
+
+    /**
+     * Add group.
+     *
+     * @param groupKey        the group key
+     * @param groupDefinition the group definition
+     */
+    public void addGroup(String groupKey, GroupDefinition groupDefinition) {
+        if (Objects.isNull(this.groups)) {
+            this.groups = new HashMap<>();
+        }
+        this.groups.put(groupKey, groupDefinition);
+    }
+
+    public Map<String, ParameterDefinition> getOutputs() {
+        return outputs;
+    }
+
+    public void setOutputs(Map<String, ParameterDefinition> outputs) {
+        this.outputs = outputs;
+    }
+
+    public SubstitutionMapping getSubstitution_mappings() {
+        return substitution_mappings;
+    }
+
+    public void setSubstitution_mappings(SubstitutionMapping substitution_mappings) {
+        this.substitution_mappings = substitution_mappings;
+    }
+
+    public Map<String, PolicyDefinition> getPolicies() {
+        return policies;
+    }
+
+    public void setPolicies(Map<String, PolicyDefinition> policies) {
+        this.policies = policies;
+    }
+
+    public List<WorkflowDefinition> getWorkflows() {
+        return workflows;
+    }
+
+    public void setWorkflows(List<WorkflowDefinition> workflows) {
+        this.workflows = workflows;
+    }
 }
index 4404294..c1ab123 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.
@@ -17,7 +17,6 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.onap.sdc.tosca.datatypes.model;
 
 import java.util.Objects;
@@ -72,7 +71,6 @@ public class Trigger {
     }
 
     public Object getAction() {
-
         return action;
     }
 
@@ -94,11 +92,8 @@ public class Trigger {
             return false;
         }
         Trigger trigger = (Trigger) o;
-        return Objects.equals(description, trigger.description)
-                && Objects.equals(event_type, trigger.event_type)
-                && Objects.equals(schedule, trigger.schedule)
-                && Objects.equals(target_filter, trigger.target_filter)
-                && Objects.equals(condition, trigger.condition)
-                && Objects.equals(action, trigger.action);
+        return Objects.equals(description, trigger.description) && Objects.equals(event_type, trigger.event_type) && Objects
+            .equals(schedule, trigger.schedule) && Objects.equals(target_filter, trigger.target_filter) && Objects
+            .equals(condition, trigger.condition) && Objects.equals(action, trigger.action);
     }
 }
index af5b617..e16cd3e 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.onap.sdc.tosca.datatypes.model;
 
 import java.util.List;
 import java.util.Map;
 
 public class WorkflowDefinition {
-  private String description;
-  private Map<String, String> metadata;
-  private Map<String, PropertyDefinition> inputs;
-  private List<PreconditionDefinition> preconditions;
-  private Map<String, StepDefinition> steps;
 
-  public String getDescription() {
-    return description;
-  }
+    private String description;
+    private Map<String, String> metadata;
+    private Map<String, PropertyDefinition> inputs;
+    private List<PreconditionDefinition> preconditions;
+    private Map<String, StepDefinition> steps;
+
+    public String getDescription() {
+        return description;
+    }
 
-  public void setDescription(String description) {
-    this.description = description;
-  }
+    public void setDescription(String description) {
+        this.description = description;
+    }
 
-  public Map<String, String> getMetadata() {
-    return metadata;
-  }
+    public Map<String, String> getMetadata() {
+        return metadata;
+    }
 
-  public void setMetadata(Map<String, String> metadata) {
-    this.metadata = metadata;
-  }
+    public void setMetadata(Map<String, String> metadata) {
+        this.metadata = metadata;
+    }
 
-  public Map<String, PropertyDefinition> getInputs() {
-    return inputs;
-  }
+    public Map<String, PropertyDefinition> getInputs() {
+        return inputs;
+    }
 
-  public void setInputs(
-      Map<String, PropertyDefinition> inputs) {
-    this.inputs = inputs;
-  }
+    public void setInputs(Map<String, PropertyDefinition> inputs) {
+        this.inputs = inputs;
+    }
 
-  public List<PreconditionDefinition> getPreconditions() {
-    return preconditions;
-  }
+    public List<PreconditionDefinition> getPreconditions() {
+        return preconditions;
+    }
 
-  public void setPreconditions(
-      List<PreconditionDefinition> preconditions) {
-    this.preconditions = preconditions;
-  }
+    public void setPreconditions(List<PreconditionDefinition> preconditions) {
+        this.preconditions = preconditions;
+    }
 
-  public Map<String, StepDefinition> getSteps() {
-    return steps;
-  }
+    public Map<String, StepDefinition> getSteps() {
+        return steps;
+    }
 
-  public void setSteps(
-      Map<String, StepDefinition> steps) {
-    this.steps = steps;
-  }
+    public void setSteps(Map<String, StepDefinition> steps) {
+        this.steps = steps;
+    }
 }
index f32efe4..b05c895 100644 (file)
@@ -13,7 +13,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onap.sdc.tosca.datatypes.model.extension;
 
 import lombok.EqualsAndHashCode;
@@ -27,6 +26,4 @@ import org.onap.sdc.tosca.datatypes.model.RequirementAssignment;
 public class RequirementAssignmentExt extends RequirementAssignment {
 
     private ServiceFilter service_filter;
-
-
 }
index 572af3d..be1d1d9 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onap.sdc.tosca.datatypes.model.extension;
 
 import org.onap.sdc.tosca.datatypes.model.NodeFilter;
 
-
 public class ServiceFilter extends NodeFilter {
 
     private Object tosca_id;
@@ -39,9 +37,7 @@ public class ServiceFilter extends NodeFilter {
         if (!(o instanceof ServiceFilter)) {
             return false;
         }
-
         ServiceFilter that = (ServiceFilter) o;
-
         return getTosca_id() != null ? getTosca_id().equals(that.getTosca_id()) : that.getTosca_id() == null;
     }
 
index 8734dbc..bc1420d 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onap.sdc.tosca.datatypes.model.heatextend;
 
 import java.util.Map;
 
 public class AnnotationDefinition {
 
-  private String type;
-  private Map<String, Object> properties;
-
-  public String getType() {
-    return type;
-  }
+    private String type;
+    private Map<String, Object> properties;
 
-  public void setType(String type) {
-    this.type = type;
-  }
+    public String getType() {
+        return type;
+    }
 
-  public Map<String, Object> getProperties() {
-    return properties;
-  }
+    public void setType(String type) {
+        this.type = type;
+    }
 
-  public void setProperties(Map<String, Object> properties) {
-    this.properties = properties;
-  }
+    public Map<String, Object> getProperties() {
+        return properties;
+    }
 
+    public void setProperties(Map<String, Object> properties) {
+        this.properties = properties;
+    }
 }
index f0eef51..2f64da8 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-    package org.onap.sdc.tosca.datatypes.model.heatextend;
-
-import org.onap.sdc.tosca.datatypes.model.PropertyDefinition;
+package org.onap.sdc.tosca.datatypes.model.heatextend;
 
 import java.util.Map;
+import org.onap.sdc.tosca.datatypes.model.PropertyDefinition;
 
-    public class AnnotationType {
+public class AnnotationType {
 
-      private String version;
-      private String description;
-      private Map<String, PropertyDefinition> properties;
+    private String version;
+    private String description;
+    private Map<String, PropertyDefinition> properties;
 
-      public String getVersion() {
+    public String getVersion() {
         return version;
-      }
+    }
 
-      public void setVersion(String version) {
+    public void setVersion(String version) {
         this.version = version;
-      }
+    }
 
-      public String getDescription() {
+    public String getDescription() {
         return description;
-      }
+    }
 
-      public void setDescription(String description) {
+    public void setDescription(String description) {
         this.description = description;
-      }
+    }
 
-      public Map<String, PropertyDefinition> getProperties() {
+    public Map<String, PropertyDefinition> getProperties() {
         return properties;
-      }
+    }
 
-      public void setProperties(Map<String, PropertyDefinition> properties) {
+    public void setProperties(Map<String, PropertyDefinition> properties) {
         this.properties = properties;
-      }
-
     }
+}
index ae3cc35..41895dd 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onap.sdc.tosca.datatypes.model.heatextend;
 
-import org.onap.sdc.tosca.datatypes.model.ParameterDefinition;
-
 import java.util.Map;
+import org.onap.sdc.tosca.datatypes.model.ParameterDefinition;
 
 public class ParameterDefinitionExt extends ParameterDefinition {
 
-  private String label;
-  private Boolean hidden;
-  private Boolean immutable;
-  private Map<String, AnnotationDefinition> annotations;
-
-  public String getLabel() {
-    return label;
-  }
+    private String label;
+    private Boolean hidden;
+    private Boolean immutable;
+    private Map<String, AnnotationDefinition> annotations;
 
-  public void setLabel(String label) {
-    this.label = label;
-  }
+    public String getLabel() {
+        return label;
+    }
 
-  public Boolean getHidden() {
-    return hidden;
-  }
+    public void setLabel(String label) {
+        this.label = label;
+    }
 
-  public void setHidden(Boolean hidden) {
-    this.hidden = hidden;
-  }
+    public Boolean getHidden() {
+        return hidden;
+    }
 
-  public Boolean getImmutable() {
-    return immutable;
-  }
+    public void setHidden(Boolean hidden) {
+        this.hidden = hidden;
+    }
 
-  public void setImmutable(Boolean immutable) {
-    this.immutable = immutable;
-  }
+    public Boolean getImmutable() {
+        return immutable;
+    }
 
-  public Map<String, AnnotationDefinition> getAnnotations() {
-    return annotations;
-  }
+    public void setImmutable(Boolean immutable) {
+        this.immutable = immutable;
+    }
 
-  public void setAnnotations(Map<String, AnnotationDefinition> annotations) {
-    this.annotations = annotations;
-  }
+    public Map<String, AnnotationDefinition> getAnnotations() {
+        return annotations;
+    }
 
+    public void setAnnotations(Map<String, AnnotationDefinition> annotations) {
+        this.annotations = annotations;
+    }
 }
index 60f2650..1ead5a6 100644 (file)
@@ -17,7 +17,6 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.onap.sdc.tosca.datatypes.model.heatextend;
 
 import java.util.Collections;
@@ -28,14 +27,11 @@ import java.util.Map;
  * The enum Property type ext.
  */
 public enum PropertyTypeExt {
-
     /**
      * Json property type ext.
      */
     JSON("json");
-
-    private static final Map<String, PropertyTypeExt> M_MAP =
-            Collections.unmodifiableMap(initializeMapping());
+    private static final Map<String, PropertyTypeExt> M_MAP = Collections.unmodifiableMap(initializeMapping());
     private String displayName;
 
     PropertyTypeExt(String displayName) {
@@ -63,6 +59,4 @@ public enum PropertyTypeExt {
     public String getDisplayName() {
         return displayName;
     }
-
-
 }
index 10c67bc..e2295dd 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onap.sdc.tosca.error;
 
 public class ToscaRuntimeException extends RuntimeException {
 
-  public ToscaRuntimeException(String message) {
-    super(message);
-  }
+    public ToscaRuntimeException(String message) {
+        super(message);
+    }
 
-  public ToscaRuntimeException(String message, Throwable cause) {
-    super(message, cause);
-  }
+    public ToscaRuntimeException(String message, Throwable cause) {
+        super(message, cause);
+    }
 
-  public ToscaRuntimeException(Throwable cause) {
-    super(cause);
-  }
+    public ToscaRuntimeException(Throwable cause) {
+        super(cause);
+    }
 }
index eb60d95..d6ff22c 100644 (file)
@@ -18,6 +18,8 @@
  */
 package org.onap.sdc.tosca.services;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.collect.ImmutableSet;
 import java.lang.reflect.Field;
 import java.lang.reflect.InvocationTargetException;
 import java.util.Arrays;
@@ -27,42 +29,34 @@ import java.util.Map;
 import java.util.Objects;
 import java.util.Optional;
 import java.util.Set;
-import com.google.common.collect.ImmutableSet;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
 import org.apache.commons.beanutils.BeanUtils;
 
 public class CommonUtil {
 
     public static final String DEFAULT = "default";
     public static final String UNDERSCORE_DEFAULT = "_default";
-    private static ImmutableSet<Class<?>> complexClassType = ImmutableSet.of(Map.class, String.class, Integer.class, Float.class,
-            Double.class, Set.class, Object.class, List.class);
+    private static ImmutableSet<Class<?>> complexClassType = ImmutableSet
+        .of(Map.class, String.class, Integer.class, Float.class, Double.class, Set.class, Object.class, List.class);
 
     private CommonUtil() {
         throw new IllegalStateException("Utility class");
     }
 
-    public static <T> Optional<T> createObjectUsingSetters(Object objectCandidate, Class<? extends T> classToCreate)
-            throws Exception {
+    public static <T> Optional<T> createObjectUsingSetters(Object objectCandidate, Class<? extends T> classToCreate) throws Exception {
         if (Objects.isNull(objectCandidate)) {
             return Optional.empty();
         }
         Map<String, Object> objectAsMap = getObjectAsMap(objectCandidate);
-
         Field[] declaredFields = classToCreate.getDeclaredFields();
         createSubObjectsUsingSetters(objectAsMap, declaredFields);
         T result = populateBean(objectAsMap, classToCreate);
-
         return Optional.of(result);
     }
 
-    public static void createSubObjectsUsingSetters(Map<String, Object> objectAsMap, Field[] declaredFields)
-        throws Exception {
+    public static void createSubObjectsUsingSetters(Map<String, Object> objectAsMap, Field[] declaredFields) throws Exception {
         for (Field field : declaredFields) {
             if (isComplexClass(field)) {
-                Optional<?> objectUsingSetters =
-                        createObjectUsingSetters(objectAsMap.get(field.getName()), field.getType());
+                Optional<?> objectUsingSetters = createObjectUsingSetters(objectAsMap.get(field.getName()), field.getType());
                 if (objectUsingSetters.isPresent()) {
                     objectAsMap.remove(field.getName());
                     objectAsMap.put(field.getName(), objectUsingSetters.get());
@@ -79,9 +73,7 @@ public class CommonUtil {
     }
 
     public static Map<String, Object> getObjectAsMap(Object obj) {
-        Map<String, Object> objectAsMap =
-                obj instanceof Map ? (Map<String, Object>) obj : new ObjectMapper().convertValue(obj, Map.class);
-
+        Map<String, Object> objectAsMap = obj instanceof Map ? (Map<String, Object>) obj : new ObjectMapper().convertValue(obj, Map.class);
         if (objectAsMap.containsKey(DEFAULT)) {
             Object defaultValue = objectAsMap.get(DEFAULT);
             objectAsMap.remove(DEFAULT);
index c41282f..c31c5bd 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onap.sdc.tosca.services;
 
-
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -42,7 +40,6 @@ public class DataModelCloneUtil {
      * @return the list
      */
     public static List<Constraint> cloneConstraints(List<Constraint> constraints) {
-
         if (constraints == null) {
             return null;
         }
@@ -55,8 +52,7 @@ public class DataModelCloneUtil {
      * @param propertyDefinitions the property definitions
      * @return the map
      */
-    public static Map<String, PropertyDefinition> clonePropertyDefinitions(
-            Map<String, PropertyDefinition> propertyDefinitions) {
+    public static Map<String, PropertyDefinition> clonePropertyDefinitions(Map<String, PropertyDefinition> propertyDefinitions) {
         if (propertyDefinitions == null) {
             return null;
         }
@@ -64,7 +60,6 @@ public class DataModelCloneUtil {
         for (Map.Entry<String, PropertyDefinition> propertyDefinitionEntry : propertyDefinitions.entrySet()) {
             clonedProperties.put(propertyDefinitionEntry.getKey(), propertyDefinitionEntry.getValue().clone());
         }
-
         return clonedProperties;
     }
 
@@ -74,18 +69,14 @@ public class DataModelCloneUtil {
      * @param attributeDefinitions the attribute definitions
      * @return the map
      */
-    public static Map<String, AttributeDefinition> cloneAttributeDefinitions(
-            Map<String, AttributeDefinition> attributeDefinitions) {
-
+    public static Map<String, AttributeDefinition> cloneAttributeDefinitions(Map<String, AttributeDefinition> attributeDefinitions) {
         if (attributeDefinitions == null) {
             return null;
         }
         Map<String, AttributeDefinition> clonedAttributeDefinitions = new HashMap<>();
         for (Map.Entry<String, AttributeDefinition> attributeDefinitionEntry : attributeDefinitions.entrySet()) {
-            clonedAttributeDefinitions
-                    .put(attributeDefinitionEntry.getKey(), attributeDefinitionEntry.getValue().clone());
+            clonedAttributeDefinitions.put(attributeDefinitionEntry.getKey(), attributeDefinitionEntry.getValue().clone());
         }
-
         return clonedAttributeDefinitions;
     }
 
@@ -108,17 +99,15 @@ public class DataModelCloneUtil {
      * @param stringPropertyDefinitionMap the map that will be cloned
      * @return the cloned map
      */
-    public static Map<String, PropertyDefinition> cloneStringPropertyDefinitionMap(
-            Map<String, PropertyDefinition> stringPropertyDefinitionMap) {
+    public static Map<String, PropertyDefinition> cloneStringPropertyDefinitionMap(Map<String, PropertyDefinition> stringPropertyDefinitionMap) {
         if (Objects.isNull(stringPropertyDefinitionMap)) {
             return null;
         }
-
         Map<String, PropertyDefinition> cloneMap = new HashMap<>();
         ToscaExtensionYamlUtil toscaExtYamlUtil = new ToscaExtensionYamlUtil();
         for (Map.Entry<String, PropertyDefinition> mapEntry : stringPropertyDefinitionMap.entrySet()) {
-            PropertyDefinition propertyDefinition = toscaExtYamlUtil.yamlToObject(
-                    toscaExtYamlUtil.objectToYaml(mapEntry.getValue()), PropertyDefinition.class);
+            PropertyDefinition propertyDefinition = toscaExtYamlUtil
+                .yamlToObject(toscaExtYamlUtil.objectToYaml(mapEntry.getValue()), PropertyDefinition.class);
             cloneMap.put(mapEntry.getKey(), propertyDefinition.clone());
         }
         return cloneMap;
@@ -130,18 +119,14 @@ public class DataModelCloneUtil {
      * @param input the map that will be cloned
      * @return the cloned map
      */
-    public static <T extends OperationDefinition> Map<String, T> cloneStringOperationDefinitionMap(
-            Map<String, T> input) {
-
+    public static <T extends OperationDefinition> Map<String, T> cloneStringOperationDefinitionMap(Map<String, T> input) {
         if (Objects.isNull(input)) {
             return null;
         }
-
         Map<String, OperationDefinition> cloneMap = new HashMap<>();
         for (Map.Entry<String, T> mapEntry : input.entrySet()) {
             cloneMap.put(mapEntry.getKey(), Objects.isNull(mapEntry.getValue()) ? null : mapEntry.getValue().clone());
         }
-
         return (Map<String, T>) cloneMap;
     }
 
@@ -155,7 +140,6 @@ public class DataModelCloneUtil {
         if (Objects.isNull(stringObjectMap)) {
             return null;
         }
-
         Map<String, Object> cloneMap = new HashMap<>();
         for (Map.Entry<String, Object> mapEntry : stringObjectMap.entrySet()) {
             YamlUtil yamlUtil = new YamlUtil();
@@ -186,6 +170,4 @@ public class DataModelCloneUtil {
         }
         return new ArrayList<>(listString);
     }
-
-
 }
index 0a24375..1d9befb 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.
@@ -17,7 +17,6 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.onap.sdc.tosca.services;
 
 import java.util.ArrayList;
@@ -27,7 +26,6 @@ import java.util.Map;
 import java.util.Objects;
 import java.util.Optional;
 import java.util.Set;
-
 import org.apache.commons.collections4.CollectionUtils;
 import org.onap.sdc.tosca.datatypes.model.Import;
 import org.onap.sdc.tosca.error.ToscaRuntimeException;
@@ -53,9 +51,10 @@ public class DataModelConvertUtil {
     }
 
     private static void convertToscaImportEntry(List<Map<String, Import>> convertedImport, Object importEntry,
-                                         ToscaExtensionYamlUtil toscaExtensionYamlUtil) {
+                                                ToscaExtensionYamlUtil toscaExtensionYamlUtil) {
         if (importEntry instanceof String) {
             //Support for import short notation
+
             /*
             imports:
               - <file_URI_1>
@@ -68,12 +67,11 @@ public class DataModelConvertUtil {
     }
 
     private static void handleImportMultiLineGrammar(List<Map<String, Import>> convertedImport, Object importEntry,
-                                              ToscaExtensionYamlUtil toscaExtensionYamlUtil) {
+                                                     ToscaExtensionYamlUtil toscaExtensionYamlUtil) {
         try {
             if (((Map) importEntry).containsKey("file")) {
                 //Support for import entry of the format - file: <file_uri> or - file: <import object>
-                Import importObject = toscaExtensionYamlUtil
-                        .yamlToObject(toscaExtensionYamlUtil.objectToYaml(importEntry), Import.class);
+                Import importObject = toscaExtensionYamlUtil.yamlToObject(toscaExtensionYamlUtil.objectToYaml(importEntry), Import.class);
                 convertImportExtendedNotation(convertedImport, importObject);
             } else {
                 convertImportMultiLineGrammar(convertedImport, (Map) importEntry, toscaExtensionYamlUtil);
@@ -97,8 +95,7 @@ public class DataModelConvertUtil {
                           namespace_uri: http://test.xyz/uri
                           namespace_prefix: pref
                  */
-                Import importObject = toscaExtensionYamlUtil
-                        .yamlToObject(toscaExtensionYamlUtil.objectToYaml(importValue), Import.class);
+                Import importObject = toscaExtensionYamlUtil.yamlToObject(toscaExtensionYamlUtil.objectToYaml(importValue), Import.class);
                 Map<String, Import> convertedToscaImport = new HashMap<>();
                 convertedToscaImport.put(key, importObject);
                 convertedImport.add(convertedToscaImport);
@@ -111,8 +108,7 @@ public class DataModelConvertUtil {
 
     private static void convertImportExtendedNotation(List<Map<String, Import>> convertedImport, Import importEntry) {
         Map<String, Import> importMap = new HashMap<>();
-        Optional<String> fileNameWithoutExtension =
-                getFileNameWithoutExtension(getFileName(importEntry.getFile()).replaceAll("/", "_"));
+        Optional<String> fileNameWithoutExtension = getFileNameWithoutExtension(getFileName(importEntry.getFile()).replaceAll("/", "_"));
         if (fileNameWithoutExtension.isPresent()) {
             importMap.put(fileNameWithoutExtension.get(), importEntry);
             convertedImport.add(importMap);
@@ -134,11 +130,9 @@ public class DataModelConvertUtil {
         if (Objects.isNull(fileName)) {
             return Optional.empty();
         }
-        return !fileName.contains(".") ? Optional.of(fileName)
-                : Optional.of(fileName.substring(0, fileName.lastIndexOf('.')));
+        return !fileName.contains(".") ? Optional.of(fileName) : Optional.of(fileName.substring(0, fileName.lastIndexOf('.')));
     }
 
-
     private static String getFileName(String relativeFileName) {
         if (relativeFileName.contains("../")) {
             return relativeFileName.replace("../", "");
index b8a950c..dfa7451 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onap.sdc.tosca.services;
 
-
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -31,8 +29,7 @@ public class DataModelNormalizeUtil {
         throw new IllegalStateException("Utility class");
     }
 
-    public static List<Map<String, CapabilityFilter>> getNormalizeCapabilitiesFilter(
-            List<Map<String, CapabilityFilter>> capabilitiesFilter) {
+    public static List<Map<String, CapabilityFilter>> getNormalizeCapabilitiesFilter(List<Map<String, CapabilityFilter>> capabilitiesFilter) {
         if (CollectionUtils.isEmpty(capabilitiesFilter)) {
             return capabilitiesFilter;
         }
@@ -44,8 +41,7 @@ public class DataModelNormalizeUtil {
         return normalizeCapabilities;
     }
 
-    private static Map<String, CapabilityFilter> getNormalizeCapabilityFilterEntry(
-            Map<String, CapabilityFilter> capabilityFilterEntry) {
+    private static Map<String, CapabilityFilter> getNormalizeCapabilityFilterEntry(Map<String, CapabilityFilter> capabilityFilterEntry) {
         Map<String, CapabilityFilter> normalizeCapabilityEntry = new HashMap<>();
         String capabilityKey = capabilityFilterEntry.keySet().iterator().next(); //only one entry exist in the map
         Object capabilityFilterObj = capabilityFilterEntry.get(capabilityKey);
@@ -56,15 +52,13 @@ public class DataModelNormalizeUtil {
 
     private static CapabilityFilter getNormalizeCapabilityFilter(Object capabilityFilterObj) {
         ToscaExtensionYamlUtil toscaExtensionYamlUtil = new ToscaExtensionYamlUtil();
-        CapabilityFilter capabilityFilter = toscaExtensionYamlUtil.yamlToObject(
-                toscaExtensionYamlUtil.objectToYaml(capabilityFilterObj), CapabilityFilter.class);
+        CapabilityFilter capabilityFilter = toscaExtensionYamlUtil
+            .yamlToObject(toscaExtensionYamlUtil.objectToYaml(capabilityFilterObj), CapabilityFilter.class);
         capabilityFilter.setProperties(getNormalizePropertiesFilter(capabilityFilter.getProperties()));
-
         return capabilityFilter;
     }
 
-    public static List<Map<String, List<Constraint>>> getNormalizePropertiesFilter(
-            List<Map<String, List<Constraint>>> properties) {
+    public static List<Map<String, List<Constraint>>> getNormalizePropertiesFilter(List<Map<String, List<Constraint>>> properties) {
         if (CollectionUtils.isEmpty(properties)) {
             return properties;
         }
@@ -74,11 +68,9 @@ public class DataModelNormalizeUtil {
             normalizeProperties.add(normalizePropertyEntry);
         }
         return normalizeProperties;
-
     }
 
-    private static Map<String, List<Constraint>> getNormalizePropertyFilterEntry(
-            Map<String, List<Constraint>> propertyFilterEntry) {
+    private static Map<String, List<Constraint>> getNormalizePropertyFilterEntry(Map<String, List<Constraint>> propertyFilterEntry) {
         Map<String, List<Constraint>> normalizePropertyEntry = new HashMap<>();
         String propertyKey = propertyFilterEntry.keySet().iterator().next();  //only one entry exist in the map
         List<Constraint> constraints = propertyFilterEntry.get(propertyKey);
@@ -92,8 +84,7 @@ public class DataModelNormalizeUtil {
         List<Constraint> normalizeConstraints = new ArrayList<>();
         for (Object constraintObj : constraints) {
             Constraint normalizeConstraint = toscaExtensionYamlUtil
-                                                     .yamlToObject(toscaExtensionYamlUtil.objectToYaml(constraintObj),
-                                                             Constraint.class);
+                .yamlToObject(toscaExtensionYamlUtil.objectToYaml(constraintObj), Constraint.class);
             normalizeConstraints.add(normalizeConstraint);
         }
         return normalizeConstraints;
index 466d669..5115d05 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.onap.sdc.tosca.services;
 
+import java.util.LinkedHashSet;
+import java.util.Set;
 import org.yaml.snakeyaml.introspector.BeanAccess;
 import org.yaml.snakeyaml.introspector.Property;
 import org.yaml.snakeyaml.introspector.PropertyUtils;
 
-import java.util.LinkedHashSet;
-import java.util.Set;
-
 public class MyPropertyUtils extends PropertyUtils {
+
     //Unsorted properties
     @Override
     protected Set<Property> createPropertySet(Class<? extends Object> type, BeanAccess bnAccess) {
-        return new LinkedHashSet<>(getPropertiesMap(type,
-                BeanAccess.FIELD).values());
+        return new LinkedHashSet<>(getPropertiesMap(type, BeanAccess.FIELD).values());
     }
 
     @Override
@@ -43,5 +41,4 @@ public class MyPropertyUtils extends PropertyUtils {
         }
         return super.getProperty(type, updatedName);
     }
-
 }
index 7babd42..678ba00 100644 (file)
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-
 package org.onap.sdc.tosca.services;
 
-import org.yaml.snakeyaml.constructor.Constructor;
-import org.yaml.snakeyaml.nodes.MappingNode;
-import org.yaml.snakeyaml.parser.ParserException;
-
 import java.util.AbstractMap;
 import java.util.Map;
 import java.util.Set;
+import org.yaml.snakeyaml.constructor.Constructor;
+import org.yaml.snakeyaml.nodes.MappingNode;
+import org.yaml.snakeyaml.parser.ParserException;
 
 public class StrictMapAppenderConstructor extends Constructor {
+
     /**
      * Instantiates a new Strict map appender constructor.
      *
@@ -62,9 +61,7 @@ public class StrictMapAppenderConstructor extends Constructor {
         try {
             return super.constructMapping(node);
         } catch (IllegalStateException exception) {
-            throw new ParserException("while parsing MappingNode",
-                    node.getStartMark(), exception.getMessage(),
-                    node.getEndMark());
+            throw new ParserException("while parsing MappingNode", node.getStartMark(), exception.getMessage(), node.getEndMark());
         }
     }
 }
index 37d8411..995ff94 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onap.sdc.tosca.services;
 
-import java.beans.IntrospectionException;
 import org.onap.sdc.tosca.error.ToscaRuntimeException;
 import org.yaml.snakeyaml.constructor.Constructor;
 import org.yaml.snakeyaml.introspector.Property;
@@ -24,19 +22,13 @@ import org.yaml.snakeyaml.introspector.PropertyUtils;
 import org.yaml.snakeyaml.nodes.MappingNode;
 import org.yaml.snakeyaml.nodes.NodeId;
 
-
 public class ToscaExtensionYamlUtil extends YamlUtil {
 
-    public static final String TOSCA_MODEL_PARAMETER_DEFINITION =
-            "org.onap.sdc.tosca.datatypes.model.ParameterDefinition";
-    public static final String TOSCA_MODEL_EXT_PARAMETER_DEFINITION =
-            "org.onap.sdc.tosca.datatypes.model.heatextend.ParameterDefinitionExt";
-    public static final String TOSCA_MODEL_REQUIREMENT_ASSIGNMENT =
-            "org.onap.sdc.tosca.datatypes.model.RequirementAssignment";
-    public static final String TOSCA_MODEL_EXT_REQUIREMENT_ASSIGNMENT =
-            "org.onap.sdc.tosca.datatypes.model.extension.RequirementAssignmentExt";
-    public static final String TOSCA_MODEL_SUBSTITUTION_MAPPING =
-            "org.onap.sdc.tosca.datatypes.model.SubstitutionMapping";
+    public static final String TOSCA_MODEL_PARAMETER_DEFINITION = "org.onap.sdc.tosca.datatypes.model.ParameterDefinition";
+    public static final String TOSCA_MODEL_EXT_PARAMETER_DEFINITION = "org.onap.sdc.tosca.datatypes.model.heatextend.ParameterDefinitionExt";
+    public static final String TOSCA_MODEL_REQUIREMENT_ASSIGNMENT = "org.onap.sdc.tosca.datatypes.model.RequirementAssignment";
+    public static final String TOSCA_MODEL_EXT_REQUIREMENT_ASSIGNMENT = "org.onap.sdc.tosca.datatypes.model.extension.RequirementAssignmentExt";
+    public static final String TOSCA_MODEL_SUBSTITUTION_MAPPING = "org.onap.sdc.tosca.datatypes.model.SubstitutionMapping";
 
     @Override
     public <T> Constructor getConstructor(Class<T> typClass) {
@@ -51,7 +43,7 @@ public class ToscaExtensionYamlUtil extends YamlUtil {
     public class ToscaPropertyUtilsWithHeatExtension extends MyPropertyUtils {
 
         @Override
-        public Property getProperty(Class<? extends Object> type, String name)  {
+        public Property getProperty(Class<? extends Object> type, String name) {
             Class<? extends Object> classType = type;
             try {
                 if (type.equals(Class.forName(TOSCA_MODEL_PARAMETER_DEFINITION))) {
index 8530846..d8e592d 100644 (file)
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.onap.sdc.tosca.services;
 
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.yaml.snakeyaml.DumperOptions;
@@ -30,19 +36,43 @@ import org.yaml.snakeyaml.nodes.NodeTuple;
 import org.yaml.snakeyaml.nodes.Tag;
 import org.yaml.snakeyaml.representer.Representer;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.*;
-
 /**
  * The type Yaml util.
  */
 @SuppressWarnings("unchecked")
 public class YamlUtil {
-    private static final Logger LOGGER = LoggerFactory.getLogger(YamlUtil.class.getName());
 
     static final String DEFAULT = "default";
     static final String DEFAULT_STR = "_default";
+    private static final Logger LOGGER = LoggerFactory.getLogger(YamlUtil.class.getName());
+
+    /**
+     * Parse a YAML file to List
+     *
+     * @param yamlFileInputStream the YAML file input stream
+     * @return The YAML casted as a list
+     */
+    public static Optional<List<Object>> yamlToList(final InputStream yamlFileInputStream) {
+        List<Object> yamlList = null;
+        try {
+            yamlList = (List<Object>) read(yamlFileInputStream);
+        } catch (final ClassCastException ex) {
+            if (LOGGER.isWarnEnabled()) {
+                LOGGER.warn("Could not parse YAML to List.", ex);
+            }
+        }
+        return Optional.ofNullable(yamlList);
+    }
+
+    /**
+     * Parse a YAML file to Object
+     *
+     * @param yamlFileInputStream the YAML file input stream
+     * @return The YAML Object
+     */
+    public static Object read(final InputStream yamlFileInputStream) {
+        return new Yaml().load(yamlFileInputStream);
+    }
 
     /**
      * Yaml to object t.
@@ -57,7 +87,8 @@ public class YamlUtil {
         constructor.setPropertyUtils(getPropertyUtils());
         TypeDescription yamlFileDescription = new TypeDescription(typClass);
         constructor.addTypeDescription(yamlFileDescription);
-        T yamlObj = new Yaml(constructor, new Representer(), new DumperOptions(), getLoaderOptions()).load(yamlContent);;
+        T yamlObj = new Yaml(constructor, new Representer(), new DumperOptions(), getLoaderOptions()).load(yamlContent);
+        ;
         //noinspection ResultOfMethodCallIgnored
         yamlObj.toString();
         return yamlObj;
@@ -111,7 +142,6 @@ public class YamlUtil {
         return options;
     }
 
-
     /**
      * Gets constructor.
      *
@@ -132,7 +162,6 @@ public class YamlUtil {
         return new MyPropertyUtils();
     }
 
-
     /**
      * Yaml to map map.
      *
@@ -143,35 +172,6 @@ public class YamlUtil {
         return new Yaml().load(yamlContent);
     }
 
-
-    /**
-     * Parse a YAML file to List
-     *
-     * @param yamlFileInputStream the YAML file input stream
-     * @return The YAML casted as a list
-     */
-    public static Optional<List<Object>> yamlToList(final InputStream yamlFileInputStream) {
-        List<Object> yamlList = null;
-        try {
-            yamlList = (List<Object>) read(yamlFileInputStream);
-        } catch (final ClassCastException ex) {
-            if (LOGGER.isWarnEnabled()) {
-                LOGGER.warn("Could not parse YAML to List.", ex);
-            }
-        }
-        return Optional.ofNullable(yamlList);
-    }
-
-    /**
-     * Parse a YAML file to Object
-     *
-     * @param yamlFileInputStream the YAML file input stream
-     * @return The YAML Object
-     */
-    public static Object read(final InputStream yamlFileInputStream) {
-        return new Yaml().load(yamlFileInputStream);
-    }
-
     /**
      * Object to yaml string.
      *
@@ -185,7 +185,6 @@ public class YamlUtil {
         Representer representer = new CustomRepresenter();
         representer.addClassTag(obj.getClass(), Tag.MAP);
         representer.setPropertyUtils(new MyPropertyUtils());
-
         Yaml yaml = new Yaml(representer, options);
         return yaml.dump(obj);
     }
@@ -204,30 +203,24 @@ public class YamlUtil {
         }
     }
 
-
     private class CustomRepresenter extends Representer {
+
         @Override
         protected MappingNode representJavaBean(Set<Property> properties, Object javaBean) {
             //remove the bean type from the output yaml (!! ...)
             if (!classTags.containsKey(javaBean.getClass())) {
                 addClassTag(javaBean.getClass(), Tag.MAP);
             }
-
             return super.representJavaBean(properties, javaBean);
         }
 
         @Override
-        protected NodeTuple representJavaBeanProperty(Object javaBean, Property property,
-                                                      Object propertyValue, Tag customTag) {
+        protected NodeTuple representJavaBeanProperty(Object javaBean, Property property, Object propertyValue, Tag customTag) {
             if (propertyValue == null) {
                 return null;
             } else {
-                NodeTuple defaultNode =
-                        super.representJavaBeanProperty(javaBean, property, propertyValue, customTag);
-
-                return DEFAULT_STR.equals(property.getName())
-                        ? new NodeTuple(representData(DEFAULT), defaultNode.getValueNode())
-                        : defaultNode;
+                NodeTuple defaultNode = super.representJavaBeanProperty(javaBean, property, propertyValue, customTag);
+                return DEFAULT_STR.equals(property.getName()) ? new NodeTuple(representData(DEFAULT), defaultNode.getValueNode()) : defaultNode;
             }
         }
     }