summaryrefslogtreecommitdiffstats
path: root/ms/controllerblueprints
diff options
context:
space:
mode:
authorDan Timoney <dt5972@att.com>2018-09-04 15:07:03 +0000
committerGerrit Code Review <gerrit@onap.org>2018-09-04 15:07:03 +0000
commit7eae5ab9020c85bad5e51653751556c581866ec8 (patch)
treecd41283008ffce6c68733b8acd4d59137c04cd37 /ms/controllerblueprints
parentf13f4f0d723bb11393ef2c0ce6f3d9bef760377e (diff)
parent2a7cd18ca4aaf6d050fe8740bcde53e9a214d224 (diff)
Merge "Controller Blueprints Microservice"
Diffstat (limited to 'ms/controllerblueprints')
-rw-r--r--ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationConstants.java1
-rw-r--r--ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationExceptionHandler.java1
-rw-r--r--ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/SwaggerConfig.java13
-rw-r--r--ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt2
-rw-r--r--ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt2
-rw-r--r--ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorDefaultServiceTest.kt3
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/validator/ResourceAssignmentValidator.java13
-rw-r--r--ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt5
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ApplicationRegistrationService.java1
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/AutoResourceMappingService.java39
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintEnhancerService.java24
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelCreateService.java48
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java8
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ServiceTemplateService.java28
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModel.java17
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelContent.java10
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelSearch.java16
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ModelType.java23
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ResourceDictionary.java25
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ConfigModelContentRepository.java32
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ConfigModelRepository.java27
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRest.java2
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/utils/ConfigModelUtils.java7
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidator.java3
-rw-r--r--ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidator.java12
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestTest.java5
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidationTest.java1
27 files changed, 163 insertions, 205 deletions
diff --git a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationConstants.java b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationConstants.java
index 3172ed38..2471bd5b 100644
--- a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationConstants.java
+++ b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationConstants.java
@@ -22,6 +22,7 @@ package org.onap.ccsdk.apps.controllerblueprints;
* @author Brinda Santh
* @version 1.0
*/
+@SuppressWarnings("unused")
public final class ApplicationConstants {
}
diff --git a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationExceptionHandler.java b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationExceptionHandler.java
index d9380a2f..0a403b8c 100644
--- a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationExceptionHandler.java
+++ b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/ApplicationExceptionHandler.java
@@ -29,6 +29,7 @@ import org.springframework.web.context.request.WebRequest;
@ControllerAdvice
@RestController
+@SuppressWarnings("unused")
public class ApplicationExceptionHandler {
private static EELFLogger log = EELFManager.getInstance().getLogger(ApplicationExceptionHandler.class);
@ExceptionHandler(Exception.class)
diff --git a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/SwaggerConfig.java b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/SwaggerConfig.java
index 5970bafd..67e3e5d0 100644
--- a/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/SwaggerConfig.java
+++ b/ms/controllerblueprints/application/src/main/java/org/onap/ccsdk/apps/controllerblueprints/SwaggerConfig.java
@@ -16,8 +16,6 @@
package org.onap.ccsdk.apps.controllerblueprints;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.PathSelectors;
@@ -27,11 +25,7 @@ import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
-
-import java.util.Arrays;
import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
/**
* SwaggerConfig
@@ -40,13 +34,10 @@ import java.util.Set;
*/
@Configuration
@EnableSwagger2
+@SuppressWarnings("unused")
public class SwaggerConfig {
- private static final Set<String> DEFAULT_PRODUCES_AND_CONSUMES =
- new HashSet<String>(Arrays.asList("application/json",
- "application/xml"));
- private static Logger log = LoggerFactory.getLogger(SwaggerConfig.class);
-
@Bean
+ @SuppressWarnings("unused")
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
diff --git a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
index 5a8d5428..9ba6313c 100644
--- a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
+++ b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
@@ -20,13 +20,13 @@ package org.onap.ccsdk.apps.controllerblueprints.core.service
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.node.NullNode
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.apps.controllerblueprints.core.data.ArtifactDefinition
import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate
import org.onap.ccsdk.apps.controllerblueprints.core.data.PropertyDefinition
import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
import org.slf4j.Logger
import org.slf4j.LoggerFactory
/**
diff --git a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt
index 886c3d2a..c41124ed 100644
--- a/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt
+++ b/ms/controllerblueprints/modules/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/JacksonUtils.kt
@@ -27,13 +27,13 @@ import com.fasterxml.jackson.databind.node.ObjectNode
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import org.apache.commons.io.FileUtils
import org.apache.commons.io.IOUtils
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintTypes
import org.onap.ccsdk.apps.controllerblueprints.core.format
import org.slf4j.LoggerFactory
import java.io.File
import java.nio.charset.Charset
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
/**
*
diff --git a/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorDefaultServiceTest.kt b/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorDefaultServiceTest.kt
index bccd946c..50d2ce44 100644
--- a/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorDefaultServiceTest.kt
+++ b/ms/controllerblueprints/modules/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorDefaultServiceTest.kt
@@ -18,10 +18,11 @@ package org.onap.ccsdk.apps.controllerblueprints.core.service
import org.junit.Before
import org.junit.Test
-import org.onap.ccsdk.apps.controllerblueprints.core.factory.BluePrintParserFactory
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.apps.controllerblueprints.core.factory.BluePrintParserFactory
import org.slf4j.Logger
import org.slf4j.LoggerFactory
+
/**
*
*
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/validator/ResourceAssignmentValidator.java b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/validator/ResourceAssignmentValidator.java
index c980a0c0..c9b37c26 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/validator/ResourceAssignmentValidator.java
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/java/org/onap/ccsdk/apps/controllerblueprints/resource/dict/validator/ResourceAssignmentValidator.java
@@ -29,15 +29,16 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.*;
+
/**
- *
* ResourceAssignmentValidator.java Purpose:
+ *
* @author Brinda Santh
*/
public class ResourceAssignmentValidator {
private static final Logger log = LoggerFactory.getLogger(ResourceAssignmentValidator.class);
private List<ResourceAssignment> assignments;
- private Map<String, ResourceAssignment> resourceAssignmentMap = new HashMap();
+ private Map<String, ResourceAssignment> resourceAssignmentMap = new HashMap<>();
private StrBuilder validationMessage = new StrBuilder();
public ResourceAssignmentValidator(List<ResourceAssignment> assignments) {
@@ -72,7 +73,7 @@ public class ResourceAssignmentValidator {
* This is a validateResourceAssignment to validate the Topology Template
*
* @return boolean
- * @throws BluePrintException
+ * @throws BluePrintException BluePrintException
*/
public boolean validateResourceAssignment() throws BluePrintException {
if (assignments != null && !assignments.isEmpty()) {
@@ -142,16 +143,14 @@ public class ResourceAssignmentValidator {
neighbors.forEach((v, vs) -> {
if (v == null) {
s.append("\n * -> [");
- List<ResourceAssignment> links = vs;
- for (ResourceAssignment resourceAssignment : links) {
+ for (ResourceAssignment resourceAssignment : vs) {
s.append("(" + resourceAssignment.getDictionaryName() + ":" + resourceAssignment.getName()
+ "),");
}
s.append("]");
} else {
s.append("\n (" + v.getDictionaryName() + ":" + v.getName() + ") -> [");
- List<ResourceAssignment> links = vs;
- for (ResourceAssignment resourceAssignment : links) {
+ for (ResourceAssignment resourceAssignment : vs) {
s.append("(" + resourceAssignment.getDictionaryName() + ":" + resourceAssignment.getName()
+ "),");
}
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt
index 6809831f..6a78ac85 100644
--- a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt
+++ b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/resource/dict/service/ResourceAssignmentValidationService.kt
@@ -16,15 +16,16 @@
package org.onap.ccsdk.apps.controllerblueprints.resource.dict.service
+import org.apache.commons.collections.CollectionUtils
+import org.apache.commons.lang3.StringUtils
import org.apache.commons.lang3.text.StrBuilder
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.apps.controllerblueprints.core.utils.TopologicalSortingUtils
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.validator.ResourceAssignmentValidator
import org.slf4j.LoggerFactory
-import org.apache.commons.collections.CollectionUtils
-import org.apache.commons.lang3.StringUtils
import java.io.Serializable
+
/**
* ResourceAssignmentValidationService.
*
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ApplicationRegistrationService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ApplicationRegistrationService.java
index 6d0ec889..5a4a2877 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ApplicationRegistrationService.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ApplicationRegistrationService.java
@@ -22,6 +22,7 @@ import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
@Component
+@SuppressWarnings("unused")
public class ApplicationRegistrationService {
@PostConstruct
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/AutoResourceMappingService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/AutoResourceMappingService.java
index 2c443783..5eba4fc7 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/AutoResourceMappingService.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/AutoResourceMappingService.java
@@ -17,6 +17,7 @@
package org.onap.ccsdk.apps.controllerblueprints.service;
+import com.google.common.base.Preconditions;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
@@ -45,6 +46,7 @@ import java.util.Map;
*/
@Service
+@SuppressWarnings("unused")
public class AutoResourceMappingService {
private static Logger log = LoggerFactory.getLogger(AutoResourceMappingService.class);
@@ -53,9 +55,8 @@ public class AutoResourceMappingService {
/**
* This is a AutoResourceMappingService constructor
- *
- * @param dataDictionaryRepository
- *
+ *
+ * @param dataDictionaryRepository dataDictionaryRepository
*/
public AutoResourceMappingService(ResourceDictionaryRepository dataDictionaryRepository) {
this.dataDictionaryRepository = dataDictionaryRepository;
@@ -63,8 +64,8 @@ public class AutoResourceMappingService {
/**
* This is a autoMap service to map the template keys automatically to Dictionary fields.
- *
- * @param resourceAssignments
+ *
+ * @param resourceAssignments resourceAssignments
* @return AutoMapResponse
*/
public AutoMapResponse autoMap(List<ResourceAssignment> resourceAssignments) throws BluePrintException {
@@ -83,8 +84,6 @@ public class AutoResourceMappingService {
log.info("Mapped Resource : {}", resourceAssignment);
- } else {
- // Do nothins
}
}
}
@@ -125,7 +124,7 @@ public class AutoResourceMappingService {
if (CollectionUtils.isNotEmpty(names)) {
List<ResourceDictionary> dictionaries = dataDictionaryRepository.findByNameIn(names);
- if (CollectionUtils.isNotEmpty( dictionaries)) {
+ if (CollectionUtils.isNotEmpty(dictionaries)) {
for (ResourceDictionary dataDictionary : dictionaries) {
if (dataDictionary != null && StringUtils.isNotBlank(dataDictionary.getName())) {
dictionaryMap.put(dataDictionary.getName(), dataDictionary);
@@ -167,14 +166,13 @@ public class AutoResourceMappingService {
private List<ResourceAssignment> getAllAutomapResourceAssignments(List<ResourceAssignment> resourceAssignments) {
List<ResourceDictionary> dictionaries = null;
List<String> names = new ArrayList<>();
- List<ResourceAssignment> resourceAssignmentsWithDepencies = resourceAssignments;
for (ResourceAssignment resourceAssignment : resourceAssignments) {
if (resourceAssignment != null && StringUtils.isNotBlank(resourceAssignment.getDictionaryName())) {
if (resourceAssignment.getDependencies() != null && !resourceAssignment.getDependencies().isEmpty()) {
List<String> dependencieNames = resourceAssignment.getDependencies();
for (String dependencieName : dependencieNames) {
if (StringUtils.isNotBlank(dependencieName) && !names.contains(dependencieName)
- && !checkAssignmentsExists(resourceAssignmentsWithDepencies, dependencieName)) {
+ && !checkAssignmentsExists(resourceAssignments, dependencieName)) {
names.add(dependencieName);
}
}
@@ -188,24 +186,25 @@ public class AutoResourceMappingService {
if (dictionaries != null) {
for (ResourceDictionary resourcedictionary : dictionaries) {
ResourceDefinition dictionaryDefinition = JacksonUtils.readValue(resourcedictionary.getDefinition(), ResourceDefinition.class);
+ Preconditions.checkNotNull(dictionaryDefinition, "failed to get Resource Definition from dictionary definition");
PropertyDefinition property = new PropertyDefinition();
- property.setRequired(true);
- ResourceAssignment resourceAssignment = new ResourceAssignment();
- resourceAssignment.setName(resourcedictionary.getName());
- resourceAssignment.setDictionaryName(resourcedictionary
- .getName());
- resourceAssignment.setVersion(0);
- resourceAssignment.setProperty(property);
+ property.setRequired(true);
+ ResourceAssignment resourceAssignment = new ResourceAssignment();
+ resourceAssignment.setName(resourcedictionary.getName());
+ resourceAssignment.setDictionaryName(resourcedictionary
+ .getName());
+ resourceAssignment.setVersion(0);
+ resourceAssignment.setProperty(property);
ResourceDictionaryUtils.populateSourceMapping(resourceAssignment, dictionaryDefinition);
- resourceAssignmentsWithDepencies.add(resourceAssignment);
+ resourceAssignments.add(resourceAssignment);
}
}
- return resourceAssignmentsWithDepencies;
+ return resourceAssignments;
}
- public boolean checkAssignmentsExists(List<ResourceAssignment> resourceAssignmentsWithDepencies, String resourceName) {
+ private boolean checkAssignmentsExists(List<ResourceAssignment> resourceAssignmentsWithDepencies, String resourceName) {
return resourceAssignmentsWithDepencies.stream().anyMatch(names -> names.getName().equalsIgnoreCase(resourceName));
}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintEnhancerService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintEnhancerService.java
index 0cf846c7..28be75e6 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintEnhancerService.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/BluePrintEnhancerService.java
@@ -19,6 +19,7 @@ package org.onap.ccsdk.apps.controllerblueprints.service;
import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.base.Preconditions;
+import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull;
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
@@ -47,7 +48,7 @@ public class BluePrintEnhancerService extends BluePrintEnhancerDefaultService {
private static Logger log = LoggerFactory.getLogger(BluePrintEnhancerService.class);
- private HashMap<String, DataType> recipeDataTypes = new HashMap<>();
+ private Map<String, DataType> recipeDataTypes = new HashMap<>();
public BluePrintEnhancerService(BluePrintRepoService bluePrintEnhancerRepoDBService) {
super(bluePrintEnhancerRepoDBService);
@@ -119,7 +120,7 @@ public class BluePrintEnhancerService extends BluePrintEnhancerDefaultService {
if (StringUtils.isNotBlank(recipeName)) {
DataType recipeDataType = this.recipeDataTypes.get(recipeName);
if (recipeDataType == null) {
- log.info("DataType not present for the recipe({})" , recipeName);
+ log.info("DataType not present for the recipe({})", recipeName);
recipeDataType = new DataType();
recipeDataType.setVersion("1.0.0");
recipeDataType.setDescription(
@@ -129,7 +130,7 @@ public class BluePrintEnhancerService extends BluePrintEnhancerDefaultService {
Map<String, PropertyDefinition> dataTypeProperties = new HashMap<>();
recipeDataType.setProperties(dataTypeProperties);
} else {
- log.info("DataType Already present for the recipe({})" , recipeName);
+ log.info("DataType Already present for the recipe({})", recipeName);
}
// Merge all the Recipe Properties
@@ -145,7 +146,7 @@ public class BluePrintEnhancerService extends BluePrintEnhancerDefaultService {
NodeTemplate nodeTemplate) {
Map<String, PropertyDefinition> dataTypeProperties = null;
- if (nodeTemplate != null) {
+ if (nodeTemplate != null && MapUtils.isNotEmpty(nodeTemplate.getCapabilities())) {
CapabilityAssignment capability =
nodeTemplate.getCapabilities().get(ConfigModelConstant.CAPABILITY_PROPERTY_MAPPING);
@@ -182,17 +183,18 @@ public class BluePrintEnhancerService extends BluePrintEnhancerDefaultService {
private void mergeDataTypeProperties(DataType dataType, Map<String, PropertyDefinition> mergeProperties) {
if (dataType != null && dataType.getProperties() != null && mergeProperties != null) {
// Add the Other Template Properties
- mergeProperties.forEach((mappingKey, propertyDefinition) -> {
- dataType.getProperties().put(mappingKey, propertyDefinition);
- });
+ mergeProperties.forEach((mappingKey, propertyDefinition) -> dataType.getProperties().put(mappingKey, propertyDefinition));
}
}
private void populateRecipeInputs(ServiceTemplate serviceTemplate) {
- if (this.recipeDataTypes != null && !this.recipeDataTypes.isEmpty()) {
+ if (serviceTemplate.getTopologyTemplate() != null
+ && MapUtils.isNotEmpty(serviceTemplate.getTopologyTemplate().getInputs())
+ && MapUtils.isNotEmpty(this.recipeDataTypes)
+ && MapUtils.isNotEmpty(serviceTemplate.getDataTypes())) {
this.recipeDataTypes.forEach((recipeName, recipeDataType) -> {
- String dataTypePrifix = recipeName.replace("-action", "") + "-request";
- String dataTypeName = "dt-" + dataTypePrifix;
+ String dataTypePrefix = recipeName.replace("-action", "") + "-request";
+ String dataTypeName = "dt-" + dataTypePrefix;
serviceTemplate.getDataTypes().put(dataTypeName, recipeDataType);
@@ -200,7 +202,7 @@ public class BluePrintEnhancerService extends BluePrintEnhancerDefaultService {
customInputProperty.setDescription("This is Dynamic Data type for the receipe " + recipeName + ".");
customInputProperty.setRequired(Boolean.FALSE);
customInputProperty.setType(dataTypeName);
- serviceTemplate.getTopologyTemplate().getInputs().put(dataTypePrifix, customInputProperty);
+ serviceTemplate.getTopologyTemplate().getInputs().put(dataTypePrefix, customInputProperty);
});
}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelCreateService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelCreateService.java
index e40c2cf4..f5213719 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelCreateService.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ConfigModelCreateService.java
@@ -197,7 +197,7 @@ public class ConfigModelCreateService {
private void deleteConfigModelContent(Long dbConfigModelId) {
if (dbConfigModelId != null) {
ConfigModel dbConfigModel = configModelRepository.getOne(dbConfigModelId);
- if (dbConfigModel != null && CollectionUtils.isNotEmpty(dbConfigModel.getConfigModelContents())) {
+ if (CollectionUtils.isNotEmpty(dbConfigModel.getConfigModelContents())) {
dbConfigModel.getConfigModelContents().clear();
log.debug("Configuration Model content deleting : {}", dbConfigModel.getConfigModelContents());
configModelRepository.saveAndFlush(dbConfigModel);
@@ -210,18 +210,15 @@ public class ConfigModelCreateService {
if (dbConfigModelId != null && configModel != null
&& CollectionUtils.isNotEmpty(configModel.getConfigModelContents())) {
ConfigModel dbConfigModel = configModelRepository.getOne(dbConfigModelId);
- if (dbConfigModel != null) {
- for (ConfigModelContent configModelContent : configModel.getConfigModelContents()) {
- if (configModelContent != null) {
- configModelContent.setId(null);
- configModelContent.setConfigModel(dbConfigModel);
- dbConfigModel.getConfigModelContents().add(configModelContent);
- log.debug("Configuration Model content adding : {}", configModelContent);
- }
+ for (ConfigModelContent configModelContent : configModel.getConfigModelContents()) {
+ if (configModelContent != null) {
+ configModelContent.setId(null);
+ configModelContent.setConfigModel(dbConfigModel);
+ dbConfigModel.getConfigModelContents().add(configModelContent);
+ log.debug("Configuration Model content adding : {}", configModelContent);
}
- configModelRepository.saveAndFlush(dbConfigModel);
}
-
+ configModelRepository.saveAndFlush(dbConfigModel);
}
}
@@ -229,22 +226,19 @@ public class ConfigModelCreateService {
String author) throws BluePrintException {
ConfigModel dbConfigModel = configModelRepository.getOne(dbConfigModelId);
- if (dbConfigModel != null) {
- // Populate tags from metadata
- String tags = getConfigModelTags(dbConfigModel);
- if (StringUtils.isBlank(tags)) {
- throw new BluePrintException("Failed to populate tags for the config model name " + artifactName);
- }
- dbConfigModel.setArtifactType(ApplicationConstants.ASDC_ARTIFACT_TYPE_SDNC_MODEL);
- dbConfigModel.setArtifactName(artifactName);
- dbConfigModel.setArtifactVersion(artifactVersion);
- dbConfigModel.setUpdatedBy(author);
- dbConfigModel.setPublished(ApplicationConstants.ACTIVE_N);
- dbConfigModel.setTags(tags);
- configModelRepository.saveAndFlush(dbConfigModel);
-
- log.info("Config model ({}) saved successfully.", dbConfigModel.getId());
+ // Populate tags from metadata
+ String tags = getConfigModelTags(dbConfigModel);
+ if (StringUtils.isBlank(tags)) {
+ throw new BluePrintException("Failed to populate tags for the config model name " + artifactName);
}
+ dbConfigModel.setArtifactType(ApplicationConstants.ASDC_ARTIFACT_TYPE_SDNC_MODEL);
+ dbConfigModel.setArtifactName(artifactName);
+ dbConfigModel.setArtifactVersion(artifactVersion);
+ dbConfigModel.setUpdatedBy(author);
+ dbConfigModel.setPublished(ApplicationConstants.ACTIVE_N);
+ dbConfigModel.setTags(tags);
+ configModelRepository.saveAndFlush(dbConfigModel);
+ log.info("Config model ({}) saved successfully.", dbConfigModel.getId());
return dbConfigModel;
}
@@ -282,8 +276,6 @@ public class ConfigModelCreateService {
configModel.getArtifactName());
}
tags = String.valueOf(serviceTemplate.getMetadata());
- } else {
- // Do Nothing
}
}
}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java
index 4b732cc3..89d48296 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/DataBaseInitService.java
@@ -55,7 +55,7 @@ import java.util.List;
*/
@Component
-@ConditionalOnProperty(name = "blueprints.load.initial-data", havingValue = "true", matchIfMissing = false)
+@ConditionalOnProperty(name = "blueprints.load.initial-data", havingValue = "true")
public class DataBaseInitService {
private static Logger log = LoggerFactory.getLogger(DataBaseInitService.class);
@@ -77,9 +77,9 @@ public class DataBaseInitService {
/**
* This is a DataBaseInitService, used to load the initial data
*
- * @param modelTypeService
- * @param resourceDictionaryService
- * @param configModelService
+ * @param modelTypeService modelTypeService
+ * @param resourceDictionaryService resourceDictionaryService
+ * @param configModelService configModelService
*/
public DataBaseInitService(ModelTypeService modelTypeService, ResourceDictionaryService resourceDictionaryService,
ConfigModelService configModelService) {
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ServiceTemplateService.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ServiceTemplateService.java
index 70b7917a..70cee3c9 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ServiceTemplateService.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/ServiceTemplateService.java
@@ -49,9 +49,9 @@ public class ServiceTemplateService {
/**
* This is a SchemaGeneratorService constructor
*
- * @param dataDictionaryRepository
- * @param configModelCreateService
- * @param bluePrintEnhancerService
+ * @param dataDictionaryRepository dataDictionaryRepository
+ * @param configModelCreateService configModelCreateService
+ * @param bluePrintEnhancerService bluePrintEnhancerService
*/
public ServiceTemplateService(ResourceDictionaryRepository dataDictionaryRepository,
ConfigModelCreateService configModelCreateService,
@@ -65,9 +65,9 @@ public class ServiceTemplateService {
/**
* This is a validateServiceTemplate method
*
- * @param serviceTemplate
+ * @param serviceTemplate serviceTemplate
* @return ServiceTemplate
- * @throws BluePrintException
+ * @throws BluePrintException BluePrintException
*/
public ServiceTemplate validateServiceTemplate(ServiceTemplate serviceTemplate) throws BluePrintException {
return this.configModelCreateService.validateServiceTemplate(serviceTemplate);
@@ -76,11 +76,10 @@ public class ServiceTemplateService {
/**
* This is a enrichServiceTemplate method
*
- * @param serviceTemplate
+ * @param serviceTemplate serviceTemplate
* @return ServiceTemplate
- * @throws BluePrintException
*/
- public ServiceTemplate enrichServiceTemplate(ServiceTemplate serviceTemplate) throws BluePrintException {
+ public ServiceTemplate enrichServiceTemplate(ServiceTemplate serviceTemplate) {
this.bluePrintEnhancerService.enhance(serviceTemplate);
return serviceTemplate;
}
@@ -88,22 +87,21 @@ public class ServiceTemplateService {
/**
* This is a autoMap method to map the template keys
*
- * @param resourceAssignments
+ * @param resourceAssignments resourceAssignments
* @return AutoMapResponse
- * @throws BluePrintException
+ * @throws BluePrintException BluePrintException
*/
public AutoMapResponse autoMap(List<ResourceAssignment> resourceAssignments) throws BluePrintException {
AutoResourceMappingService autoMappingService = new AutoResourceMappingService(dataDictionaryRepository);
- AutoMapResponse autoMapResponse = autoMappingService.autoMap(resourceAssignments);
- return autoMapResponse;
+ return autoMappingService.autoMap(resourceAssignments);
}
/**
* This is a validateResourceAssignments method
*
- * @param resourceAssignments
+ * @param resourceAssignments resourceAssignments
* @return List<ResourceAssignment>
- * @throws BluePrintException
+ * @throws BluePrintException BluePrintException
*/
public List<ResourceAssignment> validateResourceAssignments(List<ResourceAssignment> resourceAssignments)
throws BluePrintException {
@@ -120,7 +118,7 @@ public class ServiceTemplateService {
/**
* This is a generateResourceAssignments method
*
- * @param templateContent
+ * @param templateContent templateContent
* @return List<ResourceAssignment>
*/
public List<ResourceAssignment> generateResourceAssignments(ConfigModelContent templateContent) {
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModel.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModel.java
index 45382815..51c9a7c6 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModel.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModel.java
@@ -24,7 +24,6 @@ import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
-import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
@@ -81,8 +80,7 @@ public class ConfigModel implements Serializable {
@Column(name = "artifact_type")
private String artifactType;
- @NotNull
- @Column(name = "artifact_version")
+ @Column(name = "artifact_version", nullable = false)
@ApiModelProperty(required=true)
private String artifactVersion;
@@ -99,30 +97,25 @@ public class ConfigModel implements Serializable {
@Column(name = "creation_date")
private Date createdDate = new Date();
- @NotNull
- @Column(name = "artifact_name")
+ @Column(name = "artifact_name", nullable = false)
@ApiModelProperty(required=true)
private String artifactName;
- @NotNull
- @Column(name = "published")
+ @Column(name = "published", nullable = false)
@ApiModelProperty(required=true)
private String published;
- @NotNull
- @Column(name = "updated_by")
+ @Column(name = "updated_by", nullable = false)
@ApiModelProperty(required=true)
private String updatedBy;
- @NotNull
@Lob
- @Column(name = "tags")
+ @Column(name = "tags", nullable = false)
@ApiModelProperty(required=true)
private String tags;
@OneToMany(mappedBy = "configModel", fetch = FetchType.EAGER, orphanRemoval = true, cascade = CascadeType.ALL)
- @Column(nullable = true)
@JsonManagedReference
private List<ConfigModelContent> configModelContents = new ArrayList<>();
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelContent.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelContent.java
index 0c05ef95..60b3ed6b 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelContent.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelContent.java
@@ -23,7 +23,6 @@ import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
-import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.Objects;
@@ -45,13 +44,11 @@ public class ConfigModelContent {
@Column(name = "config_model_content_id")
private Long id;
- @NotNull
- @Column(name = "name")
+ @Column(name = "name", nullable = false)
@ApiModelProperty(required=true)
private String name;
- @NotNull
- @Column(name = "content_type")
+ @Column(name = "content_type", nullable = false)
@ApiModelProperty(required=true)
private String contentType;
@@ -65,9 +62,8 @@ public class ConfigModelContent {
@Column(name = "description")
private String description;
- @NotNull
@Lob
- @Column(name = "content")
+ @Column(name = "content", nullable = false)
@ApiModelProperty(required=true)
private String content;
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelSearch.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelSearch.java
index 2e901883..6ec39ab5 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelSearch.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ConfigModelSearch.java
@@ -20,7 +20,6 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.data.annotation.LastModifiedDate;
import javax.persistence.*;
-import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
@@ -40,8 +39,7 @@ public class ConfigModelSearch implements Serializable {
@Column(name = "artifact_type")
private String artifactType;
- @NotNull
- @Column(name = "artifact_version")
+ @Column(name = "artifact_version", nullable = false)
private String artifactVersion;
@Lob
@@ -57,21 +55,17 @@ public class ConfigModelSearch implements Serializable {
@Column(name = "creation_date")
private Date createdDate = new Date();
- @NotNull
- @Column(name = "artifact_name")
+ @Column(name = "artifact_name", nullable = false)
private String artifactName;
- @NotNull
- @Column(name = "published")
+ @Column(name = "published", nullable = false)
private String published;
- @NotNull
- @Column(name = "updated_by")
+ @Column(name = "updated_by", nullable = false)
private String updatedBy;
- @NotNull
@Lob
- @Column(name = "tags")
+ @Column(name = "tags", nullable = false)
private String tags;
public Long getId() {
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ModelType.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ModelType.java
index 61e4d118..eaa335b3 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ModelType.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ModelType.java
@@ -22,7 +22,6 @@ import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
-import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
@@ -40,41 +39,34 @@ public class ModelType implements Serializable {
private static final long serialVersionUID = 1L;
@Id
- @NotNull
@Column(name = "model_name", nullable = false)
@ApiModelProperty(required=true)
private String modelName;
- @NotNull
- @Column(name = "derived_from")
+ @Column(name = "derived_from", nullable = false)
@ApiModelProperty(required=true)
private String derivedFrom;
- @NotNull
- @Column(name = "definition_type")
+ @Column(name = "definition_type", nullable = false)
@ApiModelProperty(required=true)
private String definitionType;
- @NotNull
@Lob
- @Column(name = "definition")
+ @Column(name = "definition", nullable = false)
@ApiModelProperty(required=true)
private String definition;
- @NotNull
@Lob
- @Column(name = "description")
+ @Column(name = "description", nullable = false)
@ApiModelProperty(required=true)
private String description;
- @NotNull
- @Column(name = "version")
+ @Column(name = "version", nullable = false)
@ApiModelProperty(required=true)
private String version;
- @NotNull
@Lob
- @Column(name = "tags")
+ @Column(name = "tags", nullable = false)
@ApiModelProperty(required=true)
private String tags;
@@ -84,8 +76,7 @@ public class ModelType implements Serializable {
@Column(name = "creation_date")
private Date creationDate;
- @NotNull
- @Column(name = "updated_by")
+ @Column(name = "updated_by", nullable = false)
@ApiModelProperty(required=true)
private String updatedBy;
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ResourceDictionary.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ResourceDictionary.java
index 0d5879db..48758684 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ResourceDictionary.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/domain/ResourceDictionary.java
@@ -22,7 +22,6 @@ import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
-import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
@@ -39,23 +38,19 @@ public class ResourceDictionary implements Serializable {
private static final long serialVersionUID = 1L;
@Id
- @NotNull
- @Column(name = "name")
+ @Column(name = "name", nullable = false)
@ApiModelProperty(required=true)
private String name;
- @NotNull
- @Column(name = "resource_path")
+ @Column(name = "resource_path", nullable = false)
@ApiModelProperty(required=true)
private String resourcePath;
- @NotNull
- @Column(name = "resource_type")
+ @Column(name = "resource_type", nullable = false)
@ApiModelProperty(required=true)
private String resourceType;
- @NotNull
- @Column(name = "data_type")
+ @Column(name = "data_type", nullable = false)
@ApiModelProperty(required=true)
private String dataType;
@@ -70,21 +65,18 @@ public class ResourceDictionary implements Serializable {
@Column(name = "sample_value")
private String sampleValue;
- @NotNull
@Lob
- @Column(name = "definition")
+ @Column(name = "definition", nullable = false)
@ApiModelProperty(required=true)
private String definition;
- @NotNull
@Lob
- @Column(name = "description")
+ @Column(name = "description", nullable = false)
@ApiModelProperty(required=true)
private String description;
- @NotNull
@Lob
- @Column(name = "tags")
+ @Column(name = "tags", nullable = false)
@ApiModelProperty(required=true)
private String tags;
@@ -94,8 +86,7 @@ public class ResourceDictionary implements Serializable {
@Column(name = "creation_date")
private Date creationDate;
- @NotNull
- @Column(name = "updated_by")
+ @Column(name = "updated_by", nullable = false)
@ApiModelProperty(required=true)
private String updatedBy;
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ConfigModelContentRepository.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ConfigModelContentRepository.java
index ad2584a8..733cbbdb 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ConfigModelContentRepository.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ConfigModelContentRepository.java
@@ -21,6 +21,7 @@ import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModelConten
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
+import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Optional;
@@ -36,60 +37,65 @@ public interface ConfigModelContentRepository extends JpaRepository<ConfigModelC
/**
* This is a findById method
*
- * @param id
+ * @param id id
* @return Optional<AsdcArtifacts>
*/
- Optional<ConfigModelContent> findById(Long id);
+ @NotNull
+ Optional<ConfigModelContent> findById(@NotNull Long id);
/**
* This is a findTopByConfigModelAndContentType method
*
- * @param configModel
- * @param contentType
+ * @param configModel configModel
+ * @param contentType contentType
* @return Optional<ConfigModelContent>
*/
+ @SuppressWarnings("unused")
Optional<ConfigModelContent> findTopByConfigModelAndContentType(ConfigModel configModel, String contentType);
/**
* This is a findByConfigModelAndContentType method
*
- * @param configModel
- * @param contentType
+ * @param configModel configModel
+ * @param contentType contentType
* @return Optional<ConfigModelContent>
*/
+ @SuppressWarnings("unused")
List<ConfigModelContent> findByConfigModelAndContentType(ConfigModel configModel, String contentType);
/**
* This is a findByConfigModel method
*
- * @param configModel
+ * @param configModel configModel
* @return Optional<ConfigModelContent>
*/
+ @SuppressWarnings("unused")
List<ConfigModelContent> findByConfigModel(ConfigModel configModel);
/**
* This is a findByConfigModelAndContentTypeAndName method
*
- * @param configModel
- * @param contentType
- * @param name
+ * @param configModel configModel
+ * @param contentType contentType
+ * @param name name
* @return Optional<ConfigModelContent>
*/
+ @SuppressWarnings("unused")
Optional<ConfigModelContent> findByConfigModelAndContentTypeAndName(ConfigModel configModel,
String contentType, String name);
/**
* This is a deleteByMdeleteByConfigModelodelName method
*
- * @param configModel
+ * @param configModel configModel
*/
void deleteByConfigModel(ConfigModel configModel);
/**
* This is a deleteById method
*
- * @param id
+ * @param id id
*/
- void deleteById(Long id);
+ void deleteById(@NotNull Long id);
}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ConfigModelRepository.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ConfigModelRepository.java
index 4822ee97..0a60ab74 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ConfigModelRepository.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/repository/ConfigModelRepository.java
@@ -20,6 +20,7 @@ import org.onap.ccsdk.apps.controllerblueprints.service.domain.ConfigModel;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
+import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Optional;
@@ -34,16 +35,17 @@ public interface ConfigModelRepository extends JpaRepository<ConfigModel, Long>
/**
* This is a findById method
*
- * @param id
+ * @param id id
* @return Optional<AsdcArtifacts>
*/
- Optional<ConfigModel> findById(Long id);
+ @NotNull
+ Optional<ConfigModel> findById(@NotNull Long id);
/**
* This is a findByArtifactNameAndArtifactVersion method
*
- * @param artifactName
- * @param artifactVersion
+ * @param artifactName artifactName
+ * @param artifactVersion artifactVersion
* @return Optional<AsdcArtifacts>
*/
Optional<ConfigModel> findByArtifactNameAndArtifactVersion(String artifactName, String artifactVersion);
@@ -51,7 +53,7 @@ public interface ConfigModelRepository extends JpaRepository<ConfigModel, Long>
/**
* This is a findTopByArtifactNameOrderByArtifactIdDesc method
*
- * @param artifactName
+ * @param artifactName artifactName
* @return Optional<AsdcArtifacts>
*/
Optional<ConfigModel> findTopByArtifactNameOrderByArtifactVersionDesc(String artifactName);
@@ -59,15 +61,16 @@ public interface ConfigModelRepository extends JpaRepository<ConfigModel, Long>
/**
* This is a findTopByArtifactName method
*
- * @param artifactName
+ * @param artifactName artifactName
* @return Optional<AsdcArtifacts>
*/
+ @SuppressWarnings("unused")
List<ConfigModel> findTopByArtifactName(String artifactName);
/**
* This is a findByTagsContainingIgnoreCase method
*
- * @param tags
+ * @param tags tags
* @return Optional<ModelType>
*/
List<ConfigModel> findByTagsContainingIgnoreCase(String tags);
@@ -75,16 +78,18 @@ public interface ConfigModelRepository extends JpaRepository<ConfigModel, Long>
/**
* This is a deleteByArtifactNameAndArtifactVersion method
*
- * @param artifactName
- * @param artifactVersion
+ * @param artifactName artifactName
+ * @param artifactVersion artifactVersion
*/
+ @SuppressWarnings("unused")
void deleteByArtifactNameAndArtifactVersion(String artifactName, String artifactVersion);
/**
* This is a deleteById method
*
- * @param id
+ * @param id id
*/
- void deleteById(Long id);
+ @SuppressWarnings("unused")
+ void deleteById(@NotNull Long id);
}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRest.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRest.java
index f6e5c274..6bcbae96 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRest.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRest.java
@@ -20,8 +20,6 @@ import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
import org.onap.ccsdk.apps.controllerblueprints.service.ModelTypeService;
import org.onap.ccsdk.apps.controllerblueprints.service.domain.ModelType;
import org.springframework.http.MediaType;
-import org.springframework.stereotype.Component;
-import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;
import java.util.List;
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/utils/ConfigModelUtils.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/utils/ConfigModelUtils.java
index e31b04d1..bfc89b4e 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/utils/ConfigModelUtils.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/utils/ConfigModelUtils.java
@@ -39,9 +39,10 @@ import java.util.List;
public class ConfigModelUtils {
- private ConfigModelUtils(){
+ private ConfigModelUtils() {
}
+
private static Logger log = LoggerFactory.getLogger(ConfigModelUtils.class);
public static ConfigModel getConfigModel(String blueprintPath) throws Exception {
@@ -119,6 +120,8 @@ public class ConfigModelUtils {
public static List<String> getBlueprintNames(String pathName) {
File blueprintDir = new File(pathName);
Preconditions.checkNotNull(blueprintDir, "failed to find the blueprint pathName file");
- return Arrays.asList(blueprintDir.list(DirectoryFileFilter.INSTANCE));
+ String[] dirs = blueprintDir.list(DirectoryFileFilter.INSTANCE);
+ Preconditions.checkNotNull(dirs, "failed to find the blueprint directories");
+ return Arrays.asList(dirs);
}
}
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidator.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidator.java
index 1201f6b4..aaa445a4 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidator.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ModelTypeValidator.java
@@ -63,7 +63,6 @@ public class ModelTypeValidator {
*/
public static boolean validateModelTypeDefinition(String definitionType, String definitionContent)
throws BluePrintException {
- boolean valid = true;
if (StringUtils.isNotBlank(definitionContent)) {
if (BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE.equalsIgnoreCase(definitionType)) {
DataType dataType = JacksonUtils.readValue(definitionContent, DataType.class);
@@ -93,7 +92,7 @@ public class ModelTypeValidator {
}
}
- return valid;
+ return true;
}
/**
diff --git a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidator.java b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidator.java
index 430401bc..848a32f5 100644
--- a/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidator.java
+++ b/ms/controllerblueprints/modules/service/src/main/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidator.java
@@ -19,7 +19,6 @@ package org.onap.ccsdk.apps.controllerblueprints.service.validator;
import com.google.common.base.Preconditions;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull;
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants;
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate;
import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;
@@ -40,14 +39,14 @@ import java.util.Map;
public class ServiceTemplateValidator extends BluePrintValidatorDefaultService {
StringBuilder message = new StringBuilder();
- private Map<String, String> metaData = new HashMap();
+ private Map<String, String> metaData = new HashMap<>();
/**
* This is a validateServiceTemplate
*
- * @param serviceTemplateContent
+ * @param serviceTemplateContent serviceTemplateContent
* @return boolean
- * @throws BluePrintException
+ * @throws BluePrintException BluePrintException
*/
public boolean validateServiceTemplate(String serviceTemplateContent) throws BluePrintException {
if (StringUtils.isNotBlank(serviceTemplateContent)) {
@@ -65,7 +64,7 @@ public class ServiceTemplateValidator extends BluePrintValidatorDefaultService {
*
* @param serviceTemplate
* @return boolean
- * @throws BluePrintException
+ * @throws BluePrintException BluePrintException
*/
@SuppressWarnings("squid:S00112")
public boolean validateServiceTemplate(ServiceTemplate serviceTemplate) throws BluePrintException {
@@ -77,8 +76,7 @@ public class ServiceTemplateValidator extends BluePrintValidatorDefaultService {
/**
* This is a getMetaData to get the key information during the
*
- * @return Map<String ,
- * String>
+ * @return Map<String, String>
*/
public Map<String, String> getMetaData() {
return metaData;
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestTest.java
index d328b3ea..08bfeb10 100644
--- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestTest.java
+++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/rs/ModelTypeRestTest.java
@@ -95,7 +95,7 @@ public class ModelTypeRestTest {
List<ModelType> dbModelTypes = modelTypeRest.searchModelTypes(tags);
Assert.assertNotNull("Failed to search ResourceMapping by tags", dbModelTypes);
- Assert.assertEquals("Failed to search ResourceMapping by tags count", true, dbModelTypes.size() > 0);
+ Assert.assertTrue("Failed to search ResourceMapping by tags count", dbModelTypes.size() > 0);
}
@@ -109,8 +109,7 @@ public class ModelTypeRestTest {
List<ModelType> dbDatatypeModelTypes =
modelTypeRest.getModelTypeByDefinitionType(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE);
Assert.assertNotNull("Failed to find getModelTypeByDefinitionType by tags", dbDatatypeModelTypes);
- Assert.assertEquals("Failed to find getModelTypeByDefinitionType by count", true,
- dbDatatypeModelTypes.size() > 0);
+ Assert.assertTrue("Failed to find getModelTypeByDefinitionType by count", dbDatatypeModelTypes.size() > 0);
}
@Test
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidationTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidationTest.java
index 557c6dd8..0ef54452 100644
--- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidationTest.java
+++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidationTest.java
@@ -18,7 +18,6 @@ package org.onap.ccsdk.apps.controllerblueprints.service.validator;
import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
import org.junit.Assert;
import org.junit.Test;
import org.onap.ccsdk.apps.controllerblueprints.service.utils.ConfigModelUtils;