summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/Config.java1
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/Configuration.java2
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/ConfigurationLoader.java3
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/ConfigurationManager.java1
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/Hint.java5
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/ConfigurationUtils.java211
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/Constants.java1
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/NonConfigResource.java70
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/AggregateConfiguration.java23
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/CliConfigurationImpl.java10
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationFilter.java7
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationImpl.java312
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationRepository.java43
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ContextListener.java1
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/YamlConfiguration.java2
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/type/ConfigurationMode.java5
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/type/ConfigurationQuery.java4
-rw-r--r--common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/type/ConfigurationType.java5
-rw-r--r--common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/GABService.java19
-rw-r--r--common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/GABServiceImpl.java6
-rw-r--r--common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABQuery.java17
-rw-r--r--common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABResult.java2
-rw-r--r--common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABResultEntry.java9
-rw-r--r--common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABResults.java1
-rw-r--r--common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/yaml/GABYamlParser.java14
-rw-r--r--common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/yaml/YamlParser.java15
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ActivityDefinition.java14
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ArtifactDefinition.java16
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ArtifactType.java22
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/AttributeDefinition.java9
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityAssignment.java35
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityDefinition.java165
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityFilter.java3
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityType.java91
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Condition.java2
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Constraint.java102
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Credential.java82
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/DataType.java213
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/DefinitionOfDataType.java173
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Directive.java11
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/EntrySchema.java80
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/EventFilter.java47
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/GroupDefinition.java92
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/GroupType.java171
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Implementation.java6
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Import.java63
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Interface.java49
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinition.java29
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionTemplate.java9
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionType.java13
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceType.java40
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeFilter.java10
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeTemplate.java35
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeType.java25
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/OperationDefinition.java6
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/OperationDefinitionTemplate.java4
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/OperationDefinitionType.java2
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ParameterDefinition.java3
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PolicyDefinition.java2
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PolicyType.java3
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PreconditionDefinition.java13
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PropertyDefinition.java43
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PropertyType.java103
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RelationshipTemplate.java25
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RelationshipType.java6
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Repository.java5
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RequirementAssignment.java17
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RequirementDefinition.java98
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Scalar.java21
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ScalarUnitValidator.java20
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ServiceTemplate.java6
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Status.java14
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/StepDefinition.java132
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/SubstitutionMapping.java1
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Template.java6
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/TimeInterval.java9
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/TopologyTemplate.java193
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Trigger.java15
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/WorkflowDefinition.java79
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/extension/RequirementAssignmentExt.java3
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/extension/ServiceFilter.java4
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/AnnotationDefinition.java30
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/AnnotationType.java39
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/ParameterDefinitionExt.java61
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/PropertyTypeExt.java8
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/error/ToscaRuntimeException.java19
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/CommonUtil.java24
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/DataModelCloneUtil.java32
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/DataModelConvertUtil.java24
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/DataModelNormalizeUtil.java23
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/MyPropertyUtils.java11
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/StrictMapAppenderConstructor.java13
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/ToscaExtensionYamlUtil.java20
-rw-r--r--common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/YamlUtil.java91
94 files changed, 1551 insertions, 2073 deletions
diff --git a/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/Config.java b/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/Config.java
index 73ddc5d273..8c14e23cf7 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/Config.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/Config.java
@@ -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.lang.annotation.ElementType;
diff --git a/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/Configuration.java b/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/Configuration.java
index d5b5a10bcf..81a629af1e 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/Configuration.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/Configuration.java
@@ -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 {
diff --git a/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/ConfigurationLoader.java b/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/ConfigurationLoader.java
index 78f8b23024..572c2264a0 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/ConfigurationLoader.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/ConfigurationLoader.java
@@ -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");
}
}
diff --git a/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/ConfigurationManager.java b/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/ConfigurationManager.java
index 9f0f8b7113..76193a4642 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/ConfigurationManager.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/ConfigurationManager.java
@@ -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.Collection;
diff --git a/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/Hint.java b/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/Hint.java
index 373b643ef2..0f6d6f9f67 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/Hint.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-api/src/main/java/org/onap/config/api/Hint.java
@@ -13,13 +13,10 @@
* 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;
}
-
-
}
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/ConfigurationUtils.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/ConfigurationUtils.java
index c13a3a458a..71dd457e6f 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/ConfigurationUtils.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/ConfigurationUtils.java
@@ -16,33 +16,16 @@
* 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;
}
-
}
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/Constants.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/Constants.java
index 97963c4c4e..088d474252 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/Constants.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/Constants.java
@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.onap.config;
public class Constants {
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/NonConfigResource.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/NonConfigResource.java
index 5e21fbdfb9..5eb09011bf 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/NonConfigResource.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/NonConfigResource.java
@@ -13,12 +13,8 @@
* 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);
- }
- }
}
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/AggregateConfiguration.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/AggregateConfiguration.java
index 07c81e5f5b..0621561dcc 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/AggregateConfiguration.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/AggregateConfiguration.java
@@ -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());
}
}
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/CliConfigurationImpl.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/CliConfigurationImpl.java
index f919e234f0..3ddf0a9079 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/CliConfigurationImpl.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/CliConfigurationImpl.java
@@ -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;
}
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationFilter.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationFilter.java
index 06981e4b3b..ea48d3fe01 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationFilter.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationFilter.java
@@ -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
}
-
}
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationImpl.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationImpl.java
index 5d49fa970f..964b8d1a2d 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationImpl.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationImpl.java
@@ -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);
}
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationRepository.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationRepository.java
index 7b2e267a14..9be4c262b8 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationRepository.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ConfigurationRepository.java
@@ -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;
}
}
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ContextListener.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ContextListener.java
index 520852ee1f..9f9706f622 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ContextListener.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/ContextListener.java
@@ -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.MBEAN_NAME;
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/YamlConfiguration.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/YamlConfiguration.java
index bdaf21915e..d7b8df1487 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/YamlConfiguration.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/impl/YamlConfiguration.java
@@ -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());
}
-
}
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/type/ConfigurationMode.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/type/ConfigurationMode.java
index 8293abaf5c..e8a35a08e1 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/type/ConfigurationMode.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/type/ConfigurationMode.java
@@ -13,9 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.onap.config.type;
-public enum ConfigurationMode {
- OVERRIDE, UNION, MERGE
-}
+public enum ConfigurationMode {OVERRIDE, UNION, MERGE}
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/type/ConfigurationQuery.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/type/ConfigurationQuery.java
index e0542369c4..e9fc843b7e 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/type/ConfigurationQuery.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/type/ConfigurationQuery.java
@@ -13,12 +13,11 @@
* 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;
diff --git a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/type/ConfigurationType.java b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/type/ConfigurationType.java
index 3fd486522d..90b0feafa4 100644
--- a/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/type/ConfigurationType.java
+++ b/common/onap-common-configuration-management/onap-configuration-management-core/src/main/java/org/onap/config/type/ConfigurationType.java
@@ -13,9 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.onap.config.type;
-public enum ConfigurationType {
- PROPERTIES, XML, JSON, YAML
-}
+public enum ConfigurationType {PROPERTIES, XML, JSON, YAML}
diff --git a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/GABService.java b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/GABService.java
index 0ac976a18a..5a3a36c753 100644
--- a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/GABService.java
+++ b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/GABService.java
@@ -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;
-
}
-
diff --git a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/GABServiceImpl.java b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/GABServiceImpl.java
index 0a8a206e0b..900c71a931 100644
--- a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/GABServiceImpl.java
+++ b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/GABServiceImpl.java
@@ -17,11 +17,9 @@
* 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());
}
}
diff --git a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABQuery.java b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABQuery.java
index cbe7ef31cf..201579029d 100644
--- a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABQuery.java
+++ b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABQuery.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.onap.sdc.gab.model;
import java.util.Set;
@@ -32,29 +31,21 @@ import lombok.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}
}
diff --git a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABResult.java b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABResult.java
index 3338024db8..13d713a4f1 100644
--- a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABResult.java
+++ b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABResult.java
@@ -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();
}
-
}
diff --git a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABResultEntry.java b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABResultEntry.java
index cc6abd5170..f953577272 100644
--- a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABResultEntry.java
+++ b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABResultEntry.java
@@ -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();
}
}
diff --git a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABResults.java b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABResults.java
index 23d026b2f4..f0871ec65a 100644
--- a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABResults.java
+++ b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/model/GABResults.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.onap.sdc.gab.model;
import com.google.common.base.MoreObjects;
diff --git a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/yaml/GABYamlParser.java b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/yaml/GABYamlParser.java
index fae94421ae..3b9ff09a18 100644
--- a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/yaml/GABYamlParser.java
+++ b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/yaml/GABYamlParser.java
@@ -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
diff --git a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/yaml/YamlParser.java b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/yaml/YamlParser.java
index 2dbb8adfa3..ab8bb9d174 100644
--- a/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/yaml/YamlParser.java
+++ b/common/onap-generic-artifact-browser/onap-generic-artifact-browser-service/src/main/java/org/onap/sdc/gab/yaml/YamlParser.java
@@ -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 {
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ActivityDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ActivityDefinition.java
index 42d9d109b3..abcb8b52a4 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ActivityDefinition.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ActivityDefinition.java
@@ -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;
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ArtifactDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ArtifactDefinition.java
index 11f535461e..90809f0304 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ArtifactDefinition.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ArtifactDefinition.java
@@ -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,20 +17,18 @@
* 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;
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ArtifactType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ArtifactType.java
index 54ca3089c7..8b80a9548f 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ArtifactType.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ArtifactType.java
@@ -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;
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/AttributeDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/AttributeDefinition.java
index 9dfbc39880..ab988fe837 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/AttributeDefinition.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/AttributeDefinition.java
@@ -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;
}
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityAssignment.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityAssignment.java
index bed4e8c6b0..e16d5cf55c 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityAssignment.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityAssignment.java
@@ -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,31 +17,28 @@
* 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;
+ }
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityDefinition.java
index 4d0a38a77e..144822d07d 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityDefinition.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityDefinition.java
@@ -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,96 +17,87 @@
* 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;
+ }
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityFilter.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityFilter.java
index dc868c938a..682a159116 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityFilter.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityFilter.java
@@ -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 + '}';
}
-
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityType.java
index a6368f8a6f..403b48ed29 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityType.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/CapabilityType.java
@@ -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,68 +17,65 @@
* 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;
+ }
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Condition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Condition.java
index f85ea5c7d2..628e094cfc 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Condition.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Condition.java
@@ -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;
-
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Constraint.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Constraint.java
index 5b62af0dc9..b0bf1377a2 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Constraint.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Constraint.java
@@ -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,12 +17,10 @@
* 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);
+ }
+ }
}
- }
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Credential.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Credential.java
index 217af07d05..b843c629d8 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Credential.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Credential.java
@@ -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,59 +17,59 @@
* 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;
+ }
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/DataType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/DataType.java
index acf11c25f9..6ea83ceef7 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/DataType.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/DataType.java
@@ -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;
+ }
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/DefinitionOfDataType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/DefinitionOfDataType.java
index 310f9004af..73b5d77599 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/DefinitionOfDataType.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/DefinitionOfDataType.java
@@ -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;
+ }
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Directive.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Directive.java
index e072a733ec..1b4e1ee09d 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Directive.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Directive.java
@@ -17,21 +17,14 @@
* 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;
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/EntrySchema.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/EntrySchema.java
index b83e7ddc2e..932e3c7836 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/EntrySchema.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/EntrySchema.java
@@ -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,49 +17,47 @@
* 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;
+ }
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/EventFilter.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/EventFilter.java
index 30516aaad9..53deafc92b 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/EventFilter.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/EventFilter.java
@@ -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,36 +17,35 @@
* 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;
+ }
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/GroupDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/GroupDefinition.java
index e2002bf22e..599c5e3002 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/GroupDefinition.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/GroupDefinition.java
@@ -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,69 +17,65 @@
* 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;
+ }
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/GroupType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/GroupType.java
index 611b1bf447..751a829b33 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/GroupType.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/GroupType.java
@@ -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,97 +17,92 @@
* 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;
+ }
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Implementation.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Implementation.java
index e771f4e5b9..6e05e39c18 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Implementation.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Implementation.java
@@ -14,15 +14,12 @@
* 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
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Import.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Import.java
index 604607c11e..436c066566 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Import.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Import.java
@@ -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,47 +17,44 @@
* 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;
+ }
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Interface.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Interface.java
index 2b230569cf..72303e339b 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Interface.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Interface.java
@@ -13,12 +13,9 @@
* 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));
}
-
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinition.java
index 9bb35d81eb..0936b753c5 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinition.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinition.java
@@ -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()));
}
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionTemplate.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionTemplate.java
index 954fc63936..5e86c29ed2 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionTemplate.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionTemplate.java
@@ -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() {
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionType.java
index 3d691bed0f..b0fb06974b 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionType.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceDefinitionType.java
@@ -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);
}
-
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceType.java
index 07c4031b34..ffd9212701 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceType.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/InterfaceType.java
@@ -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);
}
-
-
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeFilter.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeFilter.java
index be34394e34..014eb620d5 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeFilter.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeFilter.java
@@ -13,14 +13,12 @@
* 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);
+ }
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeTemplate.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeTemplate.java
index ae1ca01673..8e9b54c17b 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeTemplate.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeTemplate.java
@@ -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);
}
-
-
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeType.java
index 868a6f437a..eca056fa7a 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeType.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/NodeType.java
@@ -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();
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/OperationDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/OperationDefinition.java
index 8114686168..d8b5bd0530 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/OperationDefinition.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/OperationDefinition.java
@@ -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);
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/OperationDefinitionTemplate.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/OperationDefinitionTemplate.java
index 62f6a20d55..22f1151b43 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/OperationDefinitionTemplate.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/OperationDefinitionTemplate.java
@@ -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());
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/OperationDefinitionType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/OperationDefinitionType.java
index a40c91fdd6..0c46516287 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/OperationDefinitionType.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/OperationDefinitionType.java
@@ -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);
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ParameterDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ParameterDefinition.java
index f667e8a2bf..841adc91fb 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ParameterDefinition.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ParameterDefinition.java
@@ -13,10 +13,8 @@
* 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;
}
-
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PolicyDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PolicyDefinition.java
index a9a45c4a3f..3d4311c8df 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PolicyDefinition.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PolicyDefinition.java
@@ -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;
-
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PolicyType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PolicyType.java
index cd7da8614c..51680df5db 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PolicyType.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PolicyType.java
@@ -17,14 +17,12 @@
* 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;
-
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PreconditionDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PreconditionDefinition.java
index aaff76dafc..efc24803be 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PreconditionDefinition.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PreconditionDefinition.java
@@ -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,15 +17,14 @@
* 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;
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PropertyDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PropertyDefinition.java
index 331b7b0e64..a3ab24de9d 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PropertyDefinition.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PropertyDefinition.java
@@ -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.
@@ -33,30 +33,27 @@
* 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;
+ }
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PropertyType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PropertyType.java
index 1b91ca96d2..3cec134b86 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PropertyType.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/PropertyType.java
@@ -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;
+ }
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RelationshipTemplate.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RelationshipTemplate.java
index 17a3ae383a..4fa1f72ff4 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RelationshipTemplate.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RelationshipTemplate.java
@@ -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,24 +17,21 @@
* 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;
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RelationshipType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RelationshipType.java
index b2ff1a3e41..4ba5dee885 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RelationshipType.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RelationshipType.java
@@ -17,13 +17,11 @@
* 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
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Repository.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Repository.java
index d71731742f..1fad6b8407 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Repository.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Repository.java
@@ -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;
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RequirementAssignment.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RequirementAssignment.java
index 177b8c4a6a..6dd986614c 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RequirementAssignment.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RequirementAssignment.java
@@ -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;
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RequirementDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RequirementDefinition.java
index 48c9faad27..ae99f9325e 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RequirementDefinition.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/RequirementDefinition.java
@@ -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,67 +17,63 @@
* 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;
+ }
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Scalar.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Scalar.java
index 302ba4808c..13d3fe8daa 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Scalar.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Scalar.java
@@ -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,20 +17,17 @@
* 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;
+ }
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ScalarUnitValidator.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ScalarUnitValidator.java
index 5e2e2e5ee7..d5a99044e8 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ScalarUnitValidator.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ScalarUnitValidator.java
@@ -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
+}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ServiceTemplate.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ServiceTemplate.java
index becd34a8ef..758786dad5 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ServiceTemplate.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/ServiceTemplate.java
@@ -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;
}
-
-
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Status.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Status.java
index c25a6adbaa..a52968afbc 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Status.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Status.java
@@ -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;
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/StepDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/StepDefinition.java
index a20d398011..eef2b8a32d 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/StepDefinition.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/StepDefinition.java
@@ -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,75 +17,73 @@
* 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;
+ }
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/SubstitutionMapping.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/SubstitutionMapping.java
index a8d0718c4e..f6794a7b19 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/SubstitutionMapping.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/SubstitutionMapping.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-
package org.onap.sdc.tosca.datatypes.model;
import java.util.List;
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Template.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Template.java
index 490881688e..43abc0c65f 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Template.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Template.java
@@ -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 {
+
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/TimeInterval.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/TimeInterval.java
index 13332c9faf..330367270b 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/TimeInterval.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/TimeInterval.java
@@ -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;
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/TopologyTemplate.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/TopologyTemplate.java
index fde5f41bd2..b0e5e3eaa9 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/TopologyTemplate.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/TopologyTemplate.java
@@ -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;
+ }
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Trigger.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Trigger.java
index 440429461b..c1ab123a5d 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Trigger.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/Trigger.java
@@ -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);
}
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/WorkflowDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/WorkflowDefinition.java
index af5b61771c..e16cd3edb3 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/WorkflowDefinition.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/WorkflowDefinition.java
@@ -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,59 +17,56 @@
* 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;
+ }
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/extension/RequirementAssignmentExt.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/extension/RequirementAssignmentExt.java
index f32efe435e..b05c895c94 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/extension/RequirementAssignmentExt.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/extension/RequirementAssignmentExt.java
@@ -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;
-
-
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/extension/ServiceFilter.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/extension/ServiceFilter.java
index 572af3d16c..be1d1d9a7c 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/extension/ServiceFilter.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/extension/ServiceFilter.java
@@ -13,12 +13,10 @@
* 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;
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/AnnotationDefinition.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/AnnotationDefinition.java
index 8734dbcf07..bc1420de26 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/AnnotationDefinition.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/AnnotationDefinition.java
@@ -13,30 +13,28 @@
* 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;
+ }
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/AnnotationType.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/AnnotationType.java
index f0eef519a9..2f64da87e1 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/AnnotationType.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/AnnotationType.java
@@ -13,41 +13,38 @@
* 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;
- }
-
}
+}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/ParameterDefinitionExt.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/ParameterDefinitionExt.java
index ae3cc35986..41895dd5b4 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/ParameterDefinitionExt.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/ParameterDefinitionExt.java
@@ -13,50 +13,47 @@
* 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;
+ }
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/PropertyTypeExt.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/PropertyTypeExt.java
index 60f26501e0..1ead5a69cc 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/PropertyTypeExt.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/datatypes/model/heatextend/PropertyTypeExt.java
@@ -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;
}
-
-
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/error/ToscaRuntimeException.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/error/ToscaRuntimeException.java
index 10c67bc4df..e2295dd771 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/error/ToscaRuntimeException.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/error/ToscaRuntimeException.java
@@ -13,20 +13,19 @@
* 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);
+ }
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/CommonUtil.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/CommonUtil.java
index eb60d95889..d6ff22c501 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/CommonUtil.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/CommonUtil.java
@@ -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);
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/DataModelCloneUtil.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/DataModelCloneUtil.java
index c41282ff0d..c31c5bd85b 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/DataModelCloneUtil.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/DataModelCloneUtil.java
@@ -13,10 +13,8 @@
* 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);
}
-
-
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/DataModelConvertUtil.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/DataModelConvertUtil.java
index 0a2437588f..1d9befb6ca 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/DataModelConvertUtil.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/DataModelConvertUtil.java
@@ -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("../", "");
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/DataModelNormalizeUtil.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/DataModelNormalizeUtil.java
index b8a950cd85..dfa7451948 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/DataModelNormalizeUtil.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/DataModelNormalizeUtil.java
@@ -13,10 +13,8 @@
* 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;
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/MyPropertyUtils.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/MyPropertyUtils.java
index 466d669ad9..5115d0575b 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/MyPropertyUtils.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/MyPropertyUtils.java
@@ -17,22 +17,20 @@
* 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);
}
-
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/StrictMapAppenderConstructor.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/StrictMapAppenderConstructor.java
index 7babd428c8..678ba00724 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/StrictMapAppenderConstructor.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/StrictMapAppenderConstructor.java
@@ -17,18 +17,17 @@
* 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());
}
}
}
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/ToscaExtensionYamlUtil.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/ToscaExtensionYamlUtil.java
index 37d8411d9b..995ff94ffb 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/ToscaExtensionYamlUtil.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/ToscaExtensionYamlUtil.java
@@ -13,10 +13,8 @@
* 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))) {
diff --git a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/YamlUtil.java b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/YamlUtil.java
index 8530846fae..d8e592d353 100644
--- a/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/YamlUtil.java
+++ b/common/onap-tosca-datatype/src/main/java/org/onap/sdc/tosca/services/YamlUtil.java
@@ -13,9 +13,15 @@
* 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;
}
}
}